Re: [PATCH] driver model/scsi: synchronize pm calls with probe/remove

From: Tejun Heo
Date: Tue Mar 22 2005 - 00:06:16 EST


Hi, Dmitry.

Dmitry Torokhov wrote:
On Mon, 21 Mar 2005 18:18:46 +0900, Tejun Heo <htejun@xxxxxxxxx> wrote:

Hello, Dmitry, Mochel and James.

I've been looking at sd code and found seemingly bogus 'if (!sdkp)'
tests with /* this can happen */ comment. I've digged changelog and
found out that this was to prevent oops which occurs if some driver
gets stuck inside ->probe and the machine goes down and calls back
->remove. IMHO, we should avoid this problem by fixing driver ->probe
or ->remove callbacks instead of detecting and bypassing
half-initialized/destroyed devices in pm callbacks.

This patch read-locks a device's bus using device_pm_down_read_bus()
before invoking any pm callback.


Hi Tejun,

There are talks about getting rid of bus's rwsem and replacing it with
a per-device semaphore to serialize probe, remove, suspend and resume.
This should resolve entire host of problems including this one, if I
unrerstand it correctly.

Please take a look here:
http://seclists.org/lists/linux-kernel/2005/Mar/5847.html


Yeap, sounds great. Hmmm.. as the final result will (and should) be the same for inidividual drivers (no overlapping callback invocations), how about incorporating my patch before implementing the proposed fix such that we can get rid of the awkward semantic first? The proposed change should change the same part of code anyway, so I don't think this would be a hassle.

Thanks.

--
tejun

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/