From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Heng Qi <hengqi@linux.alibaba.com>,
Paolo Abeni <pabeni@redhat.com>,
Zhu Yanjun <yanjun.zhu@intel.com>,
mst@redhat.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, virtualization@lists.linux.dev,
netdev@vger.kernel.org, Zhu Yanjun <yanjun.zhu@linux.dev>
Subject: Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang
Date: Mon, 22 Jan 2024 11:58:01 +0800 [thread overview]
Message-ID: <1705895881.6990144-1-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <CACGkMEs18hjxiZRDT5-+PMDHkLbEyiviafGiCWsAE6CGBrj+9g@mail.gmail.com>
On Mon, 22 Jan 2024 11:14:30 +0800, Jason Wang <jasowang@redhat.com> wrote:
> On Mon, Jan 22, 2024 at 10:12 AM Zhu Yanjun <yanjun.zhu@linux.dev> wrote:
> >
> >
> > 在 2024/1/20 1:29, Andrew Lunn 写道:
> > >>>>> while (!virtqueue_get_buf(vi->cvq, &tmp) &&
> > >>>>> - !virtqueue_is_broken(vi->cvq))
> > >>>>> + !virtqueue_is_broken(vi->cvq)) {
> > >>>>> + if (timeout)
> > >>>>> + timeout--;
> > >>>> This is not really a timeout, just a loop counter. 200 iterations could
> > >>>> be a very short time on reasonable H/W. I guess this avoid the soft
> > >>>> lockup, but possibly (likely?) breaks the functionality when we need to
> > >>>> loop for some non negligible time.
> > >>>>
> > >>>> I fear we need a more complex solution, as mentioned by Micheal in the
> > >>>> thread you quoted.
> > >>> Got it. I also look forward to the more complex solution to this problem.
> > >> Can we add a device capability (new feature bit) such as ctrq_wait_timeout
> > >> to get a reasonable timeout?
> > > The usual solution to this is include/linux/iopoll.h. If you can sleep
> > > read_poll_timeout() otherwise read_poll_timeout_atomic().
> >
> > I read carefully the functions read_poll_timeout() and
> > read_poll_timeout_atomic(). The timeout is set by the caller of the 2
> > functions.
>
> FYI, in order to avoid a swtich of atomic or not, we need convert rx
> mode setting to workqueue first:
>
> https://www.mail-archive.com/virtualization@lists.linux-foundation.org/msg60298.html
>
> >
> > As such, can we add a module parameter to customize this timeout value
> > by the user?
>
> Who is the "user" here, or how can the "user" know the value?
>
> >
> > Or this timeout value is stored in device register, virtio_net driver
> > will read this timeout value at initialization?
>
> See another thread. The design needs to be general, or you can post a RFC.
>
> In another thought, we've already had a tx watchdog, maybe we can have
> something similar to cvq and use timeout + reset in that case.
But we may block by the reset ^_^ if the device is broken?
Thanks.
>
> Thans
>
> >
> > Zhu Yanjun
> >
> > >
> > > Andrew
> >
>
next prev parent reply other threads:[~2024-01-22 4:00 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 1:29 [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang Zhu Yanjun
2024-01-15 2:20 ` Jason Wang
2024-01-15 10:25 ` Zhu Yanjun
[not found] ` <6cf2699a-483d-4124-9782-b6a771a41e70@linux.dev>
2024-01-22 3:06 ` Jason Wang
2024-01-16 12:04 ` Paolo Abeni
2024-01-18 12:01 ` Zhu Yanjun
2024-01-19 14:27 ` Heng Qi
2024-01-19 17:29 ` Andrew Lunn
2024-01-20 4:21 ` Zhu Yanjun
2024-01-22 2:12 ` Zhu Yanjun
2024-01-22 3:14 ` Jason Wang
2024-01-22 3:58 ` Xuan Zhuo [this message]
2024-01-22 4:16 ` Jason Wang
2024-01-22 6:16 ` Xuan Zhuo
2024-01-22 6:55 ` Jason Wang
2024-01-22 6:58 ` Jason Wang
2024-01-22 7:02 ` Xuan Zhuo
2024-01-22 7:19 ` Jason Wang
2024-01-22 7:25 ` Xuan Zhuo
2024-01-22 7:57 ` Jason Wang
2024-01-22 8:01 ` Xuan Zhuo
2024-01-22 8:32 ` Jason Wang
2024-01-22 9:11 ` Xuan Zhuo
[not found] ` <e46d04d7-4eb7-4fcd-821a-d558c07531b7@linux.dev>
2024-01-26 3:13 ` Zhu Yanjun
2024-01-22 7:01 ` Xuan Zhuo
2024-01-22 3:08 ` Jason Wang
2024-01-22 4:42 ` Heng Qi
2024-01-18 13:14 ` Michael S. Tsirkin
2024-01-19 1:42 ` Xuan Zhuo
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=1705895881.6990144-1-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hengqi@linux.alibaba.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=yanjun.zhu@intel.com \
--cc=yanjun.zhu@linux.dev \
/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).