qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: Stefan Weil <weil@mail.berlios.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Fix duplicate device reset
Date: Tue, 19 Jul 2011 11:39:10 +0900	[thread overview]
Message-ID: <20110719023910.GC25737@valinux.co.jp> (raw)
In-Reply-To: <1311020546-9769-1-git-send-email-weil@mail.berlios.de>

Thank you for addressing this. Similar patches were proposed and
weren't merged unfortunately.

The reason why the qdev_register_reset() in vl.c is to keep the reset order.
The reset for main_system_bus shouldn't registered by qbus_create_inplace().
But the check, bus != main_system_bus, doesn't work as intended because
main_system_bus is NULL in early qdev creation.
So there are possible ways for the fix.

- Don't care the reset order
  your patch +
  remove "if (bus != main_system_bus)" in qbus_create_inplace()

- keep the reset order
  - instantiate main_system_bus early.
    So the check, bus != main_system_bus in qbus_create_inplace(), will work.
  or
  - fix the check, bus != main_system_bus in qbus_create_inplace(), somehow

thanks,

On Mon, Jul 18, 2011 at 10:22:26PM +0200, Stefan Weil wrote:
> qbus_reset_all_fn was registered twice, so a lot of device reset
> functions were also called twice when QEMU started.
> 
> It is sufficient to call sysbus_get_default() which will
> register qbus_reset_all_fn.
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  vl.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index fcd7395..fb2f6db 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3301,7 +3301,7 @@ int main(int argc, char **argv, char **envp)
>  
>      /* TODO: once all bus devices are qdevified, this should be done
>       * when bus is created by qdev.c */
> -    qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
> +    sysbus_get_default();
>      qemu_run_machine_init_done_notifiers();
>  
>      qemu_system_reset(VMRESET_SILENT);
> -- 
> 1.7.2.5
> 

-- 
yamahata

  reply	other threads:[~2011-07-19  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 20:22 [Qemu-devel] [PATCH] Fix duplicate device reset Stefan Weil
2011-07-19  2:39 ` Isaku Yamahata [this message]
2011-07-19  5:56   ` Stefan Weil
2011-07-19  7:22     ` Isaku Yamahata
2011-08-01 11:00       ` Isaku Yamahata
2011-08-01 20:45         ` Stefan Weil

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=20110719023910.GC25737@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=qemu-devel@nongnu.org \
    --cc=weil@mail.berlios.de \
    /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).