[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] RFC: linux-user-i386: crash on cpuid
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH] RFC: linux-user-i386: crash on cpuid |
Date: |
Fri, 16 Sep 2016 11:06:34 -0400 (EDT) |
Hi
----- Original Message -----
> >
> > -#ifndef CONFIG_USER_ONLY
> > +#ifdef CONFIG_USER_ONLY
> > + cs->nr_cores = smp_cores;
> > + cs->nr_threads = smp_threads;
> > +#else
>
> On CONFIG_USER_ONLY, smp_cores and smp_threads are defined as:
>
> /* *-user doesn't have configurable SMP topology */
> #define smp_cores 1
> #define smp_threads 1
>
> It sounds simpler to just set nr_cores and nr_threads to 1 by
> default in cpu_common_initfn(). (Preferably with a comment noting
> that the default value is changed by qemu_init_vcpu() for
> softmmu).
Any reason those define exists? It seems we could use cpu state values instead,
ex:
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2490,13 +2490,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
switch (count) {
case 0:
- *eax = apicid_core_offset(smp_cores, smp_threads);
- *ebx = smp_threads;
+ *eax = apicid_core_offset(cs->nr_cores, cs->nr_threads);
+ *ebx = cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_SMT;
break;
case 1:
- *eax = apicid_pkg_offset(smp_cores, smp_threads);
- *ebx = smp_cores * smp_threads;
+ *eax = apicid_pkg_offset(cs->nr_cores, cs->nr_threads);
+ *ebx = cs->nr_cores * cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_CORE;
break;