All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-scsi: set dataplane_started to false upon failure
@ 2026-08-25 15:48 Stefan Hajnoczi
  2026-08-26  8:33 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2026-08-25 15:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Paolo Bonzini, Michael S. Tsirkin, Stefan Hajnoczi

Commit e24a47c5b73e ("virtio-scsi: do not use vring in dataplane") set
dataplane_started to true when virtio_scsi_dataplane_start() fails. This
is likely a typo since dataplane is not functional after failure.

The non-ioeventfd fallback is broken because dataplane_started is true
after virtio_scsi_dataplane_start() failure. As a result, the following
assertion failure occurs when a virtio-scsi device exceeds the open file
descriptor ulimit when setting up notifiers (eventfds):

  $ ulimit -n 104 # exact number can vary based on QEMU version
  $ qemu-system-x86_64 -M q35,accel=kvm -m 1G -cpu host -smp 14 \
         --blockdev file,node-name=drive0,filename=test.img,cache.direct=on,aio=native \
         --blockdev file,node-name=drive1,filename=data01.img,cache.direct=on,aio=native \
         --device virtio-scsi-pci,id=virtio-scsi-pci0 \
         --device scsi-hd,drive=drive0,bus=virtio-scsi-pci0.0 \
         --device virtio-scsi-pci,id=virtio-scsi-pci1 \
         --device scsi-hd,drive=drive1,bus=virtio-scsi-pci1.0
  qemu: virtio-scsi: Failed to set guest notifiers (-24), ensure -accel kvm is set.
  qemu: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
  qemu-system-x86_64: ../hw/scsi/virtio-scsi.c:1017: virtio_scsi_reset: Assertion `!s->dataplane_started' failed.
  Aborted                    (core dumped)

Cc: Paolo Bonzini <pbonzini@redhat.com>
Fixes: e24a47c5b73e ("virtio-scsi: do not use vring in dataplane")
Buglink: https://redhat.atlassian.net/browse/RHEL-193328
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/scsi/virtio-scsi-dataplane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index 95f13fb7c28..bcb6e441335 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -230,7 +230,7 @@ fail_host_notifiers:
 fail_guest_notifiers:
     s->dataplane_fenced = true;
     s->dataplane_starting = false;
-    s->dataplane_started = true;
+    s->dataplane_started = false;
     return -ENOSYS;
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-scsi: set dataplane_started to false upon failure
  2026-08-25 15:48 [PATCH] virtio-scsi: set dataplane_started to false upon failure Stefan Hajnoczi
@ 2026-08-26  8:33 ` Philippe Mathieu-Daudé
  2026-09-08 19:37 ` Stefan Hajnoczi
  2026-09-12  9:13 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-26  8:33 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Fam Zheng, Paolo Bonzini, Michael S. Tsirkin

On 25/8/26 17:48, Stefan Hajnoczi wrote:
> Commit e24a47c5b73e ("virtio-scsi: do not use vring in dataplane") set
> dataplane_started to true when virtio_scsi_dataplane_start() fails. This
> is likely a typo since dataplane is not functional after failure.
> 
> The non-ioeventfd fallback is broken because dataplane_started is true
> after virtio_scsi_dataplane_start() failure. As a result, the following
> assertion failure occurs when a virtio-scsi device exceeds the open file
> descriptor ulimit when setting up notifiers (eventfds):
> 
>    $ ulimit -n 104 # exact number can vary based on QEMU version
>    $ qemu-system-x86_64 -M q35,accel=kvm -m 1G -cpu host -smp 14 \
>           --blockdev file,node-name=drive0,filename=test.img,cache.direct=on,aio=native \
>           --blockdev file,node-name=drive1,filename=data01.img,cache.direct=on,aio=native \
>           --device virtio-scsi-pci,id=virtio-scsi-pci0 \
>           --device scsi-hd,drive=drive0,bus=virtio-scsi-pci0.0 \
>           --device virtio-scsi-pci,id=virtio-scsi-pci1 \
>           --device scsi-hd,drive=drive1,bus=virtio-scsi-pci1.0
>    qemu: virtio-scsi: Failed to set guest notifiers (-24), ensure -accel kvm is set.
>    qemu: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
>    qemu-system-x86_64: ../hw/scsi/virtio-scsi.c:1017: virtio_scsi_reset: Assertion `!s->dataplane_started' failed.
>    Aborted                    (core dumped)
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Fixes: e24a47c5b73e ("virtio-scsi: do not use vring in dataplane")
> Buglink: https://redhat.atlassian.net/browse/RHEL-193328
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   hw/scsi/virtio-scsi-dataplane.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-scsi: set dataplane_started to false upon failure
  2026-08-25 15:48 [PATCH] virtio-scsi: set dataplane_started to false upon failure Stefan Hajnoczi
  2026-08-26  8:33 ` Philippe Mathieu-Daudé
@ 2026-09-08 19:37 ` Stefan Hajnoczi
  2026-09-12  9:13 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2026-09-08 19:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Fam Zheng, Paolo Bonzini, Michael S. Tsirkin, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2380 bytes --]

