All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Jan Kiszka <jan.kiszka@web.de>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org, Marcel Apfelbaum <marcel.a@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	plucinski.mariusz@gmail.com, Tiejun Chen <tiejun.chen@intel.com>
Subject: Re: [Qemu-devel] [PATCH] vl.c: fix -usb option assertion failure in qemu_opt_get_bool_helper()
Date: Wed, 04 Feb 2015 16:27:05 +0200	[thread overview]
Message-ID: <54D22C39.3060400@redhat.com> (raw)
In-Reply-To: <54D22A35.4050403@de.ibm.com>

On 02/04/2015 04:18 PM, Christian Borntraeger wrote:
> 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 <marcel.a@redhat.com>
>>>>> Cc: Tiejun Chen <tiejun.chen@intel.com>
>>>>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>>>>> ---
>>>>>    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 ;-)
It will be ready today or tomorrow :)

Thanks,
Marcel
>
> Christian
>

      reply	other threads:[~2015-02-04 14:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 11:22 [Qemu-devel] [PATCH] vl.c: fix -usb option assertion failure in qemu_opt_get_bool_helper() Stefan Hajnoczi
2015-01-05 11:37 ` Jan Kiszka
2015-01-05 11:50   ` Stefan Hajnoczi
2015-01-05 12:14     ` Marcel Apfelbaum
2015-01-05 18:18       ` Laszlo Ersek
2015-01-06  2:37       ` Chen, Tiejun
2015-01-06  6:20         ` Shannon Zhao
2015-01-06  9:01           ` Chen, Tiejun
2015-01-06 16:53             ` Marcel Apfelbaum
2015-01-06 14:58         ` Stefan Hajnoczi
2015-01-31  9:23   ` Jan Kiszka
2015-02-02 10:02     ` Marcel Apfelbaum
2015-02-04 14:18       ` Christian Borntraeger
2015-02-04 14:27         ` Marcel Apfelbaum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D22C39.3060400@redhat.com \
    --to=marcel@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=jan.kiszka@web.de \
    --cc=marcel.a@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=plucinski.mariusz@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=tiejun.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.