From: "Michael S. Tsirkin" <mst@redhat.com> To: "Björn Töpel" <bjorn.topel@intel.com> Cc: "Björn Töpel" <bjorn.topel@gmail.com>, netdev@vger.kernel.org, bpf@vger.kernel.org, magnus.karlsson@intel.com, ast@kernel.org, daniel@iogearbox.net, maciej.fijalkowski@intel.com, sridhar.samudrala@intel.com, jesse.brandeburg@intel.com, qi.z.zhang@intel.com, kuba@kernel.org, edumazet@google.com, jonathan.lemon@gmail.com, maximmi@nvidia.com, intel-wired-lan@lists.osuosl.org, netanel@amazon.com, akiyano@amazon.com, michael.chan@broadcom.com, sgoutham@marvell.com, ioana.ciornei@nxp.com, ruxandra.radulescu@nxp.com, thomas.petazzoni@bootlin.com, mcroce@microsoft.com, saeedm@nvidia.com, tariqt@nvidia.com, aelior@marvell.com, ecree@solarflare.com, ilias.apalodimas@linaro.org, grygorii.strashko@ti.com, sthemmin@microsoft.com, kda@linux-powerpc.org Subject: Re: [PATCH bpf-next v2 06/10] xsk: propagate napi_id to XDP socket Rx path Date: Mon, 16 Nov 2020 07:42:34 -0500 [thread overview] Message-ID: <20201116073848-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <614a7ce4-2b6b-129b-de7d-71428f7a71f6@intel.com> 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örn Töpel wrote: > > > From: Björn Töpel <bjorn.topel@intel.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@linaro.org> > > > Signed-off-by: Björn Töpel <bjorn.topel@intel.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. > > Cheers, > Björn
WARNING: multiple messages have this Message-ID (diff)
From: Michael S. Tsirkin <mst@redhat.com> To: intel-wired-lan@osuosl.org Subject: [Intel-wired-lan] [PATCH bpf-next v2 06/10] xsk: propagate napi_id to XDP socket Rx path Date: Mon, 16 Nov 2020 07:42:34 -0500 [thread overview] Message-ID: <20201116073848-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <614a7ce4-2b6b-129b-de7d-71428f7a71f6@intel.com> 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????rn T????pel wrote: > > > From: Bj????rn T????pel <bjorn.topel@intel.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@linaro.org> > > > Signed-off-by: Bj????rn T????pel <bjorn.topel@intel.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. > > Cheers, > Bj??rn
next prev parent reply other threads:[~2020-11-16 12:42 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-16 11:04 [PATCH bpf-next v2 00/10] Introduce preferred busy-polling Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 01/10] net: introduce " Björn Töpel 2020-11-16 16:04 ` Jakub Kicinski 2020-11-16 16:19 ` Björn Töpel 2020-11-16 17:28 ` Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 02/10] net: add SO_BUSY_POLL_BUDGET socket option Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 03/10] xsk: add support for recvmsg() Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 04/10] xsk: check need wakeup flag in sendmsg() Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 05/10] xsk: add busy-poll support for {recv,send}msg() Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 06/10] xsk: propagate napi_id to XDP socket Rx path Björn Töpel 2020-11-16 11:04 ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= 2020-11-16 11:19 ` Tariq Toukan 2020-11-16 11:19 ` [Intel-wired-lan] " Tariq Toukan 2020-11-16 11:55 ` Michael S. Tsirkin 2020-11-16 11:55 ` [Intel-wired-lan] " Michael S. Tsirkin 2020-11-16 12:01 ` Björn Töpel 2020-11-16 12:01 ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= 2020-11-16 12:42 ` Michael S. Tsirkin [this message] 2020-11-16 12:42 ` Michael S. Tsirkin 2020-11-16 13:24 ` Björn Töpel 2020-11-16 13:24 ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= 2020-11-16 13:55 ` Michael S. Tsirkin 2020-11-16 13:55 ` [Intel-wired-lan] " Michael S. Tsirkin 2020-11-16 17:40 ` Björn Töpel 2020-11-16 17:40 ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= 2020-11-16 11:04 ` [PATCH bpf-next v2 07/10] samples/bpf: use recvfrom() in xdpsock/rxdrop Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 08/10] samples/bpf: use recvfrom() in xdpsock/l2fwd Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 09/10] samples/bpf: add busy-poll support to xdpsock Björn Töpel 2020-11-16 11:04 ` [PATCH bpf-next v2 10/10] samples/bpf: add option to set the busy-poll budget Björn Töpel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201116073848-mutt-send-email-mst@kernel.org \ --to=mst@redhat.com \ --cc=aelior@marvell.com \ --cc=akiyano@amazon.com \ --cc=ast@kernel.org \ --cc=bjorn.topel@gmail.com \ --cc=bjorn.topel@intel.com \ --cc=bpf@vger.kernel.org \ --cc=daniel@iogearbox.net \ --cc=ecree@solarflare.com \ --cc=edumazet@google.com \ --cc=grygorii.strashko@ti.com \ --cc=ilias.apalodimas@linaro.org \ --cc=intel-wired-lan@lists.osuosl.org \ --cc=ioana.ciornei@nxp.com \ --cc=jesse.brandeburg@intel.com \ --cc=jonathan.lemon@gmail.com \ --cc=kda@linux-powerpc.org \ --cc=kuba@kernel.org \ --cc=maciej.fijalkowski@intel.com \ --cc=magnus.karlsson@intel.com \ --cc=maximmi@nvidia.com \ --cc=mcroce@microsoft.com \ --cc=michael.chan@broadcom.com \ --cc=netanel@amazon.com \ --cc=netdev@vger.kernel.org \ --cc=qi.z.zhang@intel.com \ --cc=ruxandra.radulescu@nxp.com \ --cc=saeedm@nvidia.com \ --cc=sgoutham@marvell.com \ --cc=sridhar.samudrala@intel.com \ --cc=sthemmin@microsoft.com \ --cc=tariqt@nvidia.com \ --cc=thomas.petazzoni@bootlin.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.