Message ID | 20190311220843.4026-23-armbru@redhat.com |
---|---|
State | New |
Headers | show |
Series | [PULL,01/27] pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02 | expand |
Am 11.03.2019 um 23:08 hat Markus Armbruster geschrieben: > qemu-system-FOO's main() acts on command line arguments in its own > idiosyncratic order. There's not much method to its madness. > Whenever we find a case where one kind of command line argument needs > to refer to something created for another kind later, we rejigger the > order. > > Block devices get created long after machine properties get processed. > Therefore, block device machine properties can be created, but not > set. No such properties exist. But the next commit will create some. > Time to rejigger again: create block devices earlier. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Message-Id: <20190308131445.17502-8-armbru@redhat.com> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com> This commit broke qemu-iotests 055. Looks like migration_object_init() must come before configure_blockdev(). Kevin (gdb) bt #0 0x00007f7eb447853f in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f7eb4462895 in __GI_abort () at abort.c:79 #2 0x00007f7eb4462769 in __assert_fail_base (fmt=0x7f7eb45c9e90 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5589747e3e67 "current_migration", file=0x5589747e3d85 "migration/migration.c", line=187, function=<optimized out>) at assert.c:92 #3 0x00007f7eb44709f6 in __GI___assert_fail (assertion=assertion@entry=0x5589747e3e67 "current_migration", file=file@entry=0x5589747e3d85 "migration/migration.c", line=line@entry=187, function=function@entry=0x5589747e59b0 <__PRETTY_FUNCTION__.32386> "migrate_get_current") at assert.c:101 #4 0x0000558974513083 in migrate_get_current () at migration/migration.c:187 #5 0x000055897451634d in migrate_get_current () at migration/migration.c:1719 #6 0x000055897451634d in migrate_add_blocker (reason=<optimized out>, errp=errp@entry=0x7ffd901f4d10) at migration/migration.c:1715 #7 0x000055897459d941 in vmdk_open (bs=0x55897697a2c0, options=<optimized out>, flags=<optimized out>, errp=0x7ffd901f4d70) at block/vmdk.c:1019 #8 0x000055897458d466 in bdrv_open_driver (bs=bs@entry=0x55897697a2c0, drv=drv@entry=0x558974d6cfe0 <bdrv_vmdk>, node_name=<optimized out>, options=options@entry=0x55897697e560, open_flags=139266, errp=errp@entry=0x7ffd901f4e18) at block.c:1279 #9 0x0000558974590cc1 in bdrv_open_common (errp=0x7ffd901f4e18, options=0x55897697e560, file=0x5589769295a0, bs=0x55897697a2c0) at block.c:1537 #10 0x0000558974590cc1 in bdrv_open_inherit (filename=<optimized out>, filename@entry=0x558976905490 "/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img", reference=reference@entry=0x0, options=0x55897697e560, options@entry=0x5589768f4750, flags=<optimized out>, flags@entry=0, parent=parent@entry=0x0, child_role=child_role@entry=0x0, errp=0x7ffd901f50e0) at block.c:2889 #11 0x0000558974591ac1 in bdrv_open (filename=filename@entry=0x558976905490 "/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img", reference=reference@entry=0x0, options=options@entry=0x5589768f4750, flags=flags@entry=0, errp=errp@entry=0x7ffd901f50e0) at block.c:2982 #12 0x00005589745d6551 in blk_new_open (filename=filename@entry=0x558976905490 "/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img", reference=reference@entry=0x0, options=options@entry=0x5589768f4750, flags=flags@entry=0, errp=errp@entry=0x7ffd901f50e0) at block/block-backend.c:377 #13 0x000055897439f6b3 in blockdev_init (file=file@entry=0x558976905490 "/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img", bs_opts=bs_opts@entry=0x5589768f4750, errp=errp@entry=0x7ffd901f50e0) at blockdev.c:602 #14 0x00005589743a0524 in drive_new (all_opts=<optimized out>, block_default_type=<optimized out>, errp=0x558974dd6310 <error_fatal>) at blockdev.c:994 #15 0x00005589743aaba1 in drive_init_func (opaque=<optimized out>, opts=<optimized out>, errp=<optimized out>) at vl.c:1163 #16 0x000055897468db7a in qemu_opts_foreach (list=<optimized out>, func=0x5589743aab90 <drive_init_func>, opaque=0x558976869228, errp=0x558974dd6310 <error_fatal>) at util/qemu-option.c:1171 #17 0x0000558974235950 in configure_blockdev (snapshot=0, machine_class=0x558976869180, bdo_queue=0x7ffd901f5270) at vl.c:1230 #18 0x0000558974235950 in main (argc=<optimized out>, argv=0x7ffd901f53d8, envp=<optimized out>) at vl.c:4282 055 44s ... [20:21:24] [20:21:52] [failed, exit status 1] - output mismatch (see 055.out.bad) --- /home/kwolf/source/qemu/tests/qemu-iotests/055.out 2018-06-13 10:33:18.579269839 +0200 +++ /home/kwolf/source/qemu/tests/qemu-iotests/055.out.bad 2019-03-12 20:21:52.953410878 +0100 @@ -1,5 +1,83 @@ -.............................. +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmp6q0miuno/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmp6q0miuno/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmppf_qfi2k/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmppf_qfi2k/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmpsoykllpm/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +WARNING:qemu:qemu received signal 6: /home/kwolf/source/qemu/tests/qemu-iotests/qemu -chardev socket,id=mon,path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/tmpsoykllpm/qemu-4146-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/qemu-4146-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=virtio,id=drive0,file=blkdebug::/home/kwolf/source/qemu/tests/qemu-iotests/scratch/test.img,format=qcow2,cache=writeback -drive if=none,id=drive1,file=/home/kwolf/source/qemu/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback +E.E.E......................... +====================================================================== +ERROR: test_complete_compress_blockdev_backup (__main__.TestDriveCompression) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "055", line 499, in test_complete_compress_blockdev_backup + target='drive1') + File "055", line 477, in do_test_compress_complete + self.do_prepare_drives(format['type'], format['args'], attach_target) + File "055", line 474, in do_prepare_drives + self.vm.launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 303, in launch + self._launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 330, in _launch + self._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qtest.py", line 107, in _post_launch + super(QEMUQtestMachine, self)._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 274, in _post_launch + self._qmp.accept() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 157, in accept + return self.__negotiate_capabilities() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 73, in __negotiate_capabilities + raise QMPConnectError +qemu.qmp.QMPConnectError + +====================================================================== +ERROR: test_compress_cancel_blockdev_backup (__main__.TestDriveCompression) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "055", line 523, in test_compress_cancel_blockdev_backup + target='drive1') + File "055", line 502, in do_test_compress_cancel + self.do_prepare_drives(format['type'], format['args'], attach_target) + File "055", line 474, in do_prepare_drives + self.vm.launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 303, in launch + self._launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 330, in _launch + self._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qtest.py", line 107, in _post_launch + super(QEMUQtestMachine, self)._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 274, in _post_launch + self._qmp.accept() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 157, in accept + return self.__negotiate_capabilities() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 73, in __negotiate_capabilities + raise QMPConnectError +qemu.qmp.QMPConnectError + +====================================================================== +ERROR: test_compress_pause_blockdev_backup (__main__.TestDriveCompression) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "055", line 563, in test_compress_pause_blockdev_backup + target='drive1') + File "055", line 526, in do_test_compress_pause + self.do_prepare_drives(format['type'], format['args'], attach_target) + File "055", line 474, in do_prepare_drives + self.vm.launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 303, in launch + self._launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 330, in _launch + self._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qtest.py", line 107, in _post_launch + super(QEMUQtestMachine, self)._post_launch() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/__init__.py", line 274, in _post_launch + self._qmp.accept() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 157, in accept + return self.__negotiate_capabilities() + File "/home/kwolf/source/qemu/tests/qemu-iotests/../../python/qemu/qmp.py", line 73, in __negotiate_capabilities + raise QMPConnectError +qemu.qmp.QMPConnectError + ---------------------------------------------------------------------- Ran 30 tests -OK +FAILED (errors=3) Failures: 055 Failed 1 of 1 tests
Kevin Wolf <kwolf@redhat.com> writes: > Am 11.03.2019 um 23:08 hat Markus Armbruster geschrieben: >> qemu-system-FOO's main() acts on command line arguments in its own >> idiosyncratic order. There's not much method to its madness. >> Whenever we find a case where one kind of command line argument needs >> to refer to something created for another kind later, we rejigger the >> order. >> >> Block devices get created long after machine properties get processed. >> Therefore, block device machine properties can be created, but not >> set. No such properties exist. But the next commit will create some. >> Time to rejigger again: create block devices earlier. >> >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> Message-Id: <20190308131445.17502-8-armbru@redhat.com> >> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > > This commit broke qemu-iotests 055. Looks like migration_object_init() > must come before configure_blockdev(). One of the slow tests not covered by make check-block... I posted a proposed fix. Thanks!
On 3/11/19 11:08 PM, Markus Armbruster wrote: > qemu-system-FOO's main() acts on command line arguments in its own > idiosyncratic order. There's not much method to its madness. > Whenever we find a case where one kind of command line argument needs > to refer to something created for another kind later, we rejigger the > order. > > Block devices get created long after machine properties get processed. > Therefore, block device machine properties can be created, but not > set. No such properties exist. But the next commit will create some. > Time to rejigger again: create block devices earlier. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Message-Id: <20190308131445.17502-8-armbru@redhat.com> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > vl.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/vl.c b/vl.c > index c22ca447fa..e9239d55ad 100644 > --- a/vl.c > +++ b/vl.c > @@ -4274,6 +4274,13 @@ int main(int argc, char **argv, char **envp) > exit(0); > } > > + /* > + * Note: we need to create block backends before > + * machine_set_property(), so machine properties can refer to > + * them. > + */ > + configure_blockdev(&bdo_queue, machine_class, snapshot); > + > machine_opts = qemu_get_machine_opts(); > qemu_opt_foreach(machine_opts, machine_set_property, current_machine, > &error_fatal); > @@ -4400,8 +4407,6 @@ int main(int argc, char **argv, char **envp) > ram_mig_init(); > dirty_bitmap_mig_init(); > > - configure_blockdev(&bdo_queue, machine_class, snapshot); > - > qemu_opts_foreach(qemu_find_opts("mon"), > mon_init_func, NULL, &error_fatal); > > Actually, there is more problems with this. Trying to run a guest with persistent reservations fails after this patch is applied (git bisect points me to this commit). My command line is: qemu.git $ ./x86_64-softmmu/qemu-system-x86_64 \ -monitor stdio \ -object pr-manager-helper,id=pr-helper0,path=/tmp/pr-helper0.sock -drive file=/dev/mapper/crypt,file.pr-manager=pr-helper0,format=raw,if=none,id=drive-scsi0-0-0-2 \ -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=2,drive=drive-scsi0-0-0-2,id=scsi0-0-0-2 Honestly, I have no idea how to fix it, so I'm just raising this issue here. Do you want me to open a bug or something? Thanks, Michal
I apologize for the delay, got distracted. Michal Privoznik <mprivozn@redhat.com> writes: > On 5/16/19 1:43 PM, Markus Armbruster wrote: > <snip/> > >>> Actually, there is more problems with this. Trying to run a guest with >>> persistent reservations fails after this patch is applied (git bisect >>> points me to this commit). My command line is: >>> >>> qemu.git $ ./x86_64-softmmu/qemu-system-x86_64 \ >>> -monitor stdio \ >>> -object pr-manager-helper,id=pr-helper0,path=/tmp/pr-helper0.sock >>> -drive >>> file=/dev/mapper/crypt,file.pr-manager=pr-helper0,format=raw,if=none,id=drive-scsi0-0-0-2 >>> \ >>> -device >>> scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=2,drive=drive-scsi0-0-0-2,id=scsi0-0-0-2 >>> >>> Honestly, I have no idea how to fix it, so I'm just raising this issue >>> here. Do you want me to open a bug or something? >> >> Let's skip the bug filing bureaucracy and go straight to debugging. > > Agreed. > >> >> Actual and expected behavior of your reproducer, please :) >> > > Actual is that qemu fails to parse cmd line: > > > qemu-system-x86_64: -drive > file=/dev/mapper/crypt,file.pr-manager=pr-helper0,format=raw,if=none,id=drive-scsi0-0-0-2: > No persistent reservation manager with id 'pr-helper0' > > > Which obviously is not correct, because pr-helper0 is specified. > Expected result is that qemu suceeds in parsing the cmd line and > starts the guest. To test it you don't need /dev/mapper/* really, I > mean, if qemu fails with a different error message (e.g. it can't open > the disk or EPERM or whatever), it's a sign it got past the cmd line > parsing successfuly. Reproduced, thanks! Here's what happens. Our general problem is that qemu-system-FOO's main() acts on command line arguments in its own idiosyncratic order. There's not much method to its madness. Whenever we find a case where one kind of command line argument needs to refer to something created for another kind later, we rejigger the order. Some time back, Dan Berrangé ran into an "impossible" instance of this general problem: some kinds of -object get referenced by certain character devices (therefore, -object must be acted on before character devices), but other kinds of -object reference other character devices (therefore, -object must be acted on after character devices). He solved the problem by sorting the -object into two buckets (commit f08f9271bfe): * Normal ones are created pretty early, so they can be referenced by (most) other things. * Delayed ones are created pretty late, so they can reference (most) other things. The pr-manager-helper object is a delayed one (commit 7c9e527659c). Worked because block backends got created even after delayed objects: qemu_opts_foreach(qemu_find_opts("object"), user_creatable_add_opts_foreach, object_create_initial, &error_fatal); [...] qemu_opts_foreach(qemu_find_opts("object"), user_creatable_add_opts_foreach, object_create_delayed, &error_fatal); [...] configure_blockdev(&bdo_queue, machine_class, snapshot); Commit cda4aa9a5a0 moved the configure_blockdev() up: qemu_opts_foreach(qemu_find_opts("object"), user_creatable_add_opts_foreach, object_create_initial, &error_fatal); [...] /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to * them. */ configure_blockdev(&bdo_queue, machine_class, snapshot); [...] qemu_opts_foreach(qemu_find_opts("object"), user_creatable_add_opts_foreach, object_create_delayed, &error_fatal); Now file-posix property "pr-manager" can no longer reference a pr-manager-helper object. Regression. If I make pr-manager-helper a normal object, it again can reference it. Paolo, why is pr-manager-helper a delayed object? Why this hunk of commit 7c9e527659c: diff --git a/vl.c b/vl.c index 9bb5058c3a..a121a65731 100644 --- a/vl.c +++ b/vl.c @@ -2893,7 +2893,8 @@ static int machine_set_property(void *opaque, */ static bool object_create_initial(const char *type) { - if (g_str_equal(type, "rng-egd")) { + if (g_str_equal(type, "rng-egd") || + g_str_has_prefix(type, "pr-manager-")) { return false; }
On 03/06/19 19:40, Markus Armbruster wrote: > > Paolo, why is pr-manager-helper a delayed object? Why this hunk of > commit 7c9e527659c: > > diff --git a/vl.c b/vl.c > index 9bb5058c3a..a121a65731 100644 > --- a/vl.c > +++ b/vl.c > @@ -2893,7 +2893,8 @@ static int machine_set_property(void *opaque, > */ > static bool object_create_initial(const char *type) > { > - if (g_str_equal(type, "rng-egd")) { > + if (g_str_equal(type, "rng-egd") || > + g_str_has_prefix(type, "pr-manager-")) { > return false; > } > I don't think there was any particular reason. Change it back to normal, I can send a pull request today for that. Paolo
diff --git a/vl.c b/vl.c index c22ca447fa..e9239d55ad 100644 --- a/vl.c +++ b/vl.c @@ -4274,6 +4274,13 @@ int main(int argc, char **argv, char **envp) exit(0); } + /* + * Note: we need to create block backends before + * machine_set_property(), so machine properties can refer to + * them. + */ + configure_blockdev(&bdo_queue, machine_class, snapshot); + machine_opts = qemu_get_machine_opts(); qemu_opt_foreach(machine_opts, machine_set_property, current_machine, &error_fatal); @@ -4400,8 +4407,6 @@ int main(int argc, char **argv, char **envp) ram_mig_init(); dirty_bitmap_mig_init(); - configure_blockdev(&bdo_queue, machine_class, snapshot); - qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, &error_fatal);