From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Denis V. Lunev" <den@virtuozzo.com>
Cc: "Denis V. Lunev" <den@openvz.org>,
qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Fam Zheng <fam@euphon.net>
Subject: Re: [PATCH 0/1] virtio-scsi: fix hot-plug event racing device realize
Date: Thu, 19 Nov 2026 02:57:09 -0500 [thread overview]
Message-ID: <20261119025646-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <805b4bb7-eb0e-477b-8ba6-9ba9f89e1f03@virtuozzo.com>
On Tue, Nov 17, 2026 at 08:53:44PM +0100, Denis V. Lunev wrote:
> On 10/23/26 18:19, Denis V. Lunev wrote:
> > This email originated from an IP that might not be authorized by the domain it was sent from.
> > Do not click links or open attachments unless it is an email you expected to receive.
> > A disk or CD-ROM hot-plugged into virtio-scsi sometimes never shows up
> > in the guest. QEMU has the device, the guest has consumed the RESCAN
> > event, and a manual bus rescan finds the LUN at once. We see this in CI
> > with Windows Server guests (vioscsi) and with Linux guests, always with
> > the controller on an iothread.
> >
> > The event is pushed from the plug() callback, before the device is
> > realized, and the iothread request path does not see unrealized devices
> > since 8ddf958e8d62. A guest that scans right away gets BAD_TARGET and
> > does not retry. The patch moves the event to a main-loop bottom half.
> > The alternative, letting the request path see a plugged but unrealized
> > device, would undo what 8ddf958e8d62 protects against.
> >
> > There is no test in the patch. The window lies inside a single
> > device_add under the BQL, and a qtest or iotests client is served by the
> > same main loop, so it cannot send a request in between. To reproduce, I
> > booted a Linux guest with virtio-scsi on an iothread, ran QEMU under gdb
> > in non-stop mode and stalled the main thread for 3 s in
> > scsi_bus_set_ua(), right after the event is pushed, then hot-plugged a
> > scsi-cd:
> >
> > break scsi_bus_set_ua
> > commands
> > call (int)usleep(3000000)
> > continue
> > end
> >
> > Without the patch the guest never enumerated the LUN (3 of 3 runs).
> > With the patch the same stall falls after realize and the LUN appeared
> > every time (3 of 3). Without the stall both builds pass, which is why
> > this only shows up on loaded hosts. tests/qtest virtio-scsi passes.
> >
> > Every release since 5.2 has the bug, hence qemu-stable.
> >
> > Signed-off-by: Denis V. Lunev <den@openvz.org>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Fam Zheng <fam@euphon.net>
> > Cc: "Michael S. Tsirkin" <mst@redhat.com>
> >
> > Denis V. Lunev (1):
> > virtio-scsi: fix hot-plug event racing device realize
> >
> > hw/scsi/virtio-scsi.c | 38 +++++++++++++++++++++++++++-----------
> > 1 file changed, 27 insertions(+), 11 deletions(-)
> >
> >
> > base-commit: b6c4b7e86dec12d07f5cac65265b986d38ee9002
> ping
pong. I'm not applying patches I'm not CC'd on. Paolo, wanna take
a look?
prev parent reply other threads:[~2026-11-19 7:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 16:19 [PATCH 0/1] virtio-scsi: fix hot-plug event racing device realize Denis V. Lunev
2026-10-23 16:19 ` [PATCH 1/1] " Denis V. Lunev
2026-11-02 23:51 ` [PATCH 0/1] " Denis V. Lunev
2026-11-17 19:53 ` Denis V. Lunev
2026-11-19 7:57 ` Michael S. Tsirkin [this message]
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=20261119025646-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=den@openvz.org \
--cc=den@virtuozzo.com \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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 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.