2012-05-02 06:42:25

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 04/19] PCI: serialize hotplug operations triggered by PCI hotplug sysfs interfaces

On Fri, Apr 27, 2012 at 11:16:45PM +0800, Jiang Liu wrote:
> + /* Avoid deadlock with pci_hp_deregister() */
> + while (!pci_hotplug_try_enter()) {
> + /* Check whether the slot has been deregistered. */
> + if (list_empty(&slot->slot_list)) {
> + retval = -ENODEV;
> + goto exit_put;
> + }
> + msleep(1);
> + }

Oh my.

Wow.

{sigh}

ick.

My eyes hurt.

And your cpu load just went crazy.

You can now handle all of the nasty emails from sysadmins asking why
their systems look like their load is high for no good reason.

Not to mention all of the other issues here.

My statement about not inventing new lock types has now been proven
true.

The fact that this would even be a chunk of code that was proposed to be
merged makes me weep.

You owe me a bottle of whatever you are drinking if you expect me to
continue to review these patch submissions.

I'm stopping here in the series, please rework this whole thing in a
major way.

greg k-h


2012-05-02 07:22:40

by Jiang Liu (Gerry)

[permalink] [raw]
Subject: Re: [PATCH v2 04/19] PCI: serialize hotplug operations triggered by PCI hotplug sysfs interfaces

On 2012-5-2 13:06, Greg KH wrote:
> On Fri, Apr 27, 2012 at 11:16:45PM +0800, Jiang Liu wrote:
>> + /* Avoid deadlock with pci_hp_deregister() */
>> + while (!pci_hotplug_try_enter()) {
>> + /* Check whether the slot has been deregistered. */
>> + if (list_empty(&slot->slot_list)) {
>> + retval = -ENODEV;
>> + goto exit_put;
>> + }
>> + msleep(1);
>> + }
>
> Oh my.
>
> Wow.
>
> {sigh}
>
> ick.
>
> My eyes hurt.
>
> And your cpu load just went crazy.
>
> You can now handle all of the nasty emails from sysadmins asking why
> their systems look like their load is high for no good reason.
My bad, should use schedule_timeout_interruptible() instead of
msleep(1) here to avoid busy waiting.

>
> Not to mention all of the other issues here.
>
> My statement about not inventing new lock types has now been proven
> true.
>
> The fact that this would even be a chunk of code that was proposed to be
> merged makes me weep.
>
> You owe me a bottle of whatever you are drinking if you expect me to
> continue to review these patch submissions.
>
> I'm stopping here in the series, please rework this whole thing in a
> major way.
>
> greg k-h
>
>

2012-05-02 21:48:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 04/19] PCI: serialize hotplug operations triggered by PCI hotplug sysfs interfaces

On Wed, May 02, 2012 at 03:20:15PM +0800, Jiang Liu wrote:
> On 2012-5-2 13:06, Greg KH wrote:
> >On Fri, Apr 27, 2012 at 11:16:45PM +0800, Jiang Liu wrote:
> >>+ /* Avoid deadlock with pci_hp_deregister() */
> >>+ while (!pci_hotplug_try_enter()) {
> >>+ /* Check whether the slot has been deregistered. */
> >>+ if (list_empty(&slot->slot_list)) {
> >>+ retval = -ENODEV;
> >>+ goto exit_put;
> >>+ }
> >>+ msleep(1);
> >>+ }
> >
> >Oh my.
> >
> >Wow.
> >
> >{sigh}
> >
> >ick.
> >
> >My eyes hurt.
> >
> >And your cpu load just went crazy.
> >
> >You can now handle all of the nasty emails from sysadmins asking why
> >their systems look like their load is high for no good reason.
> My bad, should use schedule_timeout_interruptible() instead of
> msleep(1) here to avoid busy waiting.

Um, no, that's not my main point here at all.

My main point is this type of loop is the wrong thing to do in the first
place.

Please redo this whole thing, as explained in my first email in this
thread.

greg k-h