[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240611004723.86031-1-kuniyu@amazon.com>
Date: Mon, 10 Jun 2024 17:47:23 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kent.overstreet@...ux.dev>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<kuni1840@...il.com>, <kuniyu@...zon.com>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>
Subject: Re: [PATCH v1 net-next 01/11] af_unix: Define locking order for unix_table_double_lock().
From: Kent Overstreet <kent.overstreet@...ux.dev>
Date: Mon, 10 Jun 2024 20:30:58 -0400
> On Mon, Jun 10, 2024 at 04:58:36PM -0700, Kuniyuki Iwashima wrote:
> > > No, we're defining an ordering, there's no need for an enum - this
> > > should work exactly the same as a comparison function that you pass to
> > > sort().
> > >
> > > Comparison functions are no place to get fancy, they should be as
> > > standard as possible: you can get _crazy_ bugs resulting from buggy
> > > comparison functions that don't actually define a total ordering.
> >
> > What should it return if we cannot define the total ordering like
> > when we only define the allowed list of ordering ?
> >
> > See patch 8, the rule there is
> >
> > if the nested order is listening socket -> child socket, then ok,
> > and otherwise, not.
> >
> > So we don't know the clear ordering, equal or greater, but we know
> > it's actually illegal.
> >
> > https://lore.kernel.org/netdev/20240610223501.73191-9-kuniyu@amazon.com/
>
> Ok yeah, that's a tricky one, and it does come up elsewhere.
Actually patch 3 & 4 is another example where we cannot define
the ordering, and only one necessary rule out of three is defined.
> I think we
> can allow comparison functions to return "undefined", and define 0 ==
> undefined for lockdep.
I agree.
>
> The important thing I want to maintain is that comparison functions be
> symmetric.
Ok, I'll use ((a > b) - (b < a)) for patch 1 & 2 where the odering
can be well defined as numeric ascending order.
Thanks!
Powered by blists - more mailing lists