All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [patch V8 09/15] SSB 9
Date: Mon, 30 Apr 2018 18:25:52 -0700	[thread overview]
Message-ID: <5ae99b98-2837-edc1-90e3-9e553765d1d4@linux.intel.com> (raw)
In-Reply-To: <20180430151232.528270696@linutronix.de>


[-- Attachment #1.1: Type: text/plain, Size: 1991 bytes --]

On 04/30/2018 08:04 AM, speck for Thomas Gleixner wrote:

> 
> void x86_set_spec_ctrl(u64 val)
> {
>-	if (val & ~(SPEC_CTRL_IBRS | SPEC_CTRL_RDS))
>+	if (val & x86_spec_ctrl_mask)
> 		WARN_ONCE(1, "SPEC_CTRL MSR value 0x%16llx is unknown.\n", val);
> 	else
> 		wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base | val);
>@@ -459,6 +465,7 @@ static enum ssb_mitigation_cmd __init __
> 		switch (boot_cpu_data.x86_vendor) {
> 		case X86_VENDOR_INTEL:
> 			x86_spec_ctrl_base |= SPEC_CTRL_RDS;
>+			x86_spec_ctrl_mask &= ~(SPEC_CTRL_RDS);
> 			x86_set_spec_ctrl(SPEC_CTRL_RDS);

We only have cpu 0's RDS set when we ask for SSB to be turned off for whole system
in current v8 patchset.

I noticed that the x86_set_spec_ctrl call in
init_intel got dropped in current patchset.  It was in Konrad's original patchset.

Now only cpu 0 got RDS set in the code above and not the other CPUs when we are
asking for RDS to be turned on for whole system.

root@otc-cfl-s-02:~# cat /sys/devices/system/cpu/vulnerabilities/spec_store_bypass 
Mitigation: Speculative Store Bypass disabled

root@otc-cfl-s-02:~/md_test# ./md_dump
msr 0x48 cpu 0  val: 4
msr 0x48 cpu 1  val: 0
msr 0x48 cpu 2  val: 0
msr 0x48 cpu 3  val: 0
msr 0x48 cpu 4  val: 0
msr 0x48 cpu 5  val: 0
msr 0x48 cpu 6  val: 0
msr 0x48 cpu 7  val: 0
msr 0x48 cpu 8  val: 0
msr 0x48 cpu 9  val: 0
msr 0x48 cpu 10  val: 0
msr 0x48 cpu 11  val: 0

We should get val: 4 for all CPUs.

With the proposed fix below, I get the expected value of 4 for all CPU.

Tim

---

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index ef3f9c0..c799e48 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -770,6 +770,9 @@ static void init_intel(struct cpuinfo_x86 *c)
 	init_intel_energy_perf(c);
 
 	init_intel_misc_features(c);
+
+	if (cpu_has(c, X86_FEATURE_SPEC_STORE_BYPASS_DISABLE))
+		x86_set_spec_ctrl(SPEC_CTRL_RDS);
 }
 
 #ifdef CONFIG_X86_32

  reply	other threads:[~2018-05-01  1:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 15:04 [patch V8 00/15] SSB 0 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 01/15] SSB 1 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 02/15] SSB 2 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 03/15] SSB 3 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 04/15] SSB 4 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 05/15] SSB 5 Thomas Gleixner
2018-04-30 18:53   ` [MODERATED] " Andi Kleen
2018-04-30 20:57   ` Tim Chen
2018-04-30 23:12     ` Tim Chen
2018-04-30 15:04 ` [patch V8 06/15] SSB 6 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 07/15] SSB 7 Thomas Gleixner
2018-04-30 18:59   ` [MODERATED] " Andi Kleen
2018-04-30 15:04 ` [patch V8 08/15] SSB 8 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 09/15] SSB 9 Thomas Gleixner
2018-05-01  1:25   ` Tim Chen [this message]
2018-05-01  2:15     ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-01  2:26       ` Tim Chen
2018-05-01 13:11       ` Thomas Gleixner
2018-05-01  7:58     ` Thomas Gleixner
2018-05-01  9:49       ` Thomas Gleixner
2018-05-01 10:11         ` Thomas Gleixner
2018-04-30 15:04 ` [patch V8 10/15] SSB 10 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 11/15] SSB 11 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 12/15] SSB 12 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 13/15] SSB 13 Thomas Gleixner
2018-04-30 20:12   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-04-30 20:26     ` Thomas Gleixner
2018-04-30 21:03       ` [MODERATED] " Kees Cook
2018-04-30 21:05         ` Linus Torvalds
2018-04-30 21:25           ` Thomas Gleixner
2018-04-30 21:51   ` [MODERATED] " Kees Cook
2018-05-01  8:06     ` Thomas Gleixner
2018-05-01 13:29       ` Thomas Gleixner
2018-04-30 15:04 ` [patch V8 14/15] SSB 14 Thomas Gleixner
2018-04-30 15:04 ` [patch V8 15/15] SSB 15 Thomas Gleixner
2018-04-30 22:15   ` [MODERATED] " Kees Cook
2018-05-01  0:34     ` Andi Kleen
2018-05-01 13:15       ` Thomas Gleixner
2018-05-01 17:45         ` [MODERATED] " Jon Masters
2018-05-01 21:45     ` Thomas Gleixner
2018-05-01  2:32   ` [MODERATED] " Tim Chen
2018-05-01  8:02     ` 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=5ae99b98-2837-edc1-90e3-9e553765d1d4@linux.intel.com \
    --to=tim.c.chen@linux.intel.com \
    --cc=speck@linutronix.de \
    /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.