Netdev List
 help / color / mirror / Atom feed
From: Heng Qi <hengqi@linux.alibaba.com>
To: Jason Wang <jasowang@redhat.com>
Cc: netdev@vger.kernel.org, virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH 1/2] virtio-net: fix possible dim status unrecoverable
Date: Mon, 25 Mar 2024 10:11:16 +0800	[thread overview]
Message-ID: <8d829442-0eef-485c-b448-cd2376c20270@linux.alibaba.com> (raw)
In-Reply-To: <CACGkMEtyujkJ6Gvxr1xV94a_tMzTo48opA+42oBvN-eQ=92StA@mail.gmail.com>



在 2024/3/22 下午1:17, Jason Wang 写道:
> On Thu, Mar 21, 2024 at 7:46 PM Heng Qi <hengqi@linux.alibaba.com> 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>
>> ---
>>   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 c22d111..0ebe322 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -3563,8 +3563,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;
>> +       }
> Patch looks fine but I wonder if a delayed schedule is better.

The work in net_dim() core layer uses non-delayed-work, and the two 
cannot be mixed.

Thanks,
Heng

>
> Thanks
>
>>          /* Each rxq's work is queued by "net_dim()->schedule_work()"
>>           * in response to NAPI traffic changes. Note that dim->profile_ix
>> --
>> 1.8.3.1
>>


  reply	other threads:[~2024-03-25  2:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 11:45 [PATCH 0/2] virtio-net: a fix and some updates for virtio dim Heng Qi
2024-03-21 11:45 ` [PATCH 1/2] virtio-net: fix possible dim status unrecoverable Heng Qi
2024-03-22  5:17   ` Jason Wang
2024-03-25  2:11     ` Heng Qi [this message]
2024-03-25  6:29       ` Jason Wang
2024-03-25  6:57         ` Heng Qi
2024-03-25  7:06           ` Jason Wang
2024-03-21 11:45 ` [PATCH 2/2] virtio-net: reduce the CPU consumption of dim worker Heng Qi
2024-03-22  2:03   ` kernel test robot
2024-03-22  5:19   ` Jason Wang
2024-03-25  2:21     ` Heng Qi
2024-03-25  5:57       ` Jason Wang
2024-03-25  7:17         ` Heng Qi
2024-03-25  7:56           ` Jason Wang
2024-03-25  8:22             ` Heng Qi
2024-03-25  8:42               ` Jason Wang
2024-03-26  2:46                 ` Heng Qi
2024-03-26  4:08                   ` Jason Wang
2024-03-26  5:57                     ` Heng Qi
2024-03-26  6:05                       ` Jason Wang
2024-03-22  6:50   ` Dan Carpenter
2024-03-21 12:25 ` [PATCH 0/2] virtio-net: a fix and some updates for virtio dim Jiri Pirko
2024-03-25  2:23   ` 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=8d829442-0eef-485c-b448-cd2376c20270@linux.alibaba.com \
    --to=hengqi@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --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