[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e89ad942-cab6-fad1-1cc2-98885d829ea7@I-love.SAKURA.ne.jp>
Date: Sun, 5 Feb 2023 00:30:07 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>
Subject: Re: Converting dev->mutex into dev->spinlock ?
On 2023/02/05 0:12, Alan Stern wrote:
>> it would solve many deadlocks in driver code if you can update
>
> What deadlocks? If there are so many deadlocks floating around in
> driver code, why haven't we heard about them before now?
Since dev->mutex is hidden from lockdep checks, nobody can see lockdep warnings.
syzbot is reporting real deadlocks without lockdep warnings, for the fundamental
problem you mentioned in https://lkml.kernel.org/r/Pine.LNX.4.44L0.0804171117450.18040-100000@iolanthe.rowland.org
is remaining. I'm suggesting you that now is time to address this fundamental problem.
>> (by e.g. replacing dev->mutex with dev->spinlock and dev->atomic_flags).
>> But I'm not familiar enough to propose such change...
>
> Such a change cannot be made. Consider this: Driver callbacks often
> need to sleep. But when a thread holds a spinlock, it is not allowed to
> sleep. Therefore driver callbacks must not be invoked while a spinlock
> is held.
What I'm suggesting is "Do not call driver callbacks with dev->mutex held,
by rewriting driver core code".
Powered by blists - more mailing lists