All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jason Wang <jasowang@redhat.com>,
	mst@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: Fri, 17 Feb 2017 15:30:51 -0800	[thread overview]
Message-ID: <58A787AB.6000201@gmail.com> (raw)
In-Reply-To: <cff818ec-d5cc-1d71-fa3e-95fd690d10ff@redhat.com>

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
>>
> 

WARNING: multiple messages have this Message-ID (diff)
From: John Fastabend <john.fastabend@gmail.com>
To: Jason Wang <jasowang@redhat.com>,
	mst@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: Fri, 17 Feb 2017 15:30:51 -0800	[thread overview]
Message-ID: <58A787AB.6000201@gmail.com> (raw)
In-Reply-To: <cff818ec-d5cc-1d71-fa3e-95fd690d10ff@redhat.com>

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@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2017-02-17 23:31 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 [this message]
2017-02-17 23:30       ` John Fastabend
2017-02-20  0:12       ` Michael S. Tsirkin
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=58A787AB.6000201@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --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: link
Be 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.