qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gonglei <arei.gonglei@huawei.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
	"dvaleev@suse.de" <dvaleev@suse.de>,
	Alexander Graf <agraf@suse.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/2] bootdevice: add check in restore_boot_order()
Date: Tue, 3 Feb 2015 09:47:11 +0800	[thread overview]
Message-ID: <54D0289F.2080601@huawei.com> (raw)
In-Reply-To: <87egq8irhy.fsf@blackfin.pond.sub.org>

On 2015/2/2 17:37, Markus Armbruster wrote:

> Gonglei <arei.gonglei@huawei.com> writes:
> 
>> On 2015/1/30 20:32, Markus Armbruster wrote:
>>
>>> Gonglei <arei.gonglei@huawei.com> writes:
>>>
>>>> On 2015/1/30 20:01, Markus Armbruster wrote:
>>>>
>>>>> Gonglei <arei.gonglei@huawei.com> writes:
>>>>>
>>>>>> On 2015/1/30 15:46, Markus Armbruster wrote:
>>>>>>
>>>>>>> Gonglei <arei.gonglei@huawei.com> writes:
>>>>>>>
>>>>>>>> On 2015/1/30 0:03, Alexander Graf wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 29.01.15 14:29, arei.gonglei@huawei.com wrote:
>>>>>>>>>> From: Gonglei <arei.gonglei@huawei.com>
>>>>>>>>>>
>>>>>>>>>> If boot order is invaild or is set failed,
>>>>>>>>>> exit qemu.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>>>>>>>>>
>>>>>>>>> Do we really want to kill the machine only because the boot device
>>>>>>>>> string doesn't validate?
>>>>>>>>>
>>>>>>>>
>>>>>>>> Not all of the situation. If people want to change boot order by qmp/hmp
>>>>>>>> command, it just report an error, please see do_boot_set(). But
>>>>>>>> if the boot
>>>>>>>> order is set in qemu command line, it will exit qemu if the boot
>>>>>>>> device string
>>>>>>>> is invalidate, as this patch's situation, which follow the original
>>>>>>>> processing
>>>>>>>> way (commit ef3adf68).
>>>>>>>
>>>>>>> I think Alex isn't concerned about the monitor command, but what happens
>>>>>>> when boot order "once" is reset to "order" on system reset.
>>>>>>>
>>>>>>> -boot errors should have been detected during command line processing
>>>>>>> (strongly preferred) or initial startup (acceptable).  Detecting
>>>>>>
>>>>>> Yes, and it had done it just like that, please see main() of
>>>>>> vl.c. So, actually
>>>>>> it wouldn't fail in the check of restore_boot_order function's calling.
>>>>>> The only possible fails will happen to call boot_set_handler(). Take
>>>>>> x86 pc machine example, set_boot_dev() callback  may return errors.
>>>>>
>>>>> I don't like unreachable error messages.  If qemu_boot_set() can't fail
>>>>> in restore_boot_order(), then simply assert it doesn't fail, by passing
>>>>> &error_abort.
>>>>>
>>>>
>>>> Sorry, I meant the validate_bootdevices() can't fail in restore_boot_order(),
>>>> but boot_set_handler(boot_set_opaque, boot_order, errp) may fail, such as
>>>> set_boot_dev(). For example:
>>>> x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 4096 -boot
>>>> menu=on,order=nbcdep,once=c -monitor stdio -vnc :0
>>>> QEMU 2.2.50 monitor - type 'help' for more information
>>>> (qemu) system_reset
>>>> (qemu) qemu-system-x86_64: Too many boot devices for PC
>>>
>>> The value of parameter order should be checked "during command line
>>> processing (strongly preferred) or initial startup (acceptable)" if at
>>> all possible.  Is it possible?
>>
>> Either 'once' option or 'order' option can take effect for -boot at
>> the same time,
>> that is say initial startup processing can check only one. Besides,
>> the check is just for
>> corresponding machine type, so command line processing also can't do it.
> 
> I challenge your idea that we can't check this before the guest starts
> running.
> 
> qemu_boot_set() can fail for two reasons:

There is a third reason that boot_set_handler is not null, but fails in really executing time.
You can see my above example about function set_boot_dev(), the handler of
pc machine.

> 
> * validate_bootdevices() fails
> 
>   Should never happen, because we've called it in main() already,
>   treating failure as fatal error.

Yes.

> 

> * boot_set_handler is null
> 
>   MachineClass method init() may set this.  main() could *easily* test
>   whether it did!  If it didn't, and -boot once is given, error out.
>   Similar checks exist already, e.g. drive_check_orphaned(),
>   net_check_clients().  They only warn, but that's detail.

I agree, just need to report the error message.

Regards,
-Gonglei

  reply	other threads:[~2015-02-03  1:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 13:29 [Qemu-devel] [PATCH 0/2] bootdevice: two little changes arei.gonglei
2015-01-29 13:29 ` [Qemu-devel] [PATCH 1/2] bootdevice: remove the check about boot_set_handler arei.gonglei
2015-01-29 16:03   ` Alexander Graf
2015-01-29 13:29 ` [Qemu-devel] [PATCH 2/2] bootdevice: add check in restore_boot_order() arei.gonglei
2015-01-29 16:03   ` Alexander Graf
2015-01-30  0:47     ` Gonglei
2015-01-30  7:46       ` Markus Armbruster
2015-01-30  8:20         ` Gonglei
2015-01-30 12:01           ` Markus Armbruster
2015-01-30 12:10             ` Gonglei
2015-01-30 12:32               ` Markus Armbruster
2015-01-30 12:43                 ` Gonglei
2015-02-02  9:37                   ` Markus Armbruster
2015-02-03  1:47                     ` Gonglei [this message]
2015-02-03  7:49                       ` Markus Armbruster
2015-02-03  8:52                         ` Gonglei

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=54D0289F.2080601@huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=dvaleev@suse.de \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).