[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 1/4] move registering of cpu_reset to inside cpu
From: |
Jan Kiszka |
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 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
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 <address@hidden>
> ---
> 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
- [Qemu-devel] Re: [PATCH 4/4] move apic functions to a separate apic.h header, (continued)
- [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Jan Kiszka, 2009/05/06
- [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Glauber Costa, 2009/05/06
- RE: [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Stanislav, 2009/05/06
- Re: [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Glauber Costa, 2009/05/06
- RE: [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Stanislav, 2009/05/06
- Re: [Qemu-devel] Re: [PATCH 2/4] move CPUID_APIC flag to where it belongs, Anthony Liguori, 2009/05/06
[Qemu-devel] Re: [PATCH 1/4] move registering of cpu_reset to inside cpu_init,
Jan Kiszka <=
Re: [Qemu-devel] [PATCH 1/4] move registering of cpu_reset to inside cpu_init, Blue Swirl, 2009/05/06