All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
@ 2022-10-27  7:27 Emanuele Giuseppe Esposito
  2022-10-27 12:07 ` Hanna Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Emanuele Giuseppe Esposito @ 2022-10-27  7:27 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Hanna Reitz, qemu-devel, Emanuele Giuseppe Esposito

blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
but can be invoked from iothreads when handling scsi requests.
This triggers an assertion failure:

 0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
 0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
 0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
 0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
 0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
   at ../src/block/block-backend.c:1949
 0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
   wce=<optimized out>) at ../src/block/block-backend.c:1951
 0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
   page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
 mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
   at ../src/hw/scsi/scsi-disk.c:1570
 scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
   ../src/hw/scsi/scsi-disk.c:1640
 scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
 0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
   req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
 virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
   ../src/hw/scsi/virtio-scsi.c:761
 virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
   ../src/hw/scsi/virtio-scsi.c:775
 virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
   ../src/hw/scsi/virtio-scsi.c:765
 0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
   ../src/hw/virtio/virtio.c:2365
 0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
   node=<optimized out>) at ../src/util/aio-posix.c:369
 0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
   ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
 aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
   ../src/util/aio-posix.c:713
 0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
   ../src/iothread.c:67
 0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
   ../src/util/qemu-thread-posix.c:504
 0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
 0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6

Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
allowed to call IO_CODE.

Resolves: #1272

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 block/block-backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index aa4adf06ae..ade4da55e0 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1946,7 +1946,7 @@ bool blk_enable_write_cache(BlockBackend *blk)
 
 void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
 {
-    GLOBAL_STATE_CODE();
+    IO_CODE();
     blk->enable_write_cache = wce;
 }
 
-- 
2.31.1



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

* Re: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
  2022-10-27  7:27 [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE Emanuele Giuseppe Esposito
@ 2022-10-27 12:07 ` Hanna Reitz
  2022-10-27 12:41 ` Antoine Damhet
  2022-10-27 18:29 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Hanna Reitz @ 2022-10-27 12:07 UTC (permalink / raw)
  To: Emanuele Giuseppe Esposito, qemu-block; +Cc: Kevin Wolf, qemu-devel

On 27.10.22 09:27, Emanuele Giuseppe Esposito wrote:
> blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
> but can be invoked from iothreads when handling scsi requests.
> This triggers an assertion failure:
>
>   0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
>   0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
>   0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
>   0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
>   0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
>     at ../src/block/block-backend.c:1949
>   0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
>     wce=<optimized out>) at ../src/block/block-backend.c:1951
>   0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
>     page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
>   mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
>     at ../src/hw/scsi/scsi-disk.c:1570
>   scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
>     ../src/hw/scsi/scsi-disk.c:1640
>   scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
>   0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
>     req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
>   virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
>     ../src/hw/scsi/virtio-scsi.c:761
>   virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
>     ../src/hw/scsi/virtio-scsi.c:775
>   virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
>     ../src/hw/scsi/virtio-scsi.c:765
>   0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
>     ../src/hw/virtio/virtio.c:2365
>   0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
>     node=<optimized out>) at ../src/util/aio-posix.c:369
>   0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
>     ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
>   aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
>     ../src/util/aio-posix.c:713
>   0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
>     ../src/iothread.c:67
>   0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
>     ../src/util/qemu-thread-posix.c:504
>   0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
>   0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6
>
> Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
> allowed to call IO_CODE.
>
> Resolves: #1272
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>   block/block-backend.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Hanna Reitz <hreitz@redhat.com>



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

* Re: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
  2022-10-27  7:27 [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE Emanuele Giuseppe Esposito
  2022-10-27 12:07 ` Hanna Reitz
@ 2022-10-27 12:41 ` Antoine Damhet
  2022-10-27 18:29 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Antoine Damhet @ 2022-10-27 12:41 UTC (permalink / raw)
  To: Emanuele Giuseppe Esposito
  Cc: qemu-block, Kevin Wolf, Hanna Reitz, qemu-devel

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

Thanks, it works for us

On Thu, Oct 27, 2022 at 03:27:26AM -0400, Emanuele Giuseppe Esposito wrote:
> blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
> but can be invoked from iothreads when handling scsi requests.
> This triggers an assertion failure:
> 
>  0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
>  0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
>    at ../src/block/block-backend.c:1949
>  0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
>    wce=<optimized out>) at ../src/block/block-backend.c:1951
>  0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
>    page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
>  mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
>    at ../src/hw/scsi/scsi-disk.c:1570
>  scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
>    ../src/hw/scsi/scsi-disk.c:1640
>  scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
>  0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
>    req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
>  virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
>    ../src/hw/scsi/virtio-scsi.c:761
>  virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
>    ../src/hw/scsi/virtio-scsi.c:775
>  virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
>    ../src/hw/scsi/virtio-scsi.c:765
>  0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
>    ../src/hw/virtio/virtio.c:2365
>  0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
>    node=<optimized out>) at ../src/util/aio-posix.c:369
>  0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
>    ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
>  aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
>    ../src/util/aio-posix.c:713
>  0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
>    ../src/iothread.c:67
>  0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
>    ../src/util/qemu-thread-posix.c:504
>  0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
>  0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6
> 
> Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
> allowed to call IO_CODE.
> 
> Resolves: #1272
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

Tested-by: Antoine Damhet <antoine.damhet@shadow.tech>

> ---
>  block/block-backend.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)



-- 
Antoine 'xdbob' Damhet

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

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

* Re: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
  2022-10-27  7:27 [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE Emanuele Giuseppe Esposito
  2022-10-27 12:07 ` Hanna Reitz
  2022-10-27 12:41 ` Antoine Damhet
@ 2022-10-27 18:29 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2022-10-27 18:29 UTC (permalink / raw)
  To: Emanuele Giuseppe Esposito; +Cc: qemu-block, Hanna Reitz, qemu-devel

Am 27.10.2022 um 09:27 hat Emanuele Giuseppe Esposito geschrieben:
> blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
> but can be invoked from iothreads when handling scsi requests.
> This triggers an assertion failure:
> 
>  0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
>  0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
>  0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
>    at ../src/block/block-backend.c:1949
>  0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
>    wce=<optimized out>) at ../src/block/block-backend.c:1951
>  0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
>    page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
>  mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
>    at ../src/hw/scsi/scsi-disk.c:1570
>  scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
>    ../src/hw/scsi/scsi-disk.c:1640
>  scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
>  0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
>    req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
>  virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
>    ../src/hw/scsi/virtio-scsi.c:761
>  virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
>    ../src/hw/scsi/virtio-scsi.c:775
>  virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
>    ../src/hw/scsi/virtio-scsi.c:765
>  0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
>    ../src/hw/virtio/virtio.c:2365
>  0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
>    node=<optimized out>) at ../src/util/aio-posix.c:369
>  0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
>    ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
>  aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
>    ../src/util/aio-posix.c:713
>  0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
>    ../src/iothread.c:67
>  0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
>    ../src/util/qemu-thread-posix.c:504
>  0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
>  0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6
> 
> Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
> allowed to call IO_CODE.
> 
> Resolves: #1272
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

Thanks, applied to the block branch.

Kevin



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

end of thread, other threads:[~2022-10-27 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  7:27 [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE Emanuele Giuseppe Esposito
2022-10-27 12:07 ` Hanna Reitz
2022-10-27 12:41 ` Antoine Damhet
2022-10-27 18:29 ` Kevin Wolf

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.