On Tue, Aug 25, 2026 at 11:48:54AM -0400, Stefan Hajnoczi wrote:
> Commit e24a47c5b73e ("virtio-scsi: do not use vring in dataplane") set
> dataplane_started to true when virtio_scsi_dataplane_start() fails. This
> is likely a typo since dataplane is not functional after failure.
> 
> The non-ioeventfd fallback is broken because dataplane_started is true
> after virtio_scsi_dataplane_start() failure. As a result, the following
> assertion failure occurs when a virtio-scsi device exceeds the open file
> descriptor ulimit when setting up notifiers (eventfds):
> 
>   $ ulimit -n 104 # exact number can vary based on QEMU version
>   $ qemu-system-x86_64 -M q35,accel=kvm -m 1G -cpu host -smp 14 \
>          --blockdev file,node-name=drive0,filename=test.img,cache.direct=on,aio=native \
>          --blockdev file,node-name=drive1,filename=data01.img,cache.direct=on,aio=native \
>          --device virtio-scsi-pci,id=virtio-scsi-pci0 \
>          --device scsi-hd,drive=drive0,bus=virtio-scsi-pci0.0 \
>          --device virtio-scsi-pci,id=virtio-scsi-pci1 \
>          --device scsi-hd,drive=drive1,bus=virtio-scsi-pci1.0
>   qemu: virtio-scsi: Failed to set guest notifiers (-24), ensure -accel kvm is set.
>   qemu: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
>   qemu-system-x86_64: ../hw/scsi/virtio-scsi.c:1017: virtio_scsi_reset: Assertion `!s->dataplane_started' failed.
>   Aborted                    (core dumped)
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>

Ping

Paolo: Can you take this through your SCSI tree? Thanks!

Stefan

> Fixes: e24a47c5b73e ("virtio-scsi: do not use vring in dataplane")
> Buglink: https://redhat.atlassian.net/browse/RHEL-193328
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  hw/scsi/virtio-scsi-dataplane.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
> index 95f13fb7c28..bcb6e441335 100644
> --- a/hw/scsi/virtio-scsi-dataplane.c
> +++ b/hw/scsi/virtio-scsi-dataplane.c
> @@ -230,7 +230,7 @@ fail_host_notifiers:
>  fail_guest_notifiers:
>      s->dataplane_fenced = true;
>      s->dataplane_starting = false;
> -    s->dataplane_started = true;
> +    s->dataplane_started = false;
>      return -ENOSYS;
>  }
>  
> -- 
> 2.55.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-scsi: set dataplane_started to false upon failure
  2026-08-25 15:48 [PATCH] virtio-scsi: set dataplane_started to false upon failure Stefan Hajnoczi
  2026-08-26  8:33 ` Philippe Mathieu-Daudé
  2026-09-08 19:37 ` Stefan Hajnoczi
@ 2026-09-12  9:13 ` Michael Tokarev
  2026-09-12 15:09   ` Stefan Hajnoczi
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2026-09-12  9:13 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel
  Cc: Fam Zheng, Paolo Bonzini, Michael S. Tsirkin, QEMU Stable

On 8/25/26 18:48, Stefan Hajnoczi wrote:
> Commit e24a47c5b73e ("virtio-scsi: do not use vring in dataplane") set
> dataplane_started to true when virtio_scsi_dataplane_start() fails. This
> is likely a typo since dataplane is not functional after failure.
> 
> The non-ioeventfd fallback is broken because dataplane_started is true
> after virtio_scsi_dataplane_start() failure. As a result, the following
> assertion failure occurs when a virtio-scsi device exceeds the open file
> descriptor ulimit when setting up notifiers (eventfds):
> 
>    $ ulimit -n 104 # exact number can vary based on QEMU version
>    $ qemu-system-x86_64 -M q35,accel=kvm -m 1G -cpu host -smp 14 \
>           --blockdev file,node-name=drive0,filename=test.img,cache.direct=on,aio=native \
>           --blockdev file,node-name=drive1,filename=data01.img,cache.direct=on,aio=native \
>           --device virtio-scsi-pci,id=virtio-scsi-pci0 \
>           --device scsi-hd,drive=drive0,bus=virtio-scsi-pci0.0 \
>           --device virtio-scsi-pci,id=virtio-scsi-pci1 \
>           --device scsi-hd,drive=drive1,bus=virtio-scsi-pci1.0
>    qemu: virtio-scsi: Failed to set guest notifiers (-24), ensure -accel kvm is set.
>    qemu: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
>    qemu-system-x86_64: ../hw/scsi/virtio-scsi.c:1017: virtio_scsi_reset: Assertion `!s->dataplane_started' failed.
>    Aborted                    (core dumped)
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Fixes: e24a47c5b73e ("virtio-scsi: do not use vring in dataplane")
> Buglink: https://redhat.atlassian.net/browse/RHEL-193328
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
I'm picking this one for currently active qemu stable series.
Please let me know if I shouldn't.  Maybe it's a too specific
bug but it's not good to throw assertion failures to the user.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-scsi: set dataplane_started to false upon failure
  2026-09-12  9:13 ` Michael Tokarev
@ 2026-09-12 15:09   ` Stefan Hajnoczi
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2026-09-12 15:09 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Stefan Hajnoczi, qemu-devel, Fam Zheng, Paolo Bonzini,
	Michael S. Tsirkin, QEMU Stable

