mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 RESEND] ACPI: Add ACPI CPU hot-remove support
@ 2012-10-19 19:09 Toshi Kani
  2012-10-31 22:27 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Toshi Kani @ 2012-10-19 19:09 UTC (permalink / raw)
  To: linux-acpi, lenb, rjw
  Cc: linux-kernel, isimatu.yasuaki, imammedo, vijaymohan.pandarathil,
	prarit, bhelgaas, Toshi Kani

Added CPU hot-remove support through 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()
serializes hot-remove operations between ACPI hot-remove and sysfs
eject requests.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Tested-by: IgorMammedov <imammedo@redhat.com>
Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
Tested-by: Prarit Bhargava <prarit@redhat.com>
---
v2: Rebased to the current Linus's tree.
---
 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 e78c2a5..1cc9652 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -694,8 +694,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;
 
@@ -727,20 +727,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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 RESEND] ACPI: Add ACPI CPU hot-remove support
  2012-10-19 19:09 [PATCH v2 RESEND] ACPI: Add ACPI CPU hot-remove support Toshi Kani
@ 2012-10-31 22:27 ` Rafael J. Wysocki
  2012-10-31 22:35   ` Toshi Kani
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-10-31 22:27 UTC (permalink / raw)
  To: Toshi Kani
  Cc: linux-acpi, lenb, linux-kernel, isimatu.yasuaki, imammedo,
	vijaymohan.pandarathil, prarit, bhelgaas

On Friday, October 19, 2012 01:09:53 PM Toshi Kani wrote:
> Added CPU hot-remove support through 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()
> serializes hot-remove operations between ACPI hot-remove and sysfs
> eject requests.
> 
> Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Tested-by: IgorMammedov <imammedo@redhat.com>
> Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
> Tested-by: Prarit Bhargava <prarit@redhat.com>

This doesn't build with modular processor driver.

Thanks,
Rafael


> ---
> v2: Rebased to the current Linus's tree.
> ---
>  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 e78c2a5..1cc9652 100644
> --- a/drivers/acpi/processor_driver.c
> +++ b/drivers/acpi/processor_driver.c
> @@ -694,8 +694,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;
>  
> @@ -727,20 +727,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,
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 RESEND] ACPI: Add ACPI CPU hot-remove support
  2012-10-31 22:27 ` Rafael J. Wysocki
@ 2012-10-31 22:35   ` Toshi Kani
  0 siblings, 0 replies; 3+ messages in thread
From: Toshi Kani @ 2012-10-31 22:35 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, lenb, linux-kernel, isimatu.yasuaki, imammedo,
	vijaymohan.pandarathil, prarit, bhelgaas

On Wed, 2012-10-31 at 23:27 +0100, Rafael J. Wysocki wrote:
> On Friday, October 19, 2012 01:09:53 PM Toshi Kani wrote:
> > Added CPU hot-remove support through 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()
> > serializes hot-remove operations between ACPI hot-remove and sysfs
> > eject requests.
> > 
> > Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> > Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> > Tested-by: IgorMammedov <imammedo@redhat.com>
> > Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
> > Tested-by: Prarit Bhargava <prarit@redhat.com>
> 
> This doesn't build with modular processor driver.

Hi Rafael,

Thanks for pointing this out!  I will fix the issue and send an updated
version.

-Toshi


> 
> Thanks,
> Rafael
> 
> 
> > ---
> > v2: Rebased to the current Linus's tree.
> > ---
> >  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 e78c2a5..1cc9652 100644
> > --- a/drivers/acpi/processor_driver.c
> > +++ b/drivers/acpi/processor_driver.c
> > @@ -694,8 +694,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;
> >  
> > @@ -727,20 +727,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,
> > 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-31 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19 19:09 [PATCH v2 RESEND] ACPI: Add ACPI CPU hot-remove support Toshi Kani
2012-10-31 22:27 ` Rafael J. Wysocki
2012-10-31 22:35   ` Toshi Kani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome