lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Jun 2022 15:18:13 +0200
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc:     Björn Töpel <bjorn.topel@...il.com>,
        bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Netdev <netdev@...r.kernel.org>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>
Subject: Re: [PATCH bpf] xsk: mark napi_id on sendmsg()

On Wed, Jun 29, 2022 at 2:58 PM Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> On Wed, Jun 29, 2022 at 02:45:11PM +0200, Björn Töpel wrote:
> > On Wed, 29 Jun 2022 at 12:58, Maciej Fijalkowski
> > <maciej.fijalkowski@...el.com> wrote:
> > >
> > > When application runs in zero copy busy poll mode and does not receive a
> > > single packet but only sends them, it is currently impossible to get
> > > into napi_busy_loop() as napi_id is only marked on Rx side in
> > > xsk_rcv_check(). In there, napi_id is being taken from xdp_rxq_info
> > > carried by xdp_buff. From Tx perspective, we do not have access to it.
> > > What we have handy is the xsk pool.
> >
> > The fact that the napi_id is not set unless set from the ingress side
> > is actually "by design". It's CONFIG_NET_RX_BUSY_POLL after all. I
> > followed the semantics of the regular busy-polling sockets. So, I
> > wouldn't say it's a fix! The busy-polling in sendmsg is really just
> > about "driving the RX busy-polling from another socket syscall".
>
> I just felt that busy polling for txonly apps was broken, hence the
> 'fixing' flavour. I can send it just as improvement to bpf-next.
>
> >
> > That being said, I definitely see that this is useful for AF_XDP
> > sockets, but keep in mind that it sort of changes the behavior from
> > regular sockets. And we'll get different behavior for
> > copy-mode/zero-copy mode.
> >
> > TL;DR, I think it's a good addition. One small nit below:
> >
> > > +                       __sk_mark_napi_id_once(sk, xs->pool->heads[0].xdp.rxq->napi_id);
> >
> > Please hide this hideous pointer chasing in something neater:
> > xsk_pool_get_napi_id() or something.
>
> Would it make sense to introduce napi_id to xsk_buff_pool then?

Only if it has a positive performance impact. Let us not carry copies
of state otherwise. So please measure first and see if it makes any
difference. If not, I prefer the pointer chasing hidden behind an API
like Björn suggests.

> xp_set_rxq_info() could be setting it. We are sure that napi_id is the
> same for whole pool (each xdp_buff_xsk's rxq info).
>
> >
> >
> > Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