From: "Michael S. Tsirkin" <mst@redhat.com>
To: Heng Qi <hengqi@linux.alibaba.com>
Cc: netdev@vger.kernel.org, virtualization@lists.linux.dev,
Jason Wang <jasowang@redhat.com>, Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable
Date: Tue, 16 Jan 2024 08:15:10 -0500 [thread overview]
Message-ID: <20240116081442-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1705410693-118895-2-git-send-email-hengqi@linux.alibaba.com>
On Tue, Jan 16, 2024 at 09:11:31PM +0800, Heng Qi wrote:
> When the dim worker is scheduled, if it fails to acquire the lock,
> dim may not be able to return to the working state later.
>
> For example, the following single queue scenario:
> 1. The dim worker of rxq0 is scheduled, and the dim status is
> changed to DIM_APPLY_NEW_PROFILE;
> 2. The ethtool command is holding rtnl lock;
> 3. Since the rtnl lock is already held, virtnet_rx_dim_work fails
> to acquire the lock and exits;
>
> Then, even if net_dim is invoked again, it cannot work because the
> state is not restored to DIM_START_MEASURE.
>
> Fixes: 6208799553a8 ("virtio-net: support rx netdim")
> Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
> ---
> Belongs to the net branch.
>
> drivers/net/virtio_net.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index d7ce4a1..f6ac3e7 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3524,8 +3524,10 @@ static void virtnet_rx_dim_work(struct work_struct *work)
> struct dim_cq_moder update_moder;
> int i, qnum, err;
>
> - if (!rtnl_trylock())
> + if (!rtnl_trylock()) {
> + schedule_work(&dim->work);
> return;
> + }
>
> /* Each rxq's work is queued by "net_dim()->schedule_work()"
> * in response to NAPI traffic changes. Note that dim->profile_ix
OK but this means that in cleanup it is not sufficient to flush
dim work - it can requeue itself.
> --
> 1.8.3.1
next prev parent reply other threads:[~2024-01-16 13:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 13:11 [PATCH net-next 0/3] virtio-net: a fix and some updates for virtio dim Heng Qi
2024-01-16 13:11 ` [PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable Heng Qi
2024-01-16 13:15 ` Michael S. Tsirkin [this message]
2024-01-17 3:34 ` Heng Qi
2024-01-16 13:11 ` [PATCH net-next 2/3] virtio-net: batch dim request Heng Qi
2024-01-16 19:49 ` Simon Horman
2024-01-17 3:38 ` Heng Qi
2024-01-16 13:11 ` [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of dim worker Heng Qi
2024-01-16 19:56 ` Simon Horman
2024-01-17 3:41 ` Heng Qi
2024-01-19 10:31 ` kernel test robot
2024-01-19 13:43 ` kernel test robot
2024-01-22 7:19 ` Xuan Zhuo
2024-01-22 7:42 ` Xuan Zhuo
2024-01-19 12:28 ` [PATCH net-next 0/3] virtio-net: a fix and some updates for virtio dim Michael S. Tsirkin
2024-01-19 14:20 ` Heng Qi
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=20240116081442-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hengqi@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--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 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.