All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/4] move registering of cpu_reset to inside cpu_init
Date: Wed, 06 May 2009 19:02:56 +0200	[thread overview]
Message-ID: <4A01C2C0.2000609@siemens.com> (raw)
In-Reply-To: <1241621382-21577-2-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> This is not pc specific by any means. So we can be
> moved to inside cpu_x86_init().
> 
> This is part of an attempt to only initialize kvm state
> after everything is already properly initialized. If we don't
> do that, we can race against, for example, APIC state if kvm vcpus
> are ran in threads (happens in qemu-kvm.git, soon to happen here too)
> 
> Signed-off-by: Glauber Costa <glommer@redhat.com>
> ---
>  hw/pc.c              |    7 -------
>  target-i386/helper.c |    8 ++++++++
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/pc.c b/hw/pc.c
> index 61f6e7b..351de83 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -725,12 +725,6 @@ static void load_linux(target_phys_addr_t option_rom,
>      generate_bootsect(option_rom, gpr, seg, 0);
>  }
>  
> -static void main_cpu_reset(void *opaque)
> -{
> -    CPUState *env = opaque;
> -    cpu_reset(env);
> -}
> -
>  static const int ide_iobase[2] = { 0x1f0, 0x170 };
>  static const int ide_iobase2[2] = { 0x3f6, 0x376 };
>  static const int ide_irq[2] = { 14, 15 };
> @@ -861,7 +855,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
>              /* XXX: enable it in all cases */
>              env->cpuid_features |= CPUID_APIC;
>          }
> -        qemu_register_reset(main_cpu_reset, env);
>          if (pci_enabled) {
>              apic_init(env);
>          }
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index a070e08..2210412 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -29,6 +29,7 @@
>  #include "exec-all.h"
>  #include "qemu-common.h"
>  #include "kvm.h"
> +#include "hw/hw.h"
>  
>  //#define DEBUG_MMU
>  
> @@ -507,6 +508,11 @@ void cpu_reset(CPUX86State *env)
>      cpu_watchpoint_remove_all(env, BP_CPU);
>  }
>  
> +static void main_cpu_reset(void *_env)
> +{
> +    cpu_reset((CPUState *)_env);
> +}
> +
>  void cpu_x86_close(CPUX86State *env)
>  {
>      qemu_free(env);
> @@ -1689,6 +1695,8 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
>          return NULL;
>      }
>      cpu_reset(env);
> +    qemu_register_reset(main_cpu_reset, env);
> +
>  #ifdef CONFIG_KQEMU
>      kqemu_init(env);
>  #endif

After digging through the dependencies of apic and cpu again, this looks
safe (it reorders reset execution, but that should have no side effect).

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2009-05-06 17:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 14:49 [Qemu-devel] [PATCH 0/4] Simplify cpu initialization Glauber Costa
2009-05-06 14:49 ` [Qemu-devel] [PATCH 1/4] move registering of cpu_reset to inside cpu_init Glauber Costa
2009-05-06 14:49   ` [Qemu-devel] [PATCH 2/4] move CPUID_APIC flag to where it belongs Glauber Costa
2009-05-06 14:49     ` [Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_init Glauber Costa
2009-05-06 14:49       ` [Qemu-devel] [PATCH 4/4] move apic functions to a separate apic.h header Glauber Costa
2009-05-06 15:52         ` [Qemu-devel] " Jan Kiszka
2009-05-06 16:08           ` Glauber Costa
2009-05-06 15:45       ` [Qemu-devel] Re: [PATCH 3/4] move halted state setting to inside of cpu_x86_init Jan Kiszka
2009-05-06 19:31       ` [Qemu-devel] " Blue Swirl
2009-05-06 21:42         ` Glauber Costa
2009-05-06 15:40     ` [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs Jan Kiszka
2009-05-06 15:51       ` Glauber Costa
2009-05-06 17:29         ` Stanislav
2009-05-06 17:41           ` Glauber Costa
2009-05-06 17:43             ` Stanislav
2009-05-06 18:17           ` Anthony Liguori
2009-05-06 17:02   ` Jan Kiszka [this message]
2009-05-06 19:36   ` [Qemu-devel] [PATCH 1/4] move registering of cpu_reset to inside cpu_init Blue Swirl
2009-05-06 21:45     ` Glauber Costa

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=4A01C2C0.2000609@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=glommer@redhat.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 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.