Patchwork [v3,3/3] Improve container_notify_cb() to support container hot-remove.

login
register
mail settings
Submitter Yinghai Lu
Date Nov. 1, 2012, 6:28 p.m.
Message ID <CAE9FiQXxHz_RntOc2gxxDscv8+mDQ2XBL0sHSrptj_arwUb8-A@mail.gmail.com>
Download mbox | patch
Permalink /patch/196330/
State Not Applicable
Headers show

Comments

Yinghai Lu - Nov. 1, 2012, 6:28 p.m.
On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
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 <akpm@linux-foundation.org>
    Signed-off-by: Shaohua Li <shaohua.li@intel.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

        if (!ret) {


Len or Rafael,
can you just revert that silly patch?

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Toshi Kani - Nov. 1, 2012, 7:17 p.m.
On Thu, 2012-11-01 at 11:28 -0700, Yinghai Lu wrote:
> On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
> 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 <akpm@linux-foundation.org>
>     Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>     Signed-off-by: Zhang Rui <rui.zhang@intel.com>
>     Signed-off-by: Len Brown <len.brown@intel.com>
> 
> 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-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki - Nov. 1, 2012, 8:16 p.m.
On Thursday, November 01, 2012 11:28:25 AM Yinghai Lu wrote:
> On Thu, Nov 1, 2012 at 9:43 AM, Toshi Kani <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
> 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 <akpm@linux-foundation.org>
>     Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>     Signed-off-by: Zhang Rui <rui.zhang@intel.com>
>     Signed-off-by: Len Brown <len.brown@intel.com>
> 
> 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
Yinghai Lu - Nov. 1, 2012, 8:16 p.m.
On Thu, Nov 1, 2012 at 1:17 PM, Rafael J. Wysocki <rjw@sisk.pl> 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 <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
>> > 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 <akpm@linux-foundation.org>
>> >     Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>> >     Signed-off-by: Zhang Rui <rui.zhang@intel.com>
>> >     Signed-off-by: Len Brown <len.brown@intel.com>
>> >
>> > 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-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki - Nov. 1, 2012, 8:17 p.m.
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 <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
> > 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 <akpm@linux-foundation.org>
> >     Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> >     Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> >     Signed-off-by: Len Brown <len.brown@intel.com>
> > 
> > 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
Rafael J. Wysocki - Nov. 1, 2012, 9:31 p.m.
On Thursday, November 01, 2012 01:16:22 PM Yinghai Lu wrote:
> On Thu, Nov 1, 2012 at 1:17 PM, Rafael J. Wysocki <rjw@sisk.pl> 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 <toshi.kani@hp.com> 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 +0000  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 <rui.zhang@intel.com>
> >> > 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 <akpm@linux-foundation.org>
> >> >     Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> >> >     Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> >> >     Signed-off-by: Len Brown <len.brown@intel.com>
> >> >
> >> > 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 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."

Thanks,
Rafael
Toshi Kani - Nov. 1, 2012, 9:51 p.m.
> > >> 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-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu - Nov. 1, 2012, 10:15 p.m.
On Thu, Nov 1, 2012 at 2:31 PM, Rafael J. Wysocki <rjw@sisk.pl> 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-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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);