linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: Converting dev->mutex into dev->spinlock ?
       [not found]     ` <Y958hOvtqq7Uiu0G@rowland.harvard.edu>
@ 2023-02-05  0:21       ` Hillf Danton
  0 siblings, 0 replies; 6+ messages in thread
From: Hillf Danton @ 2023-02-05  0:21 UTC (permalink / raw)
  To: Alan Stern
  Cc: Tetsuo Handa, Greg Kroah-Hartman, Rafael J. Wysocki,
	Linus Torvalds, LKML, linux-mm, USB list

On Sat, 4 Feb 2023 10:40:52 -0500 Alan Stern <stern@rowland.harvard.edu>
> On Sun, Feb 05, 2023 at 12:30:07AM +0900, Tetsuo Handa wrote:
> > 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.
> 
> Maybe so.  But the place to address it is inside lockdep, not in the 
> driver core.
> 
> > >> (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".
> 
> That cannot be done.  The only possible solution is to teach lockdep how 
> to handle recursive locking structures.

It works in dcache - see the slow path in dentry_kill() for instance.

Hillf


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Converting dev->mutex into dev->spinlock ?
       [not found]                 ` <Y9/dTp/hQ5btWTEH@rowland.harvard.edu>
@ 2023-02-06  2:56                   ` Hillf Danton
  2023-02-06  4:44                     ` Matthew Wilcox
  2023-02-06  5:17                     ` Greg Kroah-Hartman
  0 siblings, 2 replies; 6+ messages in thread
From: Hillf Danton @ 2023-02-06  2:56 UTC (permalink / raw)
  To: Alan Stern
  Cc: Tetsuo Handa, Greg Kroah-Hartman, Rafael J. Wysocki, linux-mm,
	LKML, USB list, Hillf Danton, Linus Torvalds

On Sun, 5 Feb 2023 11:46:06 -0500 Alan Stern <stern@rowland.harvard.edu>
> 
> And by the way, by disabling lockdep validation I am declaraing that 
> enabling it would cause an overwhelming number of false positives, 

Could you share 5 false positives you see upstream to help understand how
it is useless?

Hillf

> rendering lockdep useless (as you found out when you tried).  Not that 
> driver developers don't have to worry about dev->mutex.
> 
> Alan Stern


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Converting dev->mutex into dev->spinlock ?
  2023-02-06  2:56                   ` Hillf Danton
@ 2023-02-06  4:44                     ` Matthew Wilcox
  2023-02-06  5:17                     ` Greg Kroah-Hartman
  1 sibling, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2023-02-06  4:44 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Alan Stern, Tetsuo Handa, Greg Kroah-Hartman, Rafael J. Wysocki,
	linux-mm, LKML, USB list, Linus Torvalds

On Mon, Feb 06, 2023 at 10:56:29AM +0800, Hillf Danton wrote:
> On Sun, 5 Feb 2023 11:46:06 -0500 Alan Stern <stern@rowland.harvard.edu>
> > 
> > And by the way, by disabling lockdep validation I am declaraing that 
> > enabling it would cause an overwhelming number of false positives, 
> 
> Could you share 5 false positives you see upstream to help understand how
> it is useless?

I've asked you before to stop cc'ing linux-mm on things which aren't
about memory management.  Now I'm asking you publically.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Converting dev->mutex into dev->spinlock ?
  2023-02-06  2:56                   ` Hillf Danton
  2023-02-06  4:44                     ` Matthew Wilcox
@ 2023-02-06  5:17                     ` Greg Kroah-Hartman
  2023-02-06  6:43                       ` Hillf Danton
  1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-02-06  5:17 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Alan Stern, Tetsuo Handa, Rafael J. Wysocki, linux-mm, LKML,
	USB list, Linus Torvalds

On Mon, Feb 06, 2023 at 10:56:29AM +0800, Hillf Danton wrote:
> On Sun, 5 Feb 2023 11:46:06 -0500 Alan Stern <stern@rowland.harvard.edu>
> > 
> > And by the way, by disabling lockdep validation I am declaraing that 
> > enabling it would cause an overwhelming number of false positives, 
> 
> Could you share 5 false positives you see upstream to help understand how
> it is useless?

Please see this other email in this thread:
	https://lore.kernel.org/r/Y98FLlr7jkiFlV0k@rowland.harvard.edu


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Converting dev->mutex into dev->spinlock ?
  2023-02-06  5:17                     ` Greg Kroah-Hartman
@ 2023-02-06  6:43                       ` Hillf Danton
  2023-02-06  6:48                         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2023-02-06  6:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Stern, Tetsuo Handa, Rafael J. Wysocki, linux-mm, LKML,
	USB list, Linus Torvalds

On Mon, 6 Feb 2023 06:17:03 +0100 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> On Mon, Feb 06, 2023 at 10:56:29AM +0800, Hillf Danton wrote:
> > On Sun, 5 Feb 2023 11:46:06 -0500 Alan Stern <stern@rowland.harvard.edu>
> > > 
> > > And by the way, by disabling lockdep validation I am declaraing that 
> > > enabling it would cause an overwhelming number of false positives, 
> > 
> > Could you share 5 false positives you see upstream to help understand how
> > it is useless?
> 
> Please see this other email in this thread:
> 	https://lore.kernel.org/r/Y98FLlr7jkiFlV0k@rowland.harvard.edu

What lockdep warnings?  Specific examples, please.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Converting dev->mutex into dev->spinlock ?
  2023-02-06  6:43                       ` Hillf Danton
@ 2023-02-06  6:48                         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-02-06  6:48 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Alan Stern, Tetsuo Handa, Rafael J. Wysocki, linux-mm, LKML,
	USB list, Linus Torvalds

On Mon, Feb 06, 2023 at 02:43:05PM +0800, Hillf Danton wrote:
> On Mon, 6 Feb 2023 06:17:03 +0100 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > On Mon, Feb 06, 2023 at 10:56:29AM +0800, Hillf Danton wrote:
> > > On Sun, 5 Feb 2023 11:46:06 -0500 Alan Stern <stern@rowland.harvard.edu>
> > > > 
> > > > And by the way, by disabling lockdep validation I am declaraing that 
> > > > enabling it would cause an overwhelming number of false positives, 
> > > 
> > > Could you share 5 false positives you see upstream to help understand how
> > > it is useless?
> > 
> > Please see this other email in this thread:
> > 	https://lore.kernel.org/r/Y98FLlr7jkiFlV0k@rowland.harvard.edu
> 
> What lockdep warnings?  Specific examples, please.

Remove the one line of code, as per the patch in this thread, and boot
with lockdep enabled and see what happens if you wish to see them
yourself.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-06  6:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <28a82f50-39d5-a45f-7c7a-57a66cec0741@I-love.SAKURA.ne.jp>
     [not found] ` <Y951z0Au9MlP1GxX@rowland.harvard.edu>
     [not found]   ` <e89ad942-cab6-fad1-1cc2-98885d829ea7@I-love.SAKURA.ne.jp>
     [not found]     ` <Y958hOvtqq7Uiu0G@rowland.harvard.edu>
2023-02-05  0:21       ` Converting dev->mutex into dev->spinlock ? Hillf Danton
     [not found] ` <Y95h7Vop9t5Li0HD@kroah.com>
     [not found]   ` <a236ab6b-d38c-3974-d4cb-5e92d0877abc@I-love.SAKURA.ne.jp>
     [not found]     ` <Y957GSFVAQz8v3Xo@rowland.harvard.edu>
     [not found]       ` <cf56ebc3-187a-6ee4-26bc-2d180272b5cf@I-love.SAKURA.ne.jp>
     [not found]         ` <Y96HiYcreb8jZIHi@rowland.harvard.edu>
     [not found]           ` <917e1e3b-094f-e594-c1a2-8b97fb5195fd@I-love.SAKURA.ne.jp>
     [not found]             ` <Y965qEg0Re2QoQ7Q@rowland.harvard.edu>
     [not found]               ` <c7fb01a9-3e12-77ed-5c4c-db7deb64dc73@I-love.SAKURA.ne.jp>
     [not found]                 ` <Y9/dTp/hQ5btWTEH@rowland.harvard.edu>
2023-02-06  2:56                   ` Hillf Danton
2023-02-06  4:44                     ` Matthew Wilcox
2023-02-06  5:17                     ` Greg Kroah-Hartman
2023-02-06  6:43                       ` Hillf Danton
2023-02-06  6:48                         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox