From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ0mw-0007NX-87 for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:18:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ0ms-0006YE-Pi for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:18:42 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:37635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ0ms-0006XZ-E0 for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:18:38 -0500 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Feb 2015 14:18:34 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 981811B0804B for ; Wed, 4 Feb 2015 14:18:38 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t14EIVEx12386690 for ; Wed, 4 Feb 2015 14:18:31 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t14EITV9004982 for ; Wed, 4 Feb 2015 07:18:31 -0700 Message-ID: <54D22A35.4050403@de.ibm.com> Date: Wed, 04 Feb 2015 15:18:29 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1420456961-19631-1-git-send-email-stefanha@redhat.com> <54AA7791.9060705@siemens.com> <54CC9F01.60305@web.de> <54CF4B42.4050008@redhat.com> In-Reply-To: <54CF4B42.4050008@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl.c: fix -usb option assertion failure in qemu_opt_get_bool_helper() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , Jan Kiszka , Stefan Hajnoczi , qemu-devel@nongnu.org, Marcel Apfelbaum Cc: Peter Maydell , plucinski.mariusz@gmail.com, Tiejun Chen Am 02.02.2015 um 11:02 schrieb Marcel Apfelbaum: > On 01/31/2015 11:23 AM, Jan Kiszka wrote: >> On 2015-01-05 12:37, Jan Kiszka wrote: >>> On 2015-01-05 12:22, Stefan Hajnoczi wrote: >>>> Commit 49d2e648e8087d154d8bf8b91f27c8e05e79d5a6 ("machine: remove >>>> qemu_machine_opts global list") removed option descriptions from the >>>> -machine QemuOptsList to avoid repeating MachineState's QOM properties. >>>> >>>> This change broke vl.c:usb_enabled() because qemu_opt_get_bool() cannot >>>> be used on QemuOptsList without option descriptions since QemuOpts >>>> doesn't know the type and therefore left an unparsed string value. >>>> >>>> This patch avoids calling qemu_opt_get_bool() to fix the assertion >>>> failure: >>>> >>>> $ qemu-system-x86_64 -usb >>>> qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed. >>>> >>>> Test the presence of -usb using qemu_opt_find() but use the >>>> MachineState->usb field instead of qemu_opt_get_bool(). >>>> >>>> Cc: Marcel Apfelbaum >>>> Cc: Tiejun Chen >>>> Signed-off-by: Stefan Hajnoczi >>>> --- >>>> vl.c | 7 +++++-- >>>> 1 file changed, 5 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/vl.c b/vl.c >>>> index bea9656..6e8889c 100644 >>>> --- a/vl.c >>>> +++ b/vl.c >>>> @@ -999,8 +999,11 @@ static int parse_name(QemuOpts *opts, void *opaque) >>>> >>>> bool usb_enabled(bool default_usb) >>>> { >>>> - return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", >>>> - has_defaults && default_usb); >>>> + if (qemu_opt_find(qemu_get_machine_opts(), "usb")) { >>>> + return current_machine->usb; >>>> + } else { >>>> + return has_defaults && default_usb; >>>> + } >>>> } >>>> >>>> #ifndef _WIN32 >>>> >>> >>> That still leaves the other boolean machine options broken. A generic >>> fix would be good. Or revert the original commit until we have one. >> >> Just pulled current master, and at least the iommu machine option is >> still triggering an abort. >> >> What is the status of fixing these fallouts? Was anything else addressed >> by now, just this one forgotten? > No, is not forgotten. I waited to see that the approach to fix this issue > is accepted by the reviewers. > > Thanks for the reminder, patches will be submitted soon. > Marcel Anything to look at a branch or something? Adding new machine bool options is currently pretty hard - as long as it doesnt work ;-) Christian