[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz3XqUOmrUhP0i5GZmYhvDHMB6vd6f68zqN1WcLqSiUcJg@mail.gmail.com>
Date: Mon, 20 Mar 2023 16:04:00 +0100
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Nuno Gonçalves <nunog@...4.com>,
Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Christian Brauner <brauner@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next] xsk: allow remap of fill and/or completion rings
On Mon, 20 Mar 2023 at 14:45, Magnus Karlsson <magnus.karlsson@...il.com> wrote:
>
> On Mon, 20 Mar 2023 at 14:41, Leon Romanovsky <leon@...nel.org> wrote:
> >
> > On Mon, Mar 20, 2023 at 01:27:18PM +0100, Magnus Karlsson wrote:
> > > On Mon, 20 Mar 2023 at 12:09, Leon Romanovsky <leon@...nel.org> wrote:
> > > >
> > > > On Mon, Mar 20, 2023 at 10:53:23AM +0000, Nuno Gonçalves wrote:
> > > > > The remap of fill and completion rings was frowned upon as they
> > > > > control the usage of UMEM which does not support concurrent use.
> > > > > At the same time this would disallow the remap of this rings
these rings
> > > > > into another process.
> > > > >
> > > > > A possible use case is that the user wants to transfer the socket/
> > > > > UMEM ownerwhip to another process (via SYS_pidfd_getfd) and so
> > >
> > > nit: ownership
> > >
> > > > > would need to also remap this rings.
these rings
> > > > >
> > > > > This will have no impact on current usages and just relaxes the
> > > > > remap limitation.
> > > > >
> > > > > Signed-off-by: Nuno Gonçalves <nunog@...4.com>
> > > > > ---
> > > > > net/xdp/xsk.c | 9 ++++++---
> > > > > 1 file changed, 6 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> > > > > index 2ac58b282b5eb..2af4ff64b22bd 100644
> > > > > --- a/net/xdp/xsk.c
> > > > > +++ b/net/xdp/xsk.c
> > > > > @@ -1300,10 +1300,11 @@ static int xsk_mmap(struct file *file, struct socket *sock,
> > > > > {
> > > > > loff_t offset = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
> > > > > unsigned long size = vma->vm_end - vma->vm_start;
> > > > > + int state = READ_ONCE(xs->state);
> > >
> > > Reverse Christmas Tree notation here please. Move it one line down to
> > > after the *xs declaration.
> > >
> > > > > struct xdp_sock *xs = xdp_sk(sock->sk);
> > > > > struct xsk_queue *q = NULL;
> > > > >
> > > > > - if (READ_ONCE(xs->state) != XSK_READY)
> > > > > + if (!(state == XSK_READY || state == XSK_BOUND))
> > > >
> > > > This if(..) is actually:
> > > > if (state != XSK_READY && state != XSK_BOUND)
> > >
> > > Nuno had it like that to start with when he sent the patch privately
> > > to me, but I responded that I prefered the current one. It is easier
> > > to understand if read out aloud IMO.
> >
> > "Not equal" is much easier to understand than "not" of whole expression.
>
> Then my brain is wired differently ;-).
Nuno, please prepare a v2 by fixing the now four things above and
reverting this if-expression to what you had before. It is two against
one, so I yield. After that, it is good to go from my point of view.
Thanks!
> > > Do not have any strong feelings either way since the statements are equivalent.
> > >
> > > > Thanks
Powered by blists - more mailing lists