All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Pranith Kumar <bobby.prani@gmail.com>,
	Richard Henderson <rth@twiddle.net>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] tcg/i386: Do not display HT warning for TCG
Date: Tue, 25 Apr 2017 17:04:14 -0300	[thread overview]
Message-ID: <20170425200414.GP3482@thinpad.lan.raisama.net> (raw)
In-Reply-To: <8cf1d4e9-8177-3b09-5400-cb22a929e78b@redhat.com>

On Fri, Apr 21, 2017 at 11:38:30AM +0200, Paolo Bonzini wrote:
> 
> 
> On 20/04/2017 20:42, Eduardo Habkost wrote:
> >> -smp 4,threads=4 shows 4 cores
> > This means 1 socket with 1 core, 4 threads per core. But if
> > vendor ID is AMD, guests will probably ignore the hyperthreading
> > info and treat each thread as a separate core. That's why we have
> > a warning.
> 
> I'm not sure about the "probably".  As long as the HT bit is 1 and the
> number of threads is > 1 in CPUID[EAX=1].EBX[bits 23:16], I am not sure
> why the OS would care about the vendor.
> 

On my testing, "-cpu qemu64,vendor=AuthenticAMD" and
"-cpu qemu64,vendor=GenuineIntel" gave different results on lscpu
and /proc/cpuinfo in a Fedora 25 guest (Linux 4.8.6-300.fc25).

> x86info does care (it just does not try to detect the topology for
> !Intel processors), but Linux seems not to.  detect_ht is called
> unconditionally.

I see detect_ht() inside a "#ifdef CONFIG_X86_32" in
amd_cpu_dev.c_init (init_amd()), and intel_cpudev.c_init
(init_intel()). It is inside a "#ifdef CONFIG_X86_64" in
identify_cpu(), though, so it looks like it is called at
different places, but always called.

But the logic becomes very confusing after that: the core/sibling
CPU masks are initialized based on phys_proc_id and cpu_core_id,
and detect_ht() isn't the only place where those fields are
initialized (see amd_get_topology(), amd_detect_cmp(),
detect_extended_topology()). It looks like amd_detect_cmp()
and/or amd_get_topology() will undo what detect_ht() did.

-- 
Eduardo

      reply	other threads:[~2017-04-25 20:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 19:54 [Qemu-devel] [RFC PATCH] tcg/i386: Do not display HT warning for TCG Pranith Kumar
2017-04-19 19:54 ` [Qemu-devel] [PATCH] " Pranith Kumar
2017-04-19 20:00   ` Pranith Kumar
2017-04-19 20:13     ` Eduardo Habkost
2017-04-19 20:16       ` Pranith Kumar
2017-04-19 20:57         ` Eduardo Habkost
2017-04-19 21:25           ` Pranith Kumar
2017-04-19 21:33             ` Eduardo Habkost
2017-04-19 22:03               ` Pranith Kumar
2017-04-20  2:26                 ` Eduardo Habkost
2017-04-20  4:14                   ` Pranith Kumar
2017-04-20 18:42                     ` Eduardo Habkost
2017-04-21  9:38                       ` Paolo Bonzini
2017-04-25 20:04                         ` Eduardo Habkost [this message]

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=20170425200414.GP3482@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=bobby.prani@gmail.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 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.