2012-11-01 14:50:08

by Toshi Kani

[permalink] [raw]
Subject: [PATCH v3 0/2] ACPI: CPU hot-remove support

This patchset adds support of CPU hot-remove via an ACPI eject
notification to the ACPI processor driver. The CPU hot-remove
operation shares the same code path with the sysfs eject operation.

The patchset also exports two functions necessary to initiate
hot-remove operations from modules, such as the processor driver.

The patchset is based on the current Linus's tree.

v3:
- Added patch 1/2 to export functions for hot-remove

v2:
- Rebased to the latest baseline

---
Toshi Kani (2):
ACPI: Export functions for hot-remove
ACPI: Add ACPI CPU hot-remove support

---
drivers/acpi/osl.c | 1 +
drivers/acpi/processor_driver.c | 27 +++++++++++++++++----------
drivers/acpi/scan.c | 1 +
3 files changed, 19 insertions(+), 10 deletions(-)


2012-11-01 14:50:20

by Toshi Kani

[permalink] [raw]
Subject: [PATCH v3 2/2] ACPI: Add ACPI CPU hot-remove support

Added support of CPU hot-remove via an ACPI eject notification.
It calls acpi_bus_hot_remove_device(), which shares the same code
path with the sysfs eject operation. acpi_os_hotplug_execute()
runs the hot-remove operation in kacpi_hotplug_wq and serializes
it between ACPI hot-remove and sysfs eject requests.

Signed-off-by: Toshi Kani <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Tested-by: IgorMammedov <[email protected]>
Tested-by: Vijay Mohan Pandarathil <[email protected]>
Tested-by: Prarit Bhargava <[email protected]>
---
drivers/acpi/processor_driver.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index bd4e5dc..ac63b6f 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -695,8 +695,8 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
static void acpi_processor_hotplug_notify(acpi_handle handle,
u32 event, void *data)
{
- struct acpi_processor *pr;
struct acpi_device *device = NULL;
+ struct acpi_eject_event *ej_event = NULL;
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
int result;

@@ -728,20 +728,27 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
"received ACPI_NOTIFY_EJECT_REQUEST\n"));

if (acpi_bus_get_device(handle, &device)) {
- printk(KERN_ERR PREFIX
- "Device don't exist, dropping EJECT\n");
+ pr_err(PREFIX "Device don't exist, dropping EJECT\n");
break;
}
- pr = acpi_driver_data(device);
- if (!pr) {
- printk(KERN_ERR PREFIX
- "Driver data is NULL, dropping EJECT\n");
+ if (!acpi_driver_data(device)) {
+ pr_err(PREFIX "Driver data is NULL, dropping EJECT\n");
break;
}

- /* REVISIT: update when eject is supported */
- ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
- break;
+ ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
+ if (!ej_event) {
+ pr_err(PREFIX "No memory, dropping EJECT\n");
+ break;
+ }
+
+ ej_event->handle = handle;
+ ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
+ acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
+ (void *)ej_event);
+
+ /* eject is performed asynchronously */
+ return;

default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
--
1.7.11.7

2012-11-01 14:50:16

by Toshi Kani

[permalink] [raw]
Subject: [PATCH v3 1/2] ACPI: Export functions for hot-remove

Exported acpi_os_hotplug_execute() and acpi_bus_hot_remove_device()
so that they can be called from modules for hot-remove operations.

Signed-off-by: Toshi Kani <[email protected]>
---
drivers/acpi/osl.c | 1 +
drivers/acpi/scan.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 9eaf708..7dfe91d 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -986,6 +986,7 @@ acpi_status acpi_os_hotplug_execute(acpi_osd_exec_callback function,
{
return __acpi_os_execute(0, function, context, 1);
}
+EXPORT_SYMBOL(acpi_os_hotplug_execute);

void acpi_os_wait_events_complete(void)
{
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1fcb867..a81845e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -157,6 +157,7 @@ err_out:
kfree(context);
return;
}
+EXPORT_SYMBOL(acpi_bus_hot_remove_device);

static ssize_t
acpi_eject_store(struct device *d, struct device_attribute *attr,
--
1.7.11.7

2012-11-02 12:41:57

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] ACPI: CPU hot-remove support

On Thursday, November 01, 2012 08:42:11 AM Toshi Kani wrote:
> This patchset adds support of CPU hot-remove via an ACPI eject
> notification to the ACPI processor driver. The CPU hot-remove
> operation shares the same code path with the sysfs eject operation.
>
> The patchset also exports two functions necessary to initiate
> hot-remove operations from modules, such as the processor driver.
>
> The patchset is based on the current Linus's tree.
>
> v3:
> - Added patch 1/2 to export functions for hot-remove
>
> v2:
> - Rebased to the latest baseline
>
> ---
> Toshi Kani (2):
> ACPI: Export functions for hot-remove
> ACPI: Add ACPI CPU hot-remove support

Both patches applied to the linux-next branch of the linux-pm.git
tree as v3.8 material.

Thanks,
Rafael


> ---
> drivers/acpi/osl.c | 1 +
> drivers/acpi/processor_driver.c | 27 +++++++++++++++++----------
> drivers/acpi/scan.c | 1 +
> 3 files changed, 19 insertions(+), 10 deletions(-)
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

2012-11-02 14:15:21

by Toshi Kani

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] ACPI: CPU hot-remove support

On Fri, 2012-11-02 at 13:46 +0100, Rafael J. Wysocki wrote:
> On Thursday, November 01, 2012 08:42:11 AM Toshi Kani wrote:
> > This patchset adds support of CPU hot-remove via an ACPI eject
> > notification to the ACPI processor driver. The CPU hot-remove
> > operation shares the same code path with the sysfs eject operation.
> >
> > The patchset also exports two functions necessary to initiate
> > hot-remove operations from modules, such as the processor driver.
> >
> > The patchset is based on the current Linus's tree.
> >
> > v3:
> > - Added patch 1/2 to export functions for hot-remove
> >
> > v2:
> > - Rebased to the latest baseline
> >
> > ---
> > Toshi Kani (2):
> > ACPI: Export functions for hot-remove
> > ACPI: Add ACPI CPU hot-remove support
>
> Both patches applied to the linux-next branch of the linux-pm.git
> tree as v3.8 material.

Great!! Thanks Rafael!
-Toshi


>
> Thanks,
> Rafael
>
>
> > ---
> > drivers/acpi/osl.c | 1 +
> > drivers/acpi/processor_driver.c | 27 +++++++++++++++++----------
> > drivers/acpi/scan.c | 1 +
> > 3 files changed, 19 insertions(+), 10 deletions(-)
> >