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:   Mon, 16 Nov 2020 08:55:56 -0500
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Björn Töpel <bjorn.topel@...el.com>
Cc:     Björn Töpel <bjorn.topel@...il.com>,
        netdev@...r.kernel.org, bpf@...r.kernel.org,
        magnus.karlsson@...el.com, ast@...nel.org, daniel@...earbox.net,
        maciej.fijalkowski@...el.com, sridhar.samudrala@...el.com,
        jesse.brandeburg@...el.com, qi.z.zhang@...el.com, kuba@...nel.org,
        edumazet@...gle.com, jonathan.lemon@...il.com, maximmi@...dia.com,
        intel-wired-lan@...ts.osuosl.org, netanel@...zon.com,
        akiyano@...zon.com, michael.chan@...adcom.com,
        sgoutham@...vell.com, ioana.ciornei@....com,
        ruxandra.radulescu@....com, thomas.petazzoni@...tlin.com,
        mcroce@...rosoft.com, saeedm@...dia.com, tariqt@...dia.com,
        aelior@...vell.com, ecree@...arflare.com,
        ilias.apalodimas@...aro.org, grygorii.strashko@...com,
        sthemmin@...rosoft.com, kda@...ux-powerpc.org
Subject: Re: [PATCH bpf-next v2 06/10] xsk: propagate napi_id to XDP socket
 Rx path

On Mon, Nov 16, 2020 at 02:24:56PM +0100, Björn Töpel wrote:
> On 2020-11-16 13:42, Michael S. Tsirkin wrote:
> > On Mon, Nov 16, 2020 at 01:01:40PM +0100, Björn Töpel wrote:
> > > 
> > > On 2020-11-16 12:55, Michael S. Tsirkin wrote:
> > > > On Mon, Nov 16, 2020 at 12:04:12PM +0100, BjÃf¶rn TÃf¶pel wrote:
> > > > > From: BjÃf¶rn TÃf¶pel <bjorn.topel@...el.com>
> > > > > 
> > > > > Add napi_id to the xdp_rxq_info structure, and make sure the XDP
> > > > > socket pick up the napi_id in the Rx path. The napi_id is used to find
> > > > > the corresponding NAPI structure for socket busy polling.
> > > > > 
> > > > > Acked-by: Ilias Apalodimas <ilias.apalodimas@...aro.org>
> > > > > Signed-off-by: BjÃf¶rn TÃf¶pel <bjorn.topel@...el.com>
> > > > 
> > > > A bunch of drivers just pass in 0. could you explain when
> > > > is that ok? how bad is it if the wrong id is used?
> > > > 
> > > 
> > > If zero is passed, which is a non-valid NAPI_ID, busy-polling will never
> > > be performed.
> > > 
> > > Depending on the structure of the driver, napi might or might not be
> > > initialized (napi_id != 0) or even available. When it wasn't obvious, I
> > > simply set it to zero.
> > > 
> > > So, short; No harm if zero, but busy-polling cannot be used in an XDP
> > > context.
> > > 
> > > 
> > > [...]
> > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > > > > index 21b71148c532..d71fe41595b7 100644
> > > > > --- a/drivers/net/virtio_net.c
> > > > > +++ b/drivers/net/virtio_net.c
> > > > > @@ -1485,7 +1485,7 @@ static int virtnet_open(struct net_device *dev)
> > > > >    			if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
> > > > >    				schedule_delayed_work(&vi->refill, 0);
> > > > > -		err = xdp_rxq_info_reg(&vi->rq[i].xdp_rxq, dev, i);
> > > > > +		err = xdp_rxq_info_reg(&vi->rq[i].xdp_rxq, dev, i, 0);
> > > > >    		if (err < 0)
> > > > >    			return err;
> > > > 
> > > > Should this be rq.napi.napi_id ?
> > > > 
> > > 
> > > Yes, if rq.napi.napi_id is valid here! Is it?
> > 
> > What initializes it? netif_napi_add? Then I think yes, it's
> > initialized for all queues ...
> > Needs to be tested naturally.
> > 
> 
> Yeah, netid_napi_add does the id generation.
> 
> My idea was that driver would gradually move to a correct NAPI id (given
> that it's hard to test w/o HW. Virtio however is simpler to test. :-)
> 
> 
> Björn

tun too ;)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