Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On 11/02/2012 12:43 AM, Toshi Kani wrote: Hi Tang, Rafael pointed out in my CPU hot-remove patch that acpi_bus_hot_remove_device() was not exported for modules. Looks like you have the same problem here. FYI, I just sent the following patch that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). https://lkml.org/lkml/2012/11/1/225 Hi Toshi, I see. Thanks for the info. :) Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thursday, November 01, 2012 04:39:50 PM Yinghai Lu wrote: > On Thu, Nov 1, 2012 at 4:15 PM, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > Subject: ACPI: Make seemingly useless check in osl.c more understandable > > > > There is a seemingly useless check in drivers/acpi/osl.c added by > > commit bc73675 (ACPI: fixes a false alarm from lockdep), which really > > is necessary to avoid false positive lockdep complaints. Document > > this and rearrange the code related to it so that it makes fewer > > checks. > > > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/acpi/osl.c | 21 ++--- > > 1 file changed, 14 insertions(+), 7 deletions(-) > > > > Index: linux/drivers/acpi/osl.c > > === > > --- linux.orig/drivers/acpi/osl.c > > +++ linux/drivers/acpi/osl.c > > @@ -944,17 +944,24 @@ static acpi_status __acpi_os_execute(acp > > * because the hotplug code may call driver .remove() functions, > > * which invoke flush_scheduled_work/acpi_os_wait_events_complete > > * to flush these workqueues. > > +* > > +* To prevent lockdep from complaining unnecessarily, make sure that > > +* there is a different static lockdep key for each workqueue by > > using > > +* INIT_WORK() for each of them separately. > > */ > > - queue = hp ? kacpi_hotplug_wq : > > - (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > > - dpc->wait = hp ? 1 : 0; > > - > > - if (queue == kacpi_hotplug_wq) > > + if (hp) { > > + queue = kacpi_hotplug_wq; > > + dpc->wait = 1; > > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > - else if (queue == kacpi_notify_wq) > > + } else if (type == OSL_NOTIFY_HANDLER) { > > + queue = kacpi_notify_wq; > > + dpc->wait = 0; > > yes, much clear. > > at the same can you changne > dpc allocation from kmalloc with kzalloc instead. > > then we save two lines for dpc->wait = 0 Good idea. :-) > After that > > Acked-by: Yinghai Lu For completeness: --- From: Rafael J. Wysocki Subject: ACPI: Make seemingly useless check in osl.c more understandable There is a seemingly useless check in drivers/acpi/osl.c added by commit bc73675 (ACPI: fixes a false alarm from lockdep), which really is necessary to avoid false positive lockdep complaints. Document this and rearrange the code related to it so that it makes fewer checks. Signed-off-by: Rafael J. Wysocki Acked-by: Yinghai Lu --- drivers/acpi/osl.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) Index: linux/drivers/acpi/osl.c === --- linux.orig/drivers/acpi/osl.c +++ linux/drivers/acpi/osl.c @@ -932,7 +932,7 @@ static acpi_status __acpi_os_execute(acp * having a static work_struct. */ - dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); + dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); if (!dpc) return AE_NO_MEMORY; @@ -944,17 +944,22 @@ static acpi_status __acpi_os_execute(acp * because the hotplug code may call driver .remove() functions, * which invoke flush_scheduled_work/acpi_os_wait_events_complete * to flush these workqueues. +* +* To prevent lockdep from complaining unnecessarily, make sure that +* there is a different static lockdep key for each workqueue by using +* INIT_WORK() for each of them separately. */ - queue = hp ? kacpi_hotplug_wq : - (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); - dpc->wait = hp ? 1 : 0; - - if (queue == kacpi_hotplug_wq) + if (hp) { + queue = kacpi_hotplug_wq; + dpc->wait = 1; INIT_WORK(&dpc->work, acpi_os_execute_deferred); - else if (queue == kacpi_notify_wq) + } else if (type == OSL_NOTIFY_HANDLER) { + queue = kacpi_notify_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); - else + } else { + queue = kacpid_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); + } /* * On some machines, a software-initiated SMI causes corruption unless -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thu, Nov 1, 2012 at 4:15 PM, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > Subject: ACPI: Make seemingly useless check in osl.c more understandable > > There is a seemingly useless check in drivers/acpi/osl.c added by > commit bc73675 (ACPI: fixes a false alarm from lockdep), which really > is necessary to avoid false positive lockdep complaints. Document > this and rearrange the code related to it so that it makes fewer > checks. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/acpi/osl.c | 21 ++--- > 1 file changed, 14 insertions(+), 7 deletions(-) > > Index: linux/drivers/acpi/osl.c > === > --- linux.orig/drivers/acpi/osl.c > +++ linux/drivers/acpi/osl.c > @@ -944,17 +944,24 @@ static acpi_status __acpi_os_execute(acp > * because the hotplug code may call driver .remove() functions, > * which invoke flush_scheduled_work/acpi_os_wait_events_complete > * to flush these workqueues. > +* > +* To prevent lockdep from complaining unnecessarily, make sure that > +* there is a different static lockdep key for each workqueue by using > +* INIT_WORK() for each of them separately. > */ > - queue = hp ? kacpi_hotplug_wq : > - (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > - dpc->wait = hp ? 1 : 0; > - > - if (queue == kacpi_hotplug_wq) > + if (hp) { > + queue = kacpi_hotplug_wq; > + dpc->wait = 1; > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > - else if (queue == kacpi_notify_wq) > + } else if (type == OSL_NOTIFY_HANDLER) { > + queue = kacpi_notify_wq; > + dpc->wait = 0; yes, much clear. at the same can you changne dpc allocation from kmalloc with kzalloc instead. then we save two lines for dpc->wait = 0 After that Acked-by: Yinghai Lu > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > - else > + } else { > + queue = kacpid_wq; > + dpc->wait = 0; > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + } > > /* > * On some machines, a software-initiated SMI causes corruption unless > > -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thursday, November 01, 2012 03:15:31 PM Yinghai Lu wrote: > On Thu, Nov 1, 2012 at 2:31 PM, Rafael J. Wysocki wrote: > >> oh, no, that commit should not be reverted. instead we should add some > >> comment for it... > >> > >> that mean : three path, will have three separated static lock dep key > >> from every INIT_WORK. > > > > I see. > > > > OK, I'll drop the patch removing it. > > > > What about the following comment: > > > > "To prevent lockdep from complaining unnecessarily, make sure that there > > is a different static lockdep key created for each workqueue by using > > INIT_WORK for each of them separately." > > > created ? > > how about "defined" ? > > or just remove "created" Yes, that's better. I suppose that the appended patch may be better still, though. Thanks, Rafael --- From: Rafael J. Wysocki Subject: ACPI: Make seemingly useless check in osl.c more understandable There is a seemingly useless check in drivers/acpi/osl.c added by commit bc73675 (ACPI: fixes a false alarm from lockdep), which really is necessary to avoid false positive lockdep complaints. Document this and rearrange the code related to it so that it makes fewer checks. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/osl.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) Index: linux/drivers/acpi/osl.c === --- linux.orig/drivers/acpi/osl.c +++ linux/drivers/acpi/osl.c @@ -944,17 +944,24 @@ static acpi_status __acpi_os_execute(acp * because the hotplug code may call driver .remove() functions, * which invoke flush_scheduled_work/acpi_os_wait_events_complete * to flush these workqueues. +* +* To prevent lockdep from complaining unnecessarily, make sure that +* there is a different static lockdep key for each workqueue by using +* INIT_WORK() for each of them separately. */ - queue = hp ? kacpi_hotplug_wq : - (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); - dpc->wait = hp ? 1 : 0; - - if (queue == kacpi_hotplug_wq) + if (hp) { + queue = kacpi_hotplug_wq; + dpc->wait = 1; INIT_WORK(&dpc->work, acpi_os_execute_deferred); - else if (queue == kacpi_notify_wq) + } else if (type == OSL_NOTIFY_HANDLER) { + queue = kacpi_notify_wq; + dpc->wait = 0; INIT_WORK(&dpc->work, acpi_os_execute_deferred); - else + } else { + queue = kacpid_wq; + dpc->wait = 0; INIT_WORK(&dpc->work, acpi_os_execute_deferred); + } /* * On some machines, a software-initiated SMI causes corruption unless -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thu, Nov 1, 2012 at 2:31 PM, Rafael J. Wysocki wrote: >> oh, no, that commit should not be reverted. instead we should add some >> comment for it... >> >> that mean : three path, will have three separated static lock dep key >> from every INIT_WORK. > > I see. > > OK, I'll drop the patch removing it. > > What about the following comment: > > "To prevent lockdep from complaining unnecessarily, make sure that there > is a different static lockdep key created for each workqueue by using > INIT_WORK for each of them separately." > created ? how about "defined" ? or just remove "created" -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
> > >> Hi Yinghai, > > >> > > >> Per the following thread, the code seems to be written in this way to > > >> allocate a separate lock_class_key for each work queue. It should have > > >> had some comment to explain this, though. > > >> > > >> https://lkml.org/lkml/2009/12/13/304 > > > > > > The code has evolved since then, however, so that it doesn't make sense > > > any more. > > > > > > > oh, no, that commit should not be reverted. instead we should add some > > comment for it... > > > > that mean : three path, will have three separated static lock dep key > > from every INIT_WORK. > > I see. > > OK, I'll drop the patch removing it. > > What about the following comment: > > "To prevent lockdep from complaining unnecessarily, make sure that there > is a different static lockdep key created for each workqueue by using > INIT_WORK for each of them separately." Looks good to me. Thanks, -Toshi > > Thanks, > Rafael > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thursday, November 01, 2012 01:16:22 PM Yinghai Lu wrote: > On Thu, Nov 1, 2012 at 1:17 PM, Rafael J. Wysocki wrote: > > On Thursday, November 01, 2012 01:17:58 PM Toshi Kani wrote: > >> On Thu, 2012-11-01 at 11:28 -0700, Yinghai Lu wrote: > >> > On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: > >> > > > >> > > Rafael pointed out in my CPU hot-remove patch that > >> > > acpi_bus_hot_remove_device() was not exported for modules. Looks like > >> > > you have the same problem here. FYI, I just sent the following patch > >> > > that exports acpi_bus_hot_remove_device() and > >> > > acpi_os_hotplug_execute(). > >> > > > >> > > https://lkml.org/lkml/2012/11/1/225 > >> > > >> > acpi_os_hotplug_execute() does not like having good quality yet. > >> > > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We > >> > can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* > >> > because the hotplug code may call driver .remove() functions, > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* > >> > which invoke flush_scheduled_work/acpi_os_wait_events_complete > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to > >> > flush these workqueues. > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue > >> > = hp ? kacpi_hotplug_wq : > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) > >> > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > >> > 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) > >> > dpc->wait = hp ? 1 : 0; > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if > >> > (queue == kacpi_hotplug_wq) > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) > >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else > >> > if (queue == kacpi_notify_wq) > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) > >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) > >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) > >> > > >> > really don't know why checking queue and call same code in every branch. > >> > > >> > from comm: > >> > > >> > commit bc73675b99fd9850dd914be01d71af99c5d2a1ae > >> > Author: Zhang Rui > >> > Date: Mon Mar 22 15:48:54 2010 +0800 > >> > > >> > ACPI: fixes a false alarm from lockdep > >> > > >> > fixes a false alarm from lockdep, as acpi hotplug workqueue waits > >> > other > >> > workqueues. > >> > http://bugzilla.kernel.org/show_bug.cgi?id=14553 > >> > https://bugzilla.kernel.org/show_bug.cgi?id=15521 > >> > > >> > Original-patch-from: Andrew Morton > >> > Signed-off-by: Shaohua Li > >> > Signed-off-by: Zhang Rui > >> > Signed-off-by: Len Brown > >> > > >> > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > >> > index 8e6d866..900da68 100644 > >> > --- a/drivers/acpi/osl.c > >> > +++ b/drivers/acpi/osl.c > >> > @@ -758,7 +758,14 @@ static acpi_status > >> > __acpi_os_execute(acpi_execute_type type, > >> > queue = hp ? kacpi_hotplug_wq : > >> > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : > >> > kacpid_wq); > >> > dpc->wait = hp ? 1 : 0; > >> > - INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > + > >> > + if (queue == kacpi_hotplug_wq) > >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > + else if (queue == kacpi_notify_wq) > >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > + else > >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > >> > + > >> > ret = queue_work(queue, &dpc->work); > >> > > >> > if (!ret) { > >> > > >> > > >> > Len or Rafael, > >> > can you just revert that silly patch? > >> > >> Hi Yinghai, > >> > >> Per the following thread, the code seems to be written in this way to > >> allocate a separate lock_class_key for each work queue. It should have > >> had some comment to explain this, though. > >> > >> https://lkml.org/lkml/2009/12/13/304 > > > > The code has evolved since then, however, so that it doesn't make sense > > any more. > > > > oh, no, that commit should not be reverted. instead we should add some > comment for it... > > that mean : three path, will have three separated static lock dep key > from every INIT_WORK. I see. OK, I'll drop the patch removing it. What about the following comment: "To
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thu, Nov 1, 2012 at 1:17 PM, Rafael J. Wysocki wrote: > On Thursday, November 01, 2012 01:17:58 PM Toshi Kani wrote: >> On Thu, 2012-11-01 at 11:28 -0700, Yinghai Lu wrote: >> > On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: >> > > >> > > Rafael pointed out in my CPU hot-remove patch that >> > > acpi_bus_hot_remove_device() was not exported for modules. Looks like >> > > you have the same problem here. FYI, I just sent the following patch >> > > that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). >> > > >> > > https://lkml.org/lkml/2012/11/1/225 >> > >> > acpi_os_hotplug_execute() does not like having good quality yet. >> > >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We >> > can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* >> > because the hotplug code may call driver .remove() functions, >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* >> > which invoke flush_scheduled_work/acpi_os_wait_events_complete >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to >> > flush these workqueues. >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue >> > = hp ? kacpi_hotplug_wq : >> > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) >> > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); >> > 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) >> > dpc->wait = hp ? 1 : 0; >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if >> > (queue == kacpi_hotplug_wq) >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else >> > if (queue == kacpi_notify_wq) >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) >> > INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) >> > >> > really don't know why checking queue and call same code in every branch. >> > >> > from comm: >> > >> > commit bc73675b99fd9850dd914be01d71af99c5d2a1ae >> > Author: Zhang Rui >> > Date: Mon Mar 22 15:48:54 2010 +0800 >> > >> > ACPI: fixes a false alarm from lockdep >> > >> > fixes a false alarm from lockdep, as acpi hotplug workqueue waits other >> > workqueues. >> > http://bugzilla.kernel.org/show_bug.cgi?id=14553 >> > https://bugzilla.kernel.org/show_bug.cgi?id=15521 >> > >> > Original-patch-from: Andrew Morton >> > Signed-off-by: Shaohua Li >> > Signed-off-by: Zhang Rui >> > Signed-off-by: Len Brown >> > >> > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c >> > index 8e6d866..900da68 100644 >> > --- a/drivers/acpi/osl.c >> > +++ b/drivers/acpi/osl.c >> > @@ -758,7 +758,14 @@ static acpi_status >> > __acpi_os_execute(acpi_execute_type type, >> > queue = hp ? kacpi_hotplug_wq : >> > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); >> > dpc->wait = hp ? 1 : 0; >> > - INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > + >> > + if (queue == kacpi_hotplug_wq) >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > + else if (queue == kacpi_notify_wq) >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > + else >> > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); >> > + >> > ret = queue_work(queue, &dpc->work); >> > >> > if (!ret) { >> > >> > >> > Len or Rafael, >> > can you just revert that silly patch? >> >> Hi Yinghai, >> >> Per the following thread, the code seems to be written in this way to >> allocate a separate lock_class_key for each work queue. It should have >> had some comment to explain this, though. >> >> https://lkml.org/lkml/2009/12/13/304 > > The code has evolved since then, however, so that it doesn't make sense > any more. > oh, no, that commit should not be reverted. instead we should add some comment for it... that mean : three path, will have three separated static lock dep key from every INIT_WORK. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thursday, November 01, 2012 01:17:58 PM Toshi Kani wrote: > On Thu, 2012-11-01 at 11:28 -0700, Yinghai Lu wrote: > > On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: > > > > > > Rafael pointed out in my CPU hot-remove patch that > > > acpi_bus_hot_remove_device() was not exported for modules. Looks like > > > you have the same problem here. FYI, I just sent the following patch > > > that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). > > > > > > https://lkml.org/lkml/2012/11/1/225 > > > > acpi_os_hotplug_execute() does not like having good quality yet. > > > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We > > can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* > > because the hotplug code may call driver .remove() functions, > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* > > which invoke flush_scheduled_work/acpi_os_wait_events_complete > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to > > flush these workqueues. > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue > > = hp ? kacpi_hotplug_wq : > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) > > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > > 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) > > dpc->wait = hp ? 1 : 0; > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if > > (queue == kacpi_hotplug_wq) > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) > > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else > > if (queue == kacpi_notify_wq) > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) > > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) > > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) > > > > really don't know why checking queue and call same code in every branch. > > > > from comm: > > > > commit bc73675b99fd9850dd914be01d71af99c5d2a1ae > > Author: Zhang Rui > > Date: Mon Mar 22 15:48:54 2010 +0800 > > > > ACPI: fixes a false alarm from lockdep > > > > fixes a false alarm from lockdep, as acpi hotplug workqueue waits other > > workqueues. > > http://bugzilla.kernel.org/show_bug.cgi?id=14553 > > https://bugzilla.kernel.org/show_bug.cgi?id=15521 > > > > Original-patch-from: Andrew Morton > > Signed-off-by: Shaohua Li > > Signed-off-by: Zhang Rui > > Signed-off-by: Len Brown > > > > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > > index 8e6d866..900da68 100644 > > --- a/drivers/acpi/osl.c > > +++ b/drivers/acpi/osl.c > > @@ -758,7 +758,14 @@ static acpi_status > > __acpi_os_execute(acpi_execute_type type, > > queue = hp ? kacpi_hotplug_wq : > > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > > dpc->wait = hp ? 1 : 0; > > - INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > + > > + if (queue == kacpi_hotplug_wq) > > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > + else if (queue == kacpi_notify_wq) > > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > + else > > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > > + > > ret = queue_work(queue, &dpc->work); > > > > if (!ret) { > > > > > > Len or Rafael, > > can you just revert that silly patch? > > Hi Yinghai, > > Per the following thread, the code seems to be written in this way to > allocate a separate lock_class_key for each work queue. It should have > had some comment to explain this, though. > > https://lkml.org/lkml/2009/12/13/304 The code has evolved since then, however, so that it doesn't make sense any more. Thanks, Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thursday, November 01, 2012 11:28:25 AM Yinghai Lu wrote: > On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: > > > > Rafael pointed out in my CPU hot-remove patch that > > acpi_bus_hot_remove_device() was not exported for modules. Looks like > > you have the same problem here. FYI, I just sent the following patch > > that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). > > > > https://lkml.org/lkml/2012/11/1/225 > > acpi_os_hotplug_execute() does not like having good quality yet. > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We > can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* > because the hotplug code may call driver .remove() functions, > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* > which invoke flush_scheduled_work/acpi_os_wait_events_complete > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to > flush these workqueues. > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue > = hp ? kacpi_hotplug_wq : > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) > dpc->wait = hp ? 1 : 0; > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if > (queue == kacpi_hotplug_wq) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else > if (queue == kacpi_notify_wq) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) > > really don't know why checking queue and call same code in every branch. > > from comm: > > commit bc73675b99fd9850dd914be01d71af99c5d2a1ae > Author: Zhang Rui > Date: Mon Mar 22 15:48:54 2010 +0800 > > ACPI: fixes a false alarm from lockdep > > fixes a false alarm from lockdep, as acpi hotplug workqueue waits other > workqueues. > http://bugzilla.kernel.org/show_bug.cgi?id=14553 > https://bugzilla.kernel.org/show_bug.cgi?id=15521 > > Original-patch-from: Andrew Morton > Signed-off-by: Shaohua Li > Signed-off-by: Zhang Rui > Signed-off-by: Len Brown > > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index 8e6d866..900da68 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -758,7 +758,14 @@ static acpi_status > __acpi_os_execute(acpi_execute_type type, > queue = hp ? kacpi_hotplug_wq : > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > dpc->wait = hp ? 1 : 0; > - INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + > + if (queue == kacpi_hotplug_wq) > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + else if (queue == kacpi_notify_wq) > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + else > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + > ret = queue_work(queue, &dpc->work); > > if (!ret) { > > > Len or Rafael, > can you just revert that silly patch? We're removing this as per: http://git.kernel.org/?p=linux/kernel/git/rafael/linux-pm.git;a=commit;h=77f1966ec9763e85e5f1a9202802e90c297b4c21 Thanks, Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thu, 2012-11-01 at 11:28 -0700, Yinghai Lu wrote: > On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: > > > > Rafael pointed out in my CPU hot-remove patch that > > acpi_bus_hot_remove_device() was not exported for modules. Looks like > > you have the same problem here. FYI, I just sent the following patch > > that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). > > > > https://lkml.org/lkml/2012/11/1/225 > > acpi_os_hotplug_execute() does not like having good quality yet. > > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We > can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* > because the hotplug code may call driver .remove() functions, > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* > which invoke flush_scheduled_work/acpi_os_wait_events_complete > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to > flush these workqueues. > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue > = hp ? kacpi_hotplug_wq : > c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) > dpc->wait = hp ? 1 : 0; > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if > (queue == kacpi_hotplug_wq) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else > if (queue == kacpi_notify_wq) > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) > INIT_WORK(&dpc->work, acpi_os_execute_deferred); > bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) > > really don't know why checking queue and call same code in every branch. > > from comm: > > commit bc73675b99fd9850dd914be01d71af99c5d2a1ae > Author: Zhang Rui > Date: Mon Mar 22 15:48:54 2010 +0800 > > ACPI: fixes a false alarm from lockdep > > fixes a false alarm from lockdep, as acpi hotplug workqueue waits other > workqueues. > http://bugzilla.kernel.org/show_bug.cgi?id=14553 > https://bugzilla.kernel.org/show_bug.cgi?id=15521 > > Original-patch-from: Andrew Morton > Signed-off-by: Shaohua Li > Signed-off-by: Zhang Rui > Signed-off-by: Len Brown > > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index 8e6d866..900da68 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -758,7 +758,14 @@ static acpi_status > __acpi_os_execute(acpi_execute_type type, > queue = hp ? kacpi_hotplug_wq : > (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); > dpc->wait = hp ? 1 : 0; > - INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + > + if (queue == kacpi_hotplug_wq) > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + else if (queue == kacpi_notify_wq) > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + else > + INIT_WORK(&dpc->work, acpi_os_execute_deferred); > + > ret = queue_work(queue, &dpc->work); > > if (!ret) { > > > Len or Rafael, > can you just revert that silly patch? Hi Yinghai, Per the following thread, the code seems to be written in this way to allocate a separate lock_class_key for each work queue. It should have had some comment to explain this, though. https://lkml.org/lkml/2009/12/13/304 Thanks, -Toshi > > Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani wrote: > > Rafael pointed out in my CPU hot-remove patch that > acpi_bus_hot_remove_device() was not exported for modules. Looks like > you have the same problem here. FYI, I just sent the following patch > that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). > > https://lkml.org/lkml/2012/11/1/225 acpi_os_hotplug_execute() does not like having good quality yet. c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 941) /* c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 942)* We can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 943)* because the hotplug code may call driver .remove() functions, c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 944)* which invoke flush_scheduled_work/acpi_os_wait_events_complete c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 945)* to flush these workqueues. c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 946)*/ c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 947) queue = hp ? kacpi_hotplug_wq : c02256be (Zhang Rui 2009-06-23 10:20:29 +0800 948) (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); 9ac61856 (Bjorn Helgaas 2009-08-31 22:32:10 + 949) dpc->wait = hp ? 1 : 0; bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 950) bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 951) if (queue == kacpi_hotplug_wq) bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 952) INIT_WORK(&dpc->work, acpi_os_execute_deferred); bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 953) else if (queue == kacpi_notify_wq) bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 954) INIT_WORK(&dpc->work, acpi_os_execute_deferred); bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 955) else bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 956) INIT_WORK(&dpc->work, acpi_os_execute_deferred); bc73675b (Zhang Rui 2010-03-22 15:48:54 +0800 957) really don't know why checking queue and call same code in every branch. from comm: commit bc73675b99fd9850dd914be01d71af99c5d2a1ae Author: Zhang Rui Date: Mon Mar 22 15:48:54 2010 +0800 ACPI: fixes a false alarm from lockdep fixes a false alarm from lockdep, as acpi hotplug workqueue waits other workqueues. http://bugzilla.kernel.org/show_bug.cgi?id=14553 https://bugzilla.kernel.org/show_bug.cgi?id=15521 Original-patch-from: Andrew Morton Signed-off-by: Shaohua Li Signed-off-by: Zhang Rui Signed-off-by: Len Brown diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8e6d866..900da68 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -758,7 +758,14 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, queue = hp ? kacpi_hotplug_wq : (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); dpc->wait = hp ? 1 : 0; - INIT_WORK(&dpc->work, acpi_os_execute_deferred); + + if (queue == kacpi_hotplug_wq) + INIT_WORK(&dpc->work, acpi_os_execute_deferred); + else if (queue == kacpi_notify_wq) + INIT_WORK(&dpc->work, acpi_os_execute_deferred); + else + INIT_WORK(&dpc->work, acpi_os_execute_deferred); + ret = queue_work(queue, &dpc->work); if (!ret) { Len or Rafael, can you just revert that silly patch? Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
On Wed, 2012-10-31 at 15:27 +0800, Tang Chen wrote: > This patch introduces a new function container_device_remove() to do > the container hot-remove job. It works like the following: > > 1. call acpi_bus_trim(device, 0) to stop the container device, >which means to unbind ACPI drivers first before remove devices. >(This feature is introduced by Lu Yinghai: > http://www.spinics.net/lists/linux-pci/msg17667.html) > 2. generate the KOBJ_OFFLINE uevent. (Did I do this correct ?) > 3. call acpi_bus_hot_remove_device(), which will call acpi_bus_trim(device, 1) >to remove the container. > > This patch is based on Lu Yinghai's work. > git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git > for-pci-split-pci-root-hp-2 > > Signed-off-by: Tang Chen > --- > drivers/acpi/container.c | 63 ++--- > 1 files changed, 53 insertions(+), 10 deletions(-) > > diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c > index a10eee6..4abec98 100644 > --- a/drivers/acpi/container.c > +++ b/drivers/acpi/container.c > @@ -166,6 +166,32 @@ static int container_device_add(struct acpi_device > **device, acpi_handle handle) > return result; > } > > +static int container_device_remove(struct acpi_device *device) > +{ > + int ret; > + struct acpi_eject_event *ej_event; > + > + /* stop container device at first */ > + ret = acpi_bus_trim(device, 0); > + pr_debug("acpi_bus_trim stop return %x\n", ret); > + if (ret) > + return ret; > + > + /* send the uevent before remove the device */ > + kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); > + > + ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); > + if (!ej_event) > + return -ENOMEM; > + > + ej_event->device = device; > + ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; > + > + acpi_bus_hot_remove_device(ej_event); Hi Tang, Rafael pointed out in my CPU hot-remove patch that acpi_bus_hot_remove_device() was not exported for modules. Looks like you have the same problem here. FYI, I just sent the following patch that exports acpi_bus_hot_remove_device() and acpi_os_hotplug_execute(). https://lkml.org/lkml/2012/11/1/225 Thanks, -Toshi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 3/3] Improve container_notify_cb() to support container hot-remove.
This patch introduces a new function container_device_remove() to do the container hot-remove job. It works like the following: 1. call acpi_bus_trim(device, 0) to stop the container device, which means to unbind ACPI drivers first before remove devices. (This feature is introduced by Lu Yinghai: http://www.spinics.net/lists/linux-pci/msg17667.html) 2. generate the KOBJ_OFFLINE uevent. (Did I do this correct ?) 3. call acpi_bus_hot_remove_device(), which will call acpi_bus_trim(device, 1) to remove the container. This patch is based on Lu Yinghai's work. git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-split-pci-root-hp-2 Signed-off-by: Tang Chen --- drivers/acpi/container.c | 63 ++--- 1 files changed, 53 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index a10eee6..4abec98 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -166,6 +166,32 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle) return result; } +static int container_device_remove(struct acpi_device *device) +{ + int ret; + struct acpi_eject_event *ej_event; + + /* stop container device at first */ + ret = acpi_bus_trim(device, 0); + pr_debug("acpi_bus_trim stop return %x\n", ret); + if (ret) + return ret; + + /* send the uevent before remove the device */ + kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); + + ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); + if (!ej_event) + return -ENOMEM; + + ej_event->device = device; + ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; + + acpi_bus_hot_remove_device(ej_event); + + return 0; +} + /* This function is of type acpi_osd_exec_callback */ static void _container_notify_cb(void *context) { @@ -182,6 +208,9 @@ static void _container_notify_cb(void *context) handle = cb_data->handle; type = cb_data->type; + present = is_device_present(handle); + status = acpi_bus_get_device(handle, &device); + switch (type) { case ACPI_NOTIFY_BUS_CHECK: /* Fall through */ @@ -190,13 +219,16 @@ static void _container_notify_cb(void *context) (type == ACPI_NOTIFY_BUS_CHECK) ? "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); - present = is_device_present(handle); - status = acpi_bus_get_device(handle, &device); if (!present) { if (ACPI_SUCCESS(status)) { /* device exist and this is a remove request */ - device->flags.eject_pending = 1; - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); + result = container_device_remove(device); + if (result) { + dev_warn(&device->dev, "%s: Failed to " + "remove container\n", + __func__); + break; + } goto out; } break; @@ -207,7 +239,9 @@ static void _container_notify_cb(void *context) result = container_device_add(&device, handle); if (result) { - printk(KERN_WARNING "Failed to add container\n"); + dev_warn(&device->dev, + "%s: Failed to add container\n", + __func__); break; } @@ -216,12 +250,21 @@ static void _container_notify_cb(void *context) break; case ACPI_NOTIFY_EJECT_REQUEST: - if (!acpi_bus_get_device(handle, &device) && device) { - device->flags.eject_pending = 1; - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); - goto out; + printk(KERN_WARNING "Container driver received %s event\n", + "ACPI_NOTIFY_EJECT_REQUEST"); + + if (!present || ACPI_FAILURE(status) || !device) + break; + + result = container_device_remove(device); + if (result) { + dev_warn(&device->dev, + "%s: Failed to remove container\n", + __func__); + break; } - break; + + goto out; default: /* non-hotplug event; possibly handled by other handler */ -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body