* [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
@ 2022-08-11 8:02 Xuan Zhuo
2022-08-11 8:02 ` [PATCH 1/2] virtio_net: fix for stuck when change rx " Xuan Zhuo
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Xuan Zhuo @ 2022-08-11 8:02 UTC (permalink / raw
To: virtualization
Cc: Michael S. Tsirkin, Jason Wang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev
When dev is set to DOWN state, napi has been disabled, if we modify the
ring size at this time, we should not call napi_disable() again, which
will cause stuck.
And all operations are under the protection of rtnl_lock, so there is no
need to consider concurrency issues.
PS.
Hi Michael, I don't know which way is more convenient for you, so I split the
commit into two commits, so you can fixup to my previous commit:
virtio_net: support tx queue resize
virtio_net: support rx queue resize
Xuan Zhuo (2):
virtio_net: fix for stuck when change rx ring size with dev down
virtio_net: fix for stuck when change tx ring size with dev down
drivers/net/virtio_net.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
--
2.31.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] virtio_net: fix for stuck when change rx ring size with dev down
2022-08-11 8:02 [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down Xuan Zhuo
@ 2022-08-11 8:02 ` Xuan Zhuo
2022-08-11 8:02 ` [PATCH 2/2] virtio_net: fix for stuck when change tx " Xuan Zhuo
2022-08-11 8:11 ` [PATCH vhost 0/2] virtio_net: fix for stuck when change " Michael S. Tsirkin
2 siblings, 0 replies; 8+ messages in thread
From: Xuan Zhuo @ 2022-08-11 8:02 UTC (permalink / raw
To: virtualization
Cc: Michael S. Tsirkin, Jason Wang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, Kangjie Xu
When dev is set to DOWN state, napi has been disabled, if we modify the
ring size at this time, we should not call napi_disable() again, which
will cause stuck.
And all operations are under the protection of rtnl_lock, so there is no
need to consider concurrency issues.
Reported-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
drivers/net/virtio_net.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 816c613c22f7..17687eb3f0bd 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1892,11 +1892,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
static int virtnet_rx_resize(struct virtnet_info *vi,
struct receive_queue *rq, u32 ring_num)
{
+ bool running = netif_running(vi->dev);
int err, qindex;
qindex = rq - vi->rq;
- napi_disable(&rq->napi);
+ if (running)
+ napi_disable(&rq->napi);
err = virtqueue_resize(rq->vq, ring_num, virtnet_rq_free_unused_buf);
if (err)
@@ -1905,7 +1907,8 @@ static int virtnet_rx_resize(struct virtnet_info *vi,
if (!try_fill_recv(vi, rq, GFP_KERNEL))
schedule_delayed_work(&vi->refill, 0);
- virtnet_napi_enable(rq->vq, &rq->napi);
+ if (running)
+ virtnet_napi_enable(rq->vq, &rq->napi);
return err;
}
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] virtio_net: fix for stuck when change tx ring size with dev down
2022-08-11 8:02 [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down Xuan Zhuo
2022-08-11 8:02 ` [PATCH 1/2] virtio_net: fix for stuck when change rx " Xuan Zhuo
@ 2022-08-11 8:02 ` Xuan Zhuo
2022-08-11 8:11 ` [PATCH vhost 0/2] virtio_net: fix for stuck when change " Michael S. Tsirkin
2 siblings, 0 replies; 8+ messages in thread
From: Xuan Zhuo @ 2022-08-11 8:02 UTC (permalink / raw
To: virtualization
Cc: Michael S. Tsirkin, Jason Wang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, Kangjie Xu
When dev is set to DOWN state, napi has been disabled, if we modify the
ring size at this time, we should not call napi_disable() again, which
will cause stuck.
And all operations are under the protection of rtnl_lock, so there is no
need to consider concurrency issues.
Reported-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
drivers/net/virtio_net.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 17687eb3f0bd..d9c434b00e9b 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1915,12 +1915,14 @@ static int virtnet_rx_resize(struct virtnet_info *vi,
static int virtnet_tx_resize(struct virtnet_info *vi,
struct send_queue *sq, u32 ring_num)
{
+ bool running = netif_running(vi->dev);
struct netdev_queue *txq;
int err, qindex;
qindex = sq - vi->sq;
- virtnet_napi_tx_disable(&sq->napi);
+ if (running)
+ virtnet_napi_tx_disable(&sq->napi);
txq = netdev_get_tx_queue(vi->dev, qindex);
@@ -1946,7 +1948,8 @@ static int virtnet_tx_resize(struct virtnet_info *vi,
netif_tx_wake_queue(txq);
__netif_tx_unlock_bh(txq);
- virtnet_napi_tx_enable(vi, sq->vq, &sq->napi);
+ if (running)
+ virtnet_napi_tx_enable(vi, sq->vq, &sq->napi);
return err;
}
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
2022-08-11 8:02 [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down Xuan Zhuo
2022-08-11 8:02 ` [PATCH 1/2] virtio_net: fix for stuck when change rx " Xuan Zhuo
2022-08-11 8:02 ` [PATCH 2/2] virtio_net: fix for stuck when change tx " Xuan Zhuo
@ 2022-08-11 8:11 ` Michael S. Tsirkin
2022-08-11 8:12 ` Xuan Zhuo
2022-08-11 17:37 ` Jakub Kicinski
2 siblings, 2 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2022-08-11 8:11 UTC (permalink / raw
To: Xuan Zhuo
Cc: virtualization, Jason Wang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev
On Thu, Aug 11, 2022 at 04:02:56PM +0800, Xuan Zhuo wrote:
> When dev is set to DOWN state, napi has been disabled, if we modify the
> ring size at this time, we should not call napi_disable() again, which
> will cause stuck.
>
> And all operations are under the protection of rtnl_lock, so there is no
> need to consider concurrency issues.
>
> PS.
> Hi Michael, I don't know which way is more convenient for you, so I split the
> commit into two commits, so you can fixup to my previous commit:
>
> virtio_net: support tx queue resize
> virtio_net: support rx queue resize
>
> Xuan Zhuo (2):
> virtio_net: fix for stuck when change rx ring size with dev down
> virtio_net: fix for stuck when change tx ring size with dev down
>
> drivers/net/virtio_net.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Which patches does this fix?
Maybe I should squash.
> --
> 2.31.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
2022-08-11 8:11 ` [PATCH vhost 0/2] virtio_net: fix for stuck when change " Michael S. Tsirkin
@ 2022-08-11 8:12 ` Xuan Zhuo
2022-08-11 17:37 ` Jakub Kicinski
1 sibling, 0 replies; 8+ messages in thread
From: Xuan Zhuo @ 2022-08-11 8:12 UTC (permalink / raw
To: Michael S. Tsirkin
Cc: virtualization, Jason Wang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev
On Thu, 11 Aug 2022 04:11:22 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Thu, Aug 11, 2022 at 04:02:56PM +0800, Xuan Zhuo wrote:
> > When dev is set to DOWN state, napi has been disabled, if we modify the
> > ring size at this time, we should not call napi_disable() again, which
> > will cause stuck.
> >
> > And all operations are under the protection of rtnl_lock, so there is no
> > need to consider concurrency issues.
> >
> > PS.
> > Hi Michael, I don't know which way is more convenient for you, so I split the
> > commit into two commits, so you can fixup to my previous commit:
> >
> > virtio_net: support tx queue resize
> > virtio_net: support rx queue resize
> >
> > Xuan Zhuo (2):
> > virtio_net: fix for stuck when change rx ring size with dev down
> > virtio_net: fix for stuck when change tx ring size with dev down
> >
> > drivers/net/virtio_net.c | 14 ++++++++++----
> > 1 file changed, 10 insertions(+), 4 deletions(-)
>
>
> Which patches does this fix?
> Maybe I should squash.
These two:
virtio_net: support tx queue resize
virtio_net: support rx queue resize
Thanks.
>
> > --
> > 2.31.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
2022-08-11 8:11 ` [PATCH vhost 0/2] virtio_net: fix for stuck when change " Michael S. Tsirkin
2022-08-11 8:12 ` Xuan Zhuo
@ 2022-08-11 17:37 ` Jakub Kicinski
2022-08-12 1:30 ` Xuan Zhuo
1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2022-08-11 17:37 UTC (permalink / raw
To: Michael S. Tsirkin
Cc: Xuan Zhuo, virtualization, Jason Wang, David S. Miller,
Eric Dumazet, Paolo Abeni, netdev
On Thu, 11 Aug 2022 04:11:22 -0400 Michael S. Tsirkin wrote:
> Which patches does this fix?
> Maybe I should squash.
Side question to make sure I understand the terminology - this
is *not* a vhost patch, right? vhost is the host side of virtio?
Is the work going via the vhost tree because of some dependencies?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
2022-08-11 17:37 ` Jakub Kicinski
@ 2022-08-12 1:30 ` Xuan Zhuo
2022-08-12 19:47 ` Jakub Kicinski
0 siblings, 1 reply; 8+ messages in thread
From: Xuan Zhuo @ 2022-08-12 1:30 UTC (permalink / raw
To: Jakub Kicinski
Cc: virtualization, Jason Wang, David S. Miller, Eric Dumazet,
Paolo Abeni, netdev, Michael S. Tsirkin
On Thu, 11 Aug 2022 10:37:30 -0700, Jakub Kicinski <kuba@kernel.org> wrote:
> On Thu, 11 Aug 2022 04:11:22 -0400 Michael S. Tsirkin wrote:
> > Which patches does this fix?
> > Maybe I should squash.
>
> Side question to make sure I understand the terminology - this
> is *not* a vhost patch, right? vhost is the host side of virtio?
> Is the work going via the vhost tree because of some dependencies?
Yes, the commits fixed by this patch are currently in Michael's vhost branch.
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/log/?h=linux-next
So I mean that by "vhost" here, not into the net/net-next branch. Or should I use
a more accurate term next time?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down
2022-08-12 1:30 ` Xuan Zhuo
@ 2022-08-12 19:47 ` Jakub Kicinski
0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2022-08-12 19:47 UTC (permalink / raw
To: Xuan Zhuo
Cc: virtualization, Jason Wang, David S. Miller, Eric Dumazet,
Paolo Abeni, netdev, Michael S. Tsirkin
On Fri, 12 Aug 2022 09:30:38 +0800 Xuan Zhuo wrote:
> Yes, the commits fixed by this patch are currently in Michael's vhost branch.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/log/?h=linux-next
>
> So I mean that by "vhost" here, not into the net/net-next branch. Or should I use
> a more accurate term next time?
The tagging seems good, perhaps add a note to the commit message next
time. Maybe a lore link to the series you are fixing up?
The virtio_net.c patches usually go via netdev AFAIU and we're lacking
the vhost context.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-08-12 19:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-11 8:02 [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down Xuan Zhuo
2022-08-11 8:02 ` [PATCH 1/2] virtio_net: fix for stuck when change rx " Xuan Zhuo
2022-08-11 8:02 ` [PATCH 2/2] virtio_net: fix for stuck when change tx " Xuan Zhuo
2022-08-11 8:11 ` [PATCH vhost 0/2] virtio_net: fix for stuck when change " Michael S. Tsirkin
2022-08-11 8:12 ` Xuan Zhuo
2022-08-11 17:37 ` Jakub Kicinski
2022-08-12 1:30 ` Xuan Zhuo
2022-08-12 19:47 ` Jakub Kicinski
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 read-only IMAP folder(s) and NNTP newsgroup(s).