From: Jiri Pirko <jiri@resnulli.us>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, jasowang@redhat.com,
xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, dave.taht@gmail.com,
kerneljasonxing@gmail.com, hengqi@linux.alibaba.com
Subject: Re: [PATCH net-next v3] virtio_net: add support for Byte Queue Limits
Date: Wed, 14 Aug 2024 14:16:19 +0200 [thread overview]
Message-ID: <ZrygE7SjwPpdWM5G@nanopsycho.orion> (raw)
In-Reply-To: <20240814053637-mutt-send-email-mst@kernel.org>
Wed, Aug 14, 2024 at 11:43:51AM CEST, mst@redhat.com wrote:
>On Wed, Aug 14, 2024 at 10:17:15AM +0200, Jiri Pirko wrote:
>> >diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> >index 3f10c72743e9..c6af18948092 100644
>> >--- a/drivers/net/virtio_net.c
>> >+++ b/drivers/net/virtio_net.c
>> >@@ -2867,8 +2867,8 @@ static int virtnet_enable_queue_pair(struct virtnet_info *vi, int qp_index)
>> > if (err < 0)
>> > goto err_xdp_reg_mem_model;
>> >
>> >- virtnet_napi_enable(vi->rq[qp_index].vq, &vi->rq[qp_index].napi);
>> > netdev_tx_reset_queue(netdev_get_tx_queue(vi->dev, qp_index));
>> >+ virtnet_napi_enable(vi->rq[qp_index].vq, &vi->rq[qp_index].napi);
>> > virtnet_napi_tx_enable(vi, vi->sq[qp_index].vq, &vi->sq[qp_index].napi);
>>
>> Hmm, I have to look at this a bit more. I think this might be accidental
>> fix. The thing is, napi can be triggered even if it is disabled:
>>
>> ->__local_bh_enable_ip()
>> -> net_rx_action()
>> -> __napi_poll()
>>
>> Here __napi_poll() calls napi_is_scheduled() and calls virtnet_poll_tx()
>> in case napi is scheduled. napi_is_scheduled() checks NAPI_STATE_SCHED
>> bit in napi state.
>>
>> However, this bit is set previously by netif_napi_add_weight().
>
>It's actually set in napi_disable too, isn't it?
Yes, in both.
I actually find exactly what's the issue.
After virtnet_napi_enable() is called, the following path is hit
__napi_poll()
-> virtnet_poll()
-> virtnet_poll_cleantx()
-> netif_tx_wake_queue()
That wakes the TX queue and allows skbs to be submitted and accounted by
BQL counters.
Then netdev_tx_reset_queue() is called that resets BQL counters and
eventually leads to the BUG in dql_completed().
That's why virtnet_napi_tx_enable() move helped. Will submit.
>
>>
>> >
>> > > ...
>> >
>> >Best regards
>> >--
>> >Marek Szyprowski, PhD
>> >Samsung R&D Institute Poland
>> >
>>
>>
>> >
>> > return 0;
>> >
>> >
>> >Will submit the patch in a jiff. Thanks!
>> >
>> >
>> >
>> >>
>> >>Best regards
>> >>--
>> >>Marek Szyprowski, PhD
>> >>Samsung R&D Institute Poland
>> >>
>
next prev parent reply other threads:[~2024-08-14 12:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240812145727eucas1p22360b410908e41aeafa7c9f09d52ca14@eucas1p2.samsung.com>
2024-06-18 14:44 ` [PATCH net-next v3] virtio_net: add support for Byte Queue Limits Jiri Pirko
2024-06-18 18:18 ` Michael S. Tsirkin
2024-06-19 5:45 ` Jiri Pirko
2024-06-19 7:26 ` Michael S. Tsirkin
2024-06-19 8:05 ` Jiri Pirko
2024-06-19 8:17 ` Michael S. Tsirkin
2024-06-19 8:23 ` Michael S. Tsirkin
2024-06-19 10:09 ` Jiri Pirko
2024-06-20 7:43 ` Michael S. Tsirkin
2024-06-20 0:40 ` patchwork-bot+netdevbpf
2024-08-12 14:57 ` Marek Szyprowski
2024-08-12 16:47 ` Jiri Pirko
2024-08-12 16:55 ` Marek Szyprowski
2024-08-14 7:49 ` Jiri Pirko
2024-08-14 8:17 ` Jiri Pirko
2024-08-14 9:43 ` Michael S. Tsirkin
2024-08-14 12:16 ` Jiri Pirko [this message]
2024-08-14 9:17 ` Marek Szyprowski
2024-08-14 12:16 ` Jiri Pirko
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=ZrygE7SjwPpdWM5G@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.taht@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hengqi@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).