qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <mlureau@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, pbonzini@redhat.com, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] RFC: linux-user-i386: crash on cpuid
Date: Fri, 16 Sep 2016 11:06:34 -0400 (EDT)	[thread overview]
Message-ID: <1077308097.1320619.1474038394482.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160916145637.GL6002@thinpad.lan.raisama.net>

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;

  parent reply	other threads:[~2016-09-16 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 14:41 [Qemu-devel] [PATCH] RFC: linux-user-i386: crash on cpuid Marc-André Lureau
2016-09-16 14:56 ` Eduardo Habkost
2016-09-16 14:59   ` Marc-André Lureau
2016-09-16 15:06   ` Marc-André Lureau [this message]
2016-09-16 16:52     ` Eduardo Habkost

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=1077308097.1320619.1474038394482.JavaMail.zimbra@redhat.com \
    --to=mlureau@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).