[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 21/50] block/block-backend.c: assertions for block-backend
|
From: |
Kevin Wolf |
|
Subject: |
Re: [PULL 21/50] block/block-backend.c: assertions for block-backend |
|
Date: |
Wed, 16 Mar 2022 17:02:20 +0100 |
Am 16.03.2022 um 16:25 hat Philippe Mathieu-Daudé geschrieben:
> On 16/3/22 15:46, Emanuele Giuseppe Esposito wrote:
> > Am 16/03/2022 um 13:53 schrieb Philippe Mathieu-Daudé:
> > > On 16/3/22 13:44, Philippe Mathieu-Daudé wrote:
> > > > Hi,
> > > >
> > > > On 4/3/22 17:46, Kevin Wolf wrote:
> > > > > From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > > >
> > > > > All the global state (GS) API functions will check that
> > > > > qemu_in_main_thread() returns true. If not, it means
> > > > > that the safety of BQL cannot be guaranteed, and
> > > > > they need to be moved to I/O.
> > > >
> > > > I'm getting this crash:
> > > >
> > > > $ qemu-system-i386
> > > > Assertion failed: (qemu_in_main_thread()), function blk_all_next, file
> > > > block-backend.c, line 552.
> > > > Abort trap: 6
> > > >
> > > > Assertion failed: (qemu_in_main_thread()), function blk_all_next, file
> > > > block-backend.c, line 552.
> > > > qemu-system-i386 was compiled with optimization - stepping may behave
> > > > oddly; variables may not be available.
> > > > Process 76914 stopped
> > > > * thread #1, queue = 'com.apple.main-thread', stop reason = hit
> > > > program assert
> > > > frame #4: 0x000000010057c2d4 qemu-system-i386`blk_all_next.cold.1
> > > > at block-backend.c:552:5 [opt]
> > > > 549 */
> > > > 550 BlockBackend *blk_all_next(BlockBackend *blk)
> > > > 551 {
> > > > -> 552 GLOBAL_STATE_CODE();
> > > > 553 return blk ? QTAILQ_NEXT(blk, link)
> > > > 554 : QTAILQ_FIRST(&block_backends);
> > > > 555 }
> > > > Target 1: (qemu-system-i386) stopped.
> > >
> > > Forgot to paste the backtrace:
> > >
> > > (lldb) bt
> > > * thread #1, queue = 'com.apple.main-thread', stop reason = hit program
> > > assert
> > > frame #0: 0x00000001908c99b8 libsystem_kernel.dylib`__pthread_kill +
> > > 8
> > > frame #1: 0x00000001908fceb0 libsystem_pthread.dylib`pthread_kill +
> > > 288
> > > frame #2: 0x000000019083a314 libsystem_c.dylib`abort + 164
> > > frame #3: 0x000000019083972c libsystem_c.dylib`__assert_rtn + 300
> > > * frame #4: 0x000000010057c2d4 qemu-system-i386`blk_all_next.cold.1 at
> > > block-backend.c:552:5 [opt]
> > > frame #5: 0x00000001003c00b4
> > > qemu-system-i386`blk_all_next(blk=<unavailable>) at
> > > block-backend.c:552:5 [opt]
> > > frame #6: 0x00000001003d8f04
> > > qemu-system-i386`qmp_query_block(errp=0x0000000000000000) at
> > > qapi.c:591:16 [opt]
> > > frame #7: 0x000000010003ab0c qemu-system-i386`main [inlined]
> > > addRemovableDevicesMenuItems at cocoa.m:1756:21 [opt]
> > > frame #8: 0x000000010003ab04
> > > qemu-system-i386`main(argc=<unavailable>, argv=<unavailable>) at
> > > cocoa.m:1980:5 [opt]
> > > frame #9: 0x00000001012690f4 dyld`start + 520
> >
> > I think Paolo and Peter talked about this a couple of days ago on #qemu,
> > and have already found a solution if I remember correctly.
> >
> > Maybe it's worth to check with them first.
>
> Maybe this discussion?
>
> 20220307151004.578069-1-pbonzini@redhat.com/">https://lore.kernel.org/qemu-devel/20220307151004.578069-1-pbonzini@redhat.com/
Yes, this looks like the right one. Can you give Paolo's patch a try?
The problem is that the main thread didn't hold the BQL while calling
code that requires holding the BQL and that now asserts that the BQL is
held by the thread it's called from.
Kevin
- [PULL 15/50] main loop: macros to mark GS and I/O functions, (continued)
- [PULL 15/50] main loop: macros to mark GS and I/O functions, Kevin Wolf, 2022/03/04
- [PULL 10/50] os-posix: Add os_set_daemonize(), Kevin Wolf, 2022/03/04
- [PULL 12/50] qsd: Add --daemonize, Kevin Wolf, 2022/03/04
- [PULL 07/50] util/async: replace __thread with QEMU TLS macros, Kevin Wolf, 2022/03/04
- [PULL 13/50] iotests/185: Add post-READY quit tests, Kevin Wolf, 2022/03/04
- [PULL 21/50] block/block-backend.c: assertions for block-backend, Kevin Wolf, 2022/03/04
- Re: [PULL 21/50] block/block-backend.c: assertions for block-backend, Emanuele Giuseppe Esposito, 2022/03/16
[PULL 18/50] IO_CODE and IO_OR_GS_CODE for block I/O API, Kevin Wolf, 2022/03/04
[PULL 20/50] include/sysemu/block-backend: split header into I/O and global state (GS) API, Kevin Wolf, 2022/03/04
[PULL 16/50] include/block/block: split header into I/O and global state API, Kevin Wolf, 2022/03/04
[PULL 29/50] GS and IO CODE macros for blockjob_int.h, Kevin Wolf, 2022/03/04
[PULL 27/50] block: introduce assert_bdrv_graph_writable, Kevin Wolf, 2022/03/04
[PULL 26/50] IO_CODE and IO_OR_GS_CODE for block_int I/O API, Kevin Wolf, 2022/03/04
[PULL 31/50] include/block/blockjob.h: global state API, Kevin Wolf, 2022/03/04
[PULL 32/50] assertions for blockjob.h global state API, Kevin Wolf, 2022/03/04
[PULL 33/50] include/sysemu/blockdev.h: global state API, Kevin Wolf, 2022/03/04