Skip to contentSkip to conversation

'-usb' regressed by 49d2e648 ("machine: remove qemu_machine_opts global list")

Qemu-devel Laszlo Ersek 4 participants 6 messages Dec 23, 2014 – Dec 24, 2014

lore
Share & tools
lore
#0 lore raw

Apologies if this problem is known. After building qemu at ab0302ee:

$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

The stack is

#0  0x00007ffff1e945c9 in raise () from /lib64/libc.so.6
#1  0x00007ffff1e95cd8 in abort () from /lib64/libc.so.6
#2  0x00007ffff1e8d536 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff1e8d5e2 in __assert_fail () from /lib64/libc.so.6
#4  0x00005555559660f5 in qemu_opt_get_bool_helper (opts=0x5555562b51f0, name=0x55555598a4af "usb", defval=false, del=false) at util/qemu-option.c:387
#5  0x000055555596614d in qemu_opt_get_bool (opts=0x5555562b51f0, name=0x55555598a4af "usb", defval=false) at util/qemu-option.c:397
#6  0x0000555555715d23 in usb_enabled (default_usb=false) at vl.c:1002
#7  0x000055555568d7bc in pc_init1 (machine=0x5555562c22f0, pci_enabled=1, kvmclock_enabled=1) at hw/i386/pc_piix.c:277
#8  0x000055555568d94e in pc_init_pci (machine=0x5555562c22f0) at hw/i386/pc_piix.c:308
#9  0x000055555571e8d4 in main (argc=2, argv=0x7fffffffd1d8, envp=0x7fffffffd1f0) at vl.c:4217

Bisection fingers 49d2e648.

This is very visible with libvirt.

Thanks
Laszlo

#1 lore raw
Quoted 5 lines · Laszlo Ersek

Apologies if this problem is known. After building qemu at ab0302ee:

$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

Does this work?

util/qemu-option.c +0 -0
index a708241..4f1f86a 100644
@@ -384,7 +384,7 @@ static bool qemu_opt_get_bool_helper(QemuOpts *opts,

const char *name,

         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_BOOL);
     ret = opt->value.boolean;
     if (del) {
         qemu_opt_del_all(opts, name);
@@ -420,7 +420,7 @@ static uint64_t qemu_opt_get_number_helper(QemuOpts
*opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_NUMBER);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_NUMBER);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);
@@ -457,7 +457,7 @@ static uint64_t qemu_opt_get_size_helper(QemuOpts
*opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_SIZE);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_SIZE);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);

Paolo

#2 lore raw
Quoted 46 lines · Paolo Bonzini
Quoted 5 lines · Laszlo Ersek

Apologies if this problem is known. After building qemu at ab0302ee:

$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

Does this work?

util/qemu-option.c +1 -1
index a708241..4f1f86a 100644
@@ -384,7 +384,7 @@ static bool qemu_opt_get_bool_helper(QemuOpts *opts,
 const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_BOOL);
     ret = opt->value.boolean;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +1 -1
@@ -420,7 +420,7 @@ static uint64_t qemu_opt_get_number_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_NUMBER);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_NUMBER);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +1 -1
@@ -457,7 +457,7 @@ static uint64_t qemu_opt_get_size_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_SIZE);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_SIZE);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);
Quoted 2 lines

Paolo

Nice~

Regards,
-Gonglei

author Tested-by
#3 lore raw
In reply to Paolo Bonzini
Quoted 44 lines · Paolo Bonzini
Quoted 5 lines · Laszlo Ersek

Apologies if this problem is known. After building qemu at ab0302ee:

$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

Does this work?

util/qemu-option.c +1 -1
index a708241..4f1f86a 100644
@@ -384,7 +384,7 @@ static bool qemu_opt_get_bool_helper(QemuOpts *opts,
 const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_BOOL);
     ret = opt->value.boolean;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +1 -1
@@ -420,7 +420,7 @@ static uint64_t qemu_opt_get_number_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_NUMBER);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_NUMBER);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +1 -1
@@ -457,7 +457,7 @@ static uint64_t qemu_opt_get_size_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_SIZE);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_SIZE);
     ret = opt->value.uint;
     if (del) {
Quoted 1 line
         qemu_opt_del_all(opts, name);

Thanks!
Laszlo

#4 lore raw
Quoted 40 lines · Laszlo Ersek
Quoted 39 lines · Paolo Bonzini
Quoted 5 lines · Laszlo Ersek

Apologies if this problem is known. After building qemu at ab0302ee:

$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

Does this work?

util/qemu-option.c +1 -1
index a708241..4f1f86a 100644
@@ -384,7 +384,7 @@ static bool qemu_opt_get_bool_helper(QemuOpts *opts,
 const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_BOOL);
     ret = opt->value.boolean;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +1 -1
@@ -420,7 +420,7 @@ static uint64_t qemu_opt_get_number_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_NUMBER);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_NUMBER);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);
util/qemu-option.c +0 -0
@@ -457,7 +457,7 @@ static uint64_t qemu_opt_get_size_helper(QemuOpts
 *opts, const char *name,
         }
         return ret;
Quoted 8 lines
Quoted 6 lines
util/qemu-option.c +1 -1
     }
-    assert(opt->desc && opt->desc->type == QEMU_OPT_SIZE);
+    assert(!opt->desc || opt->desc->type == QEMU_OPT_SIZE);
     ret = opt->value.uint;
     if (del) {
         qemu_opt_del_all(opts, name);

Hmm, it doesn't work though. parse_option_bool is not called. Something for new year I guess.

Paolo

#5 lore raw
In reply to Laszlo Ersek
Quoted 1 line · Laszlo Ersek

Apologies if this problem is known. After building qemu at ab0302ee:

The problem is not known.
Thanks for finding it and testing it!
Marcel

Quoted 25 lines
$ qemu-system-x86_64 -usb

qemu-system-x86_64: util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.

The stack is

#0  0x00007ffff1e945c9 in raise () from /lib64/libc.so.6
#1  0x00007ffff1e95cd8 in abort () from /lib64/libc.so.6
#2  0x00007ffff1e8d536 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff1e8d5e2 in __assert_fail () from /lib64/libc.so.6
#4  0x00005555559660f5 in qemu_opt_get_bool_helper (opts=0x5555562b51f0, name=0x55555598a4af "usb", defval=false, del=false) at util/qemu-option.c:387
#5  0x000055555596614d in qemu_opt_get_bool (opts=0x5555562b51f0, name=0x55555598a4af "usb", defval=false) at util/qemu-option.c:397
#6  0x0000555555715d23 in usb_enabled (default_usb=false) at vl.c:1002
#7  0x000055555568d7bc in pc_init1 (machine=0x5555562c22f0, pci_enabled=1, kvmclock_enabled=1) at hw/i386/pc_piix.c:277
#8  0x000055555568d94e in pc_init_pci (machine=0x5555562c22f0) at hw/i386/pc_piix.c:308
#9  0x000055555571e8d4 in main (argc=2, argv=0x7fffffffd1d8, envp=0x7fffffffd1f0) at vl.c:4217

Bisection fingers 49d2e648.

This is very visible with libvirt.

Thanks
Laszlo