On Sat, Sep 12, 2026 at 5:14 AM Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> On 8/25/26 18:48, Stefan Hajnoczi wrote:
> > Commit e24a47c5b73e ("virtio-scsi: do not use vring in dataplane") set
> > dataplane_started to true when virtio_scsi_dataplane_start() fails. This
> > is likely a typo since dataplane is not functional after failure.
> >
> > The non-ioeventfd fallback is broken because dataplane_started is true
> > after virtio_scsi_dataplane_start() failure. As a result, the following
> > assertion failure occurs when a virtio-scsi device exceeds the open file
> > descriptor ulimit when setting up notifiers (eventfds):
> >
> >    $ ulimit -n 104 # exact number can vary based on QEMU version
> >    $ qemu-system-x86_64 -M q35,accel=kvm -m 1G -cpu host -smp 14 \
> >           --blockdev file,node-name=drive0,filename=test.img,cache.direct=on,aio=native \
> >           --blockdev file,node-name=drive1,filename=data01.img,cache.direct=on,aio=native \
> >           --device virtio-scsi-pci,id=virtio-scsi-pci0 \
> >           --device scsi-hd,drive=drive0,bus=virtio-scsi-pci0.0 \
> >           --device virtio-scsi-pci,id=virtio-scsi-pci1 \
> >           --device scsi-hd,drive=drive1,bus=virtio-scsi-pci1.0
> >    qemu: virtio-scsi: Failed to set guest notifiers (-24), ensure -accel kvm is set.
> >    qemu: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
> >    qemu-system-x86_64: ../hw/scsi/virtio-scsi.c:1017: virtio_scsi_reset: Assertion `!s->dataplane_started' failed.
> >    Aborted                    (core dumped)
> >
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Fixes: e24a47c5b73e ("virtio-scsi: do not use vring in dataplane")
> > Buglink: https://redhat.atlassian.net/browse/RHEL-193328
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> I'm picking this one for currently active qemu stable series.
> Please let me know if I shouldn't.  Maybe it's a too specific
> bug but it's not good to throw assertion failures to the user.

Sounds good.

Stefan


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-12 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 15:48 [PATCH] virtio-scsi: set dataplane_started to false upon failure Stefan Hajnoczi
2026-08-26  8:33 ` Philippe Mathieu-Daudé
2026-09-08 19:37 ` Stefan Hajnoczi
2026-09-12  9:13 ` Michael Tokarev
2026-09-12 15:09   ` Stefan Hajnoczi

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.