From: "Michael S. Tsirkin" <mst@redhat.com> To: John Fastabend <john.fastabend@gmail.com> Cc: Jason Wang <jasowang@redhat.com>, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] virito-net: set queues after reset during xdp_set Date: Mon, 20 Feb 2017 02:12:18 +0200 [thread overview] Message-ID: <20170220013627-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <58A787AB.6000201@gmail.com> On Fri, Feb 17, 2017 at 03:30:51PM -0800, John Fastabend wrote: > On 17-02-16 09:10 PM, Jason Wang wrote: > > > > > > On 2017年02月17日 12:53, John Fastabend wrote: > >> On 17-02-15 01:08 AM, Jason Wang wrote: > >>> We set queues before reset which will cause a crash[1]. This is > >>> because is_xdp_raw_buffer_queue() depends on the old xdp queue pairs > >>> number to do the correct detection. So fix this by: > >>> > >>> - set queues after reset, to keep the old vi->curr_queue_pairs. (in > >>> fact setting queues before reset does not works since after feature > >>> set, all queue pairs were enabled by default during reset). > >>> - change xdp_queue_pairs only after virtnet_reset() is succeed. > >>> > >>> [1] > >> I'm guessing this occurs when enabling XDP while receiving lots of traffic? > > > > I hit this then disabling XDP while receiving lots of traffic. > > > > [...] > > >>> + vi->xdp_queue_pairs = xdp_qp; > >> But xdp_queue_pairs is being used to detect if we should allocate the XDP > >> headroom. If we move it here do we have a set of buffers in the ring without > >> the proper headroom when we assign the xdp program below? > > > > Right, so how about passing xdp_queue_pairs as a parameter to virtnet_reset(). > > Then virtnet_reset() can set it after _remove_vq_common() but before > > virtnet_restore_up()? > > > > Thanks > > > > Sounds like a reasonable fix to me. I'm fine with that. > >> > >>> + } > >>> + > >>> + err = _virtnet_set_queues(vi, curr_qp + xdp_qp); > >>> + if (err) { > >>> + dev_warn(&dev->dev, "XDP Device queue allocation failure.\n"); > >>> + goto virtio_queue_err; > >>> } > >>> netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); > >>> @@ -1844,17 +1844,18 @@ static int virtnet_xdp_set(struct net_device *dev, > >>> struct bpf_prog *prog) > >>> return 0; > >> Thanks, > >> John > >> > >
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com> To: John Fastabend <john.fastabend@gmail.com> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH net-next] virito-net: set queues after reset during xdp_set Date: Mon, 20 Feb 2017 02:12:18 +0200 [thread overview] Message-ID: <20170220013627-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <58A787AB.6000201@gmail.com> On Fri, Feb 17, 2017 at 03:30:51PM -0800, John Fastabend wrote: > On 17-02-16 09:10 PM, Jason Wang wrote: > > > > > > On 2017年02月17日 12:53, John Fastabend wrote: > >> On 17-02-15 01:08 AM, Jason Wang wrote: > >>> We set queues before reset which will cause a crash[1]. This is > >>> because is_xdp_raw_buffer_queue() depends on the old xdp queue pairs > >>> number to do the correct detection. So fix this by: > >>> > >>> - set queues after reset, to keep the old vi->curr_queue_pairs. (in > >>> fact setting queues before reset does not works since after feature > >>> set, all queue pairs were enabled by default during reset). > >>> - change xdp_queue_pairs only after virtnet_reset() is succeed. > >>> > >>> [1] > >> I'm guessing this occurs when enabling XDP while receiving lots of traffic? > > > > I hit this then disabling XDP while receiving lots of traffic. > > > > [...] > > >>> + vi->xdp_queue_pairs = xdp_qp; > >> But xdp_queue_pairs is being used to detect if we should allocate the XDP > >> headroom. If we move it here do we have a set of buffers in the ring without > >> the proper headroom when we assign the xdp program below? > > > > Right, so how about passing xdp_queue_pairs as a parameter to virtnet_reset(). > > Then virtnet_reset() can set it after _remove_vq_common() but before > > virtnet_restore_up()? > > > > Thanks > > > > Sounds like a reasonable fix to me. I'm fine with that. > >> > >>> + } > >>> + > >>> + err = _virtnet_set_queues(vi, curr_qp + xdp_qp); > >>> + if (err) { > >>> + dev_warn(&dev->dev, "XDP Device queue allocation failure.\n"); > >>> + goto virtio_queue_err; > >>> } > >>> netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); > >>> @@ -1844,17 +1844,18 @@ static int virtnet_xdp_set(struct net_device *dev, > >>> struct bpf_prog *prog) > >>> return 0; > >> Thanks, > >> John > >> > > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2017-02-20 0:12 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-15 9:08 [PATCH net-next] virito-net: set queues after reset during xdp_set Jason Wang 2017-02-15 9:08 ` Jason Wang 2017-02-16 17:21 ` Michael S. Tsirkin 2017-02-16 17:21 ` Michael S. Tsirkin 2017-02-17 4:53 ` John Fastabend 2017-02-17 5:10 ` Jason Wang 2017-02-17 5:10 ` Jason Wang 2017-02-17 23:30 ` John Fastabend 2017-02-17 23:30 ` John Fastabend 2017-02-20 0:12 ` Michael S. Tsirkin [this message] 2017-02-20 0:12 ` Michael S. Tsirkin 2017-02-19 5:08 ` Michael S. Tsirkin 2017-02-19 5:08 ` Michael S. Tsirkin 2017-02-20 3:47 ` Jason Wang 2017-02-20 3:47 ` Jason Wang
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=20170220013627-mutt-send-email-mst@kernel.org \ --to=mst@redhat.com \ --cc=jasowang@redhat.com \ --cc=john.fastabend@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=virtualization@lists.linux-foundation.org \ /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.