[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1352042642-7306-7-git-send-email-jiang.liu@huawei.com>
Date: Sun, 4 Nov 2012 23:23:59 +0800
From: Jiang Liu <liuj97@...il.com>
To: "Rafael J . Wysocki" <rjw@...k.pl>,
Yinghai Lu <yinghai@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
Wen Congyang <wency@...fujitsu.com>,
Tang Chen <tangchen@...fujitsu.com>,
Taku Izumi <izumi.taku@...fujitsu.com>,
Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Jiang Liu <jiang.liu@...wei.com>,
Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
Huang Ying <ying.huang@...el.com>,
Bob Moore <robert.moore@...el.com>,
Len Brown <lenb@...nel.org>,
"Srivatsa S . Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Yijing Wang <wangyijing@...wei.com>,
Hanjun Guo <guohanjun@...wei.com>,
Jiang Liu <liuj97@...il.com>, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
linux-mm@...ck.org
Subject: [ACPIHP PATCH part4 6/9] ACPIHP/processor: reject online/offline requests when doing processor hotplug
When doing physical processor hotplug, all affected CPUs should be
handled in atomic. In other words, it shouldn't be disturbed by
online/offline requests from CPU device's online sysfs interface.
For example, it's fatal if a CPU is onlined through CPU device's
online sysfs interface between the hotplug driver offlines all affected
CPUs and powers the physical processor off.
So temporarily reject online/offline requests from CPU device's online
sysfs interface by setting the busy flag when doing physical processor
hotplug.
Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
drivers/acpi/processor_driver.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 53e364d..22214fc 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -703,7 +703,7 @@ static int acpi_processor_pre_configure(struct acpi_device *device,
return result;
BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
- result = arch_register_cpu(pr->id, 0);
+ result = arch_register_cpu(pr->id, 1);
if (result) {
acpi_unmap_lsapic(pr->id);
pr->id = -1;
@@ -751,10 +751,26 @@ static void acpi_processor_post_configure(struct acpi_device *device,
if (!cpu_online(pr->id) && cpu_up(pr->id))
dev_warn(&device->dev,
"fails to online CPU%d.\n", pr->id);
+ cpu_set_busy(pr->id, 0);
} else if (cmd == ACPIHP_DEV_POST_CMD_ROLLBACK)
acpi_processor_reset(device, pr);
}
+static int acpi_processor_pre_release(struct acpi_device *device,
+ struct acpihp_cancel_context *ctx)
+{
+ int result;
+ struct acpi_processor *pr;
+
+ if (!device || !acpi_driver_data(device))
+ return -EINVAL;
+ pr = acpi_driver_data(device);
+
+ result = cpu_set_busy(pr->id, 1);
+
+ return result ? -EBUSY : 0;
+}
+
static int acpi_processor_release(struct acpi_device *device,
struct acpihp_cancel_context *ctx)
{
@@ -779,9 +795,11 @@ static void acpi_processor_post_release(struct acpi_device *device,
BUG_ON(!device || !acpi_driver_data(device));
pr = acpi_driver_data(device);
- if (cmd == ACPIHP_DEV_POST_CMD_ROLLBACK)
+ if (cmd == ACPIHP_DEV_POST_CMD_ROLLBACK) {
if (!cpu_online(pr->id))
cpu_up(pr->id);
+ cpu_set_busy(pr->id, 0);
+ }
}
static void acpi_processor_unconfigure(struct acpi_device *device)
@@ -799,6 +817,7 @@ static struct acpihp_dev_ops acpi_processor_hp_ops = {
.pre_configure = &acpi_processor_pre_configure,
.configure = &acpi_processor_configure,
.post_configure = &acpi_processor_post_configure,
+ .pre_release = &acpi_processor_pre_release,
.release = &acpi_processor_release,
.post_release = &acpi_processor_post_release,
.unconfigure = &acpi_processor_unconfigure,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists