[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ffbb0c8-c5d0-73b3-7a4e-2da9a7b03669@inria.fr>
Date: Mon, 6 Feb 2023 17:13:02 +0100 (CET)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Luis Chamberlain <mcgrof@...nel.org>,
Dan Carpenter <error27@...il.com>
cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Julia Lawall <julia.lawall@...ia.fr>,
Hongchen Zhang <zhanghongchen@...ngson.cn>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
"Christian Brauner (Microsoft)" <brauner@...nel.org>,
David Howells <dhowells@...hat.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
maobibo <maobibo@...ngson.cn>,
Matthew Wilcox <willy@...radead.org>,
Sedat Dilek <sedat.dilek@...il.com>
Subject: Re: [PATCH v4] pipe: use __pipe_{lock,unlock} instead of spinlock
On Mon, 6 Feb 2023, Luis Chamberlain wrote:
> On Sat, Jan 28, 2023 at 11:33:08PM -0800, Linus Torvalds wrote:
> > On Sat, Jan 28, 2023 at 10:05 PM Hongchen Zhang
> > <zhanghongchen@...ngson.cn> wrote:
> > >
> > > Use spinlock in pipe_{read,write} cost too much time,IMO
> > > pipe->{head,tail} can be protected by __pipe_{lock,unlock}.
> > > On the other hand, we can use __pipe_{lock,unlock} to protect
> > > the pipe->{head,tail} in pipe_resize_ring and
> > > post_one_notification.
> >
> > No, we really can't.
> >
> > post_one_notification() is called under the RCU lock held, *and* with
> > a spinlock held.
> >
> > It simply cannot do a sleeping lock like __pipe_lock().
> >
> > So that patch is simply fundamentally buggy, I'm afraid.
>
> This patch lingered for a while until *way* later *Al Viro* and then
> Linus chimed in on this. Ie, the issue for rejecting the patch wasn't so
> obvious it seems.
>
> As for Linus' point about us needing to avoid sleep under RCU +
> spinlock, curious if we can capture *existing* bad users of that with
> Coccinelle SmPL.
An analysis with Coccinelle may be highly prone to false positives if the
issue is very interprocedural. Maybe smatch would be better suited for
this?
julia
Powered by blists - more mailing lists