From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Li Zetao <lizetao1@huawei.com>,
pbonzini@redhat.com, stefanha@redhat.com, axboe@kernel.dk,
kraxel@redhat.com, david@redhat.com, ericvh@gmail.com,
lucho@ionkov.net, asmadeus@codewreck.org,
linux_oss@crudebyte.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
rusty@rustcorp.com.au, virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH 0/4] Fix probe failed when modprobe modules
Date: Tue, 29 Nov 2022 11:37:09 +0800 [thread overview]
Message-ID: <CACGkMEtuOk+wyCsvY0uayGAvy926G381PC-csoXVAwCfiKCZQw@mail.gmail.com> (raw)
In-Reply-To: <20221128042945-mutt-send-email-mst@kernel.org>
On Mon, Nov 28, 2022 at 6:14 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Mon, Nov 28, 2022 at 10:10:01AM +0800, Li Zetao wrote:
> > This patchset fixes similar issue, the root cause of the
> > problem is that the virtqueues are not stopped on error
> > handling path.
>
> I've been thinking about this.
> Almost all drivers are affected.
>
> The reason really is that it used to be the right thing to do:
> On legacy pci del_vqs writes 0
> into vq index
into vq address actually?
> and this resets the device as a side effect
I think there's no guarantee for a device to do this.
> (we actually do this multiple times, what e.g. writes of MSI vector
> after the 1st reset do I have no idea).
>
> mmio ccw and modern pci don't.
>
> Given this has been with us for a while I am inlined to look for
> a global solution rather than tweaking each driver.
But do we still need patches for -stable at least?
>
> Given many drivers are supposed to work on legacy too, we know del_vqs
> includes a reset for many of them. So I think I see a better way to do
> this:
>
> Add virtio_reset_device_and_del_vqs()
What's the difference with the current del_vqs method? Is this something like:
virtio_reset_device();
config->del_vqs();
>
> and convert all drivers to that.
>
> When doing this, we also need to/can fix a related problem (and related
> to the hardening that Jason Wang was looking into):
> virtio_reset_device is inherently racy: vq interrupts could
> be in flight when we do reset. We need to prevent handlers from firing in
> the window between reset and freeing the irq, so we should first
> free irqs and only then start changing the state by e.g.
> device reset.
Yes.
>
>
> Quite a lot of core work here. Jason are you still looking into
> hardening?
Yes, last time we've discussed a solution that depends on the first
kick to enable the interrupt handler. But after some thought, it seems
risky since there's no guarantee that the device work in this way.
One example is the current vhost_net, it doesn't wait for the kick to
process the rx packets. Any more thought on this?
Thanks
>
>
>
> > Li Zetao (4):
> > 9p: Fix probe failed when modprobe 9pnet_virtio
> > virtio-mem: Fix probe failed when modprobe virtio_mem
> > virtio-input: Fix probe failed when modprobe virtio_input
> > virtio-blk: Fix probe failed when modprobe virtio_blk
> >
> > drivers/block/virtio_blk.c | 1 +
> > drivers/virtio/virtio_input.c | 1 +
> > drivers/virtio/virtio_mem.c | 1 +
> > net/9p/trans_virtio.c | 1 +
> > 4 files changed, 4 insertions(+)
> >
> > --
> > 2.25.1
>
next prev parent reply other threads:[~2022-11-29 3:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 2:10 [PATCH 0/4] Fix probe failed when modprobe modules Li Zetao
2022-11-28 2:10 ` [PATCH 1/4] 9p: Fix probe failed when modprobe 9pnet_virtio Li Zetao
2022-11-28 14:27 ` Christian Schoenebeck
2022-11-28 2:10 ` [PATCH 2/4] virtio-mem: Fix probe failed when modprobe virtio_mem Li Zetao
2022-11-28 8:22 ` David Hildenbrand
2022-11-28 2:10 ` [PATCH 3/4] virtio-input: Fix probe failed when modprobe virtio_input Li Zetao
2022-11-28 9:29 ` Michael S. Tsirkin
2022-11-28 2:10 ` [PATCH 4/4] virtio-blk: Fix probe failed when modprobe virtio_blk Li Zetao
2022-11-28 10:14 ` [PATCH 0/4] Fix probe failed when modprobe modules Michael S. Tsirkin
2022-11-29 3:37 ` Jason Wang [this message]
2022-12-19 10:15 ` Michael S. Tsirkin
2022-12-20 6:44 ` Jason Wang
2023-01-27 11:11 ` Michael S. Tsirkin
2023-01-29 5:50 ` Jason Wang
2022-11-29 16:06 ` [PATCH v2 0/5] " Li Zetao
2022-11-29 16:06 ` [PATCH v2 1/5] 9p: Fix probe failed when modprobe 9pnet_virtio Li Zetao
2022-11-29 16:06 ` [PATCH v2 2/5] virtio-mem: Fix probe failed when modprobe virtio_mem Li Zetao
2022-11-29 16:06 ` [PATCH v2 3/5] virtio-input: Fix probe failed when modprobe virtio_input Li Zetao
2022-11-29 16:06 ` [PATCH v2 4/5] virtio-blk: Fix probe failed when modprobe virtio_blk Li Zetao
2022-11-29 16:06 ` [PATCH v2 5/5] drm/virtio: Fix probe failed when modprobe virtio_gpu Li Zetao
2022-11-29 17:08 ` [PATCH v2 0/5] Fix probe failed when modprobe modules Jens Axboe
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=CACGkMEtuOk+wyCsvY0uayGAvy926G381PC-csoXVAwCfiKCZQw@mail.gmail.com \
--to=jasowang@redhat.com \
--cc=asmadeus@codewreck.org \
--cc=axboe@kernel.dk \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=edumazet@google.com \
--cc=ericvh@gmail.com \
--cc=kraxel@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lizetao1@huawei.com \
--cc=lucho@ionkov.net \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=stefanha@redhat.com \
--cc=v9fs-developer@lists.sourceforge.net \
--cc=virtualization@lists.linux-foundation.org \
/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).