qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gonglei <arei.gonglei@huawei.com>
To: Alexander Graf <agraf@suse.de>
Cc: Dinar Valeev <dvaleev@suse.com>, Dinar Valeev <dvaleev@suse.de>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"armbru@redhat.com" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] bootdevice: update boot_order in MachineState
Date: Thu, 29 Jan 2015 19:08:46 +0800	[thread overview]
Message-ID: <54CA14BE.2080004@huawei.com> (raw)
In-Reply-To: <54CA1186.7060907@suse.de>

On 2015/1/29 18:55, Alexander Graf wrote:

> 
> 
> On 28.01.15 02:48, Gonglei wrote:
>> On 2015/1/27 18:49, Dinar Valeev wrote:
>>
>>> On 01/27/2015 10:18 AM, Gonglei wrote:
>>>> On 2015/1/27 16:57, Dinar Valeev wrote:
>>>>
>>>>> On 01/27/2015 03:51 AM, Gonglei wrote:
>>>>>> On 2015/1/27 7:52, dvaleev@suse.de wrote:
>>>>>>
>>>>>>> From: Dinar Valeev <dvaleev@suse.com>
>>>>>>>
>>>>>>> on sPAPR we need to update boot_order in MachineState in case it
>>>>>>> got changed on reset.
>>>>>>>
>>>>>>> Signed-off-by: Dinar Valeev <dvaleev@suse.com>
>>>>>>> ---
>>>>>>>  bootdevice.c | 3 +++
>>>>>>>  1 file changed, 3 insertions(+)
>>>>>>>
>>>>>>> diff --git a/bootdevice.c b/bootdevice.c
>>>>>>> index 5914417..4f11a06 100644
>>>>>>> --- a/bootdevice.c
>>>>>>> +++ b/bootdevice.c
>>>>>>> @@ -26,6 +26,7 @@
>>>>>>>  #include "qapi/visitor.h"
>>>>>>>  #include "qemu/error-report.h"
>>>>>>>  #include "hw/hw.h"
>>>>>>> +#include "hw/boards.h"
>>>>>>>  
>>>>>>>  typedef struct FWBootEntry FWBootEntry;
>>>>>>>  
>>>>>>> @@ -50,6 +51,8 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque)
>>>>>>>  void qemu_boot_set(const char *boot_order, Error **errp)
>>>>>>>  {
>>>>>>>      Error *local_err = NULL;
>>>>>>> +    MachineState *machine = MACHINE(qdev_get_machine());
>>>>>>> +    machine->boot_order = boot_order;
>>>>>>>  
>>>>>>>      if (!boot_set_handler) {
>>>>>>>          error_setg(errp, "no function defined to set boot device list for"
>>>>>>
>>>>>> Have you registered boot set handler on ppc/sPAPR platform by calling
>>>>>> qemu_register_boot_set()? Otherwise qemu_boot_set function
>>>>>>  will return error.
>>>>> No, I set boot_order on each machine reset. My tests are showing it works without an error.
>>>>
>>>> That's interesting. Does this function be called?
>>> Yes, then simply returns.
>>>> Would you debug it by setting a breakpoint ?
>>> I added a trace event.
>>>      if (!boot_set_handler) {
>>> +        trace_qemu_boot_set(boot_order);
>>>          error_setg(errp, "no function defined to set boot device list for"
>>>                           " this architecture");
>>>          return;
>>>
>>> And I see this now in qemu's monitor. Still I don't see error message.
>>
>> That's because NULL is passed to this function in restore_boot_order()
>> the error is ignored (commit f183993). I have seen the previous conversation
>> about your patch serials. And I think this is the reason which
>> you moved machine->boot_order = boot_order before
>> checking boot_set_handler variable based on Alexander's
>> suggestion, right? But I think this is not a good idea.
> 
> Why is it not a good idea? The check is only checking whether there are
> callbacks. The boot order changes nevertheless.
> 

I mean we can't simply ignore this error. If you don't use boot_set_handler
but machine->boot_order then the check should not report error.

Something like this:

diff --git a/bootdevice.c b/bootdevice.c
index c3a010c..98ed2d2 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -51,19 +51,15 @@ void qemu_boot_set(const char *boot_order, Error **errp)
 {
     Error *local_err = NULL;

-    if (!boot_set_handler) {
-        error_setg(errp, "no function defined to set boot device list for"
-                         " this architecture");
-        return;
-    }
-
     validate_bootdevices(boot_order, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
     }

-    boot_set_handler(boot_set_opaque, boot_order, errp);
+    if (boot_set_handler) {
+        boot_set_handler(boot_set_opaque, boot_order, errp);
+    }
 }

 void validate_bootdevices(const char *devices, Error **errp)

Regards,
-Gonglei

  reply	other threads:[~2015-01-29 11:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 23:52 [Qemu-devel] Update boot_order on reset for sPAPR dvaleev
2015-01-26 23:52 ` [Qemu-devel] [PATCH 1/2] sPAPR: reread boot_device on reset dvaleev
2015-01-26 23:52 ` [Qemu-devel] [PATCH 2/2] bootdevice: update boot_order in MachineState dvaleev
2015-01-27  2:51   ` Gonglei
2015-01-27  8:57     ` Dinar Valeev
2015-01-27  9:18       ` Gonglei
2015-01-27  9:56         ` Dinar Valeev
2015-01-27 10:49         ` Dinar Valeev
2015-01-28  1:48           ` Gonglei
2015-01-28 22:22             ` Dinar Valeev
2015-01-29  0:41               ` Gonglei
2015-01-29  7:48               ` Markus Armbruster
2015-01-29 10:53                 ` Alexander Graf
2015-01-29 10:55             ` Alexander Graf
2015-01-29 11:08               ` Gonglei [this message]
2015-01-29 11:11                 ` Alexander Graf
2015-01-27  2:31 ` [Qemu-devel] Update boot_order on reset for sPAPR Alexey Kardashevskiy

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=54CA14BE.2080004@huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=dvaleev@suse.com \
    --cc=dvaleev@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).