Re: [PATCH] Fix deadlocks on dpm_sem

From: Patrick Mochel
Date: Thu Oct 28 2004 - 03:45:58 EST



On Fri, 22 Oct 2004, Paul Mackerras wrote:

> Currently the device_pm_foo() functions are rather prone to deadlocks
> during suspend/resume. This is because the dpm_sem is held for the
> duration of device_suspend() and device_resume() as well as
> device_pm_add() and device_pm_remove(). If for any reason you get a
> device addition or removal triggered by a device's suspend or resume
> code, you get a deadlock. (The classic example is a USB host adaptor
> resuming and discovering that the mouse you used to have plugged in
> has gone away.)
>
> This patch fixes the problem by using a separate semaphore, called
> dpm_list_sem, to cover the places where we need the device pm lists to
> be stable, and by being careful about how we traverse the lists on
> suspend and resume. I have analysed the various cases that can occur
> and I am confident that I have handled them all correctly. I posted
> this patch together with a detailed analysis 10 days ago.
>
> Andrew, could this go in -mm for testing please? Pat, any comments?

Sorry for the long delay in responding. I don't have a problem with it,
especially since it fixes a real problem. But, I wonder if there is a
better way to handle devices. The multiple lists themselves seem a little
wonky..

Thanks,


Pat

-
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/