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. >> >>> + } >>> + >>> + 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@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization