mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Joe Mario <jmario@redhat.com>, Jiri Kosina <jikos@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	kvm@vger.kernel.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PATCH] cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM
Date: Tue, 29 Jan 2019 14:37:35 -0600	[thread overview]
Message-ID: <20190129203734.zzhw2koob4hdrrr7@treble> (raw)
In-Reply-To: <92bb3175ad0fa9200baae41707ad39a56c05732d.1548694307.git.jpoimboe@redhat.com>

On Mon, Jan 28, 2019 at 10:52:56AM -0600, Josh Poimboeuf wrote:
> With the following commit:
> 
>   73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
> 
> ... the hotplug code attempted to detect when SMT was disabled by BIOS,
> in which case it reported SMT as permanently disabled.  However, that
> code broke a virt hotplug scenario, where the guest is booted with only
> primary CPU threads, and a sibling is brought online later.
> 
> The problem is that there doesn't seem to be a way to reliably
> distinguish between the HW "SMT disabled by BIOS" case and the virt
> "sibling not yet brought online" case.  So the above-mentioned commit
> was a bit misguided, as it permanently disabled SMT for both cases,
> preventing future virt sibling hotplugs.
> 
> Going back and reviewing the original problems which were attempted to
> be solved by that commit, when SMT was disabled in BIOS:
> 
>   1) /sys/devices/system/cpu/smt/control showed "on" instead of
>      "notsupported"; and
> 
>   2) vmx_vm_init() was incorrectly showing the L1TF_MSG_SMT warning.
> 
> I'd propose that we instead consider #1 above to not actually be a
> problem.  Because, at least in the virt case, it's possible that SMT
> wasn't disabled by BIOS and a sibling thread could be brought online
> later.  So it makes sense to just always default the smt control to "on"
> to allow for that possibility (assuming cpuid indicates that the CPU
> supports SMT).
> 
> The real problem is #2, which has a simple fix: change vmx_vm_init() to
> query the actual current SMT state -- i.e., whether any siblings are
> currently online -- instead of looking at the SMT "control" sysfs value.
> 
> So fix it by:
> 
>   a) reverting the original "fix" and its followup fix:
> 
>      73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
>      bc2d8d262cba ("cpu/hotplug: Fix SMT supported evaluation")
> 
>      and
> 
>   b) changing vmx_vm_init() to query the actual current SMT state --
>      instead of the sysfs control value -- to determine whether the L1TF
>      warning is needed.
> 
> Fixes: 73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
> Reported-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

NACK - Need to export "sched_smt_present" so KVM can call
sched_smt_active().

-- 
Josh

  reply	other threads:[~2019-01-29 20:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 16:52 Josh Poimboeuf
2019-01-29 20:37 ` Josh Poimboeuf [this message]
2019-01-29 21:13   ` Thomas Gleixner

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=20190129203734.zzhw2koob4hdrrr7@treble \
    --to=jpoimboe@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jmario@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®