All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Waiman Long" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Waiman Long <longman@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs()
Date: Sat, 07 Oct 2023 17:10:58 -0000	[thread overview]
Message-ID: <169669865810.3135.4637182434325944599.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20230727184600.26768-4-longman@redhat.com>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     7506203089dceb1d9e1f35d37ad2e46d44798a6d
Gitweb:        https://git.kernel.org/tip/7506203089dceb1d9e1f35d37ad2e46d44798a6d
Author:        Waiman Long <longman@redhat.com>
AuthorDate:    Thu, 27 Jul 2023 14:45:59 -04:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Sat, 07 Oct 2023 11:33:28 +02:00

intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs()

When intel_idle_ibrs() is called, it modifies the SPEC_CTRL MSR to 0
in order disable IBRS. However, the new MSR value isn't reflected in
x86_spec_ctrl_current which is at odd with the other code that keep track
of its state in that percpu variable.  Use the new __update_spec_ctrl()
to have the x86_spec_ctrl_current percpu value properly updated.

Since spec-ctrl.h includes both msr.h and nospec-branch.h, we can remove
those from the include file list.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20230727184600.26768-4-longman@redhat.com
---
 drivers/idle/intel_idle.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index ea5a6a1..86ac9a4 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -53,9 +53,8 @@
 #include <linux/moduleparam.h>
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
-#include <asm/nospec-branch.h>
 #include <asm/mwait.h>
-#include <asm/msr.h>
+#include <asm/spec-ctrl.h>
 #include <asm/fpu/api.h>
 
 #define INTEL_IDLE_VERSION "0.5.1"
@@ -182,12 +181,12 @@ static __cpuidle int intel_idle_ibrs(struct cpuidle_device *dev,
 	int ret;
 
 	if (smt_active)
-		native_wrmsrl(MSR_IA32_SPEC_CTRL, 0);
+		__update_spec_ctrl(0);
 
 	ret = __intel_idle(dev, drv, index);
 
 	if (smt_active)
-		native_wrmsrl(MSR_IA32_SPEC_CTRL, spec_ctrl);
+		__update_spec_ctrl(spec_ctrl);
 
 	return ret;
 }

  parent reply	other threads:[~2023-10-07 17:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 18:45 [PATCH v6 0/4] x86/speculation: Disable IBRS when idle Waiman Long
2023-07-27 18:45 ` [PATCH v6 1/4] x86/speculation: Add __update_spec_ctrl() helper Waiman Long
2023-10-04 15:47   ` [tip: sched/core] " tip-bot2 for Waiman Long
2023-10-07 17:10   ` tip-bot2 for Waiman Long
2023-07-27 18:45 ` [PATCH v6 2/4] x86/idle: Disable IBRS when cpu is offline Waiman Long
2023-10-04 15:47   ` [tip: sched/core] x86/idle: Disable IBRS when CPU is offline to improve single-threaded performance tip-bot2 for Waiman Long
2023-10-07 17:10   ` tip-bot2 for Waiman Long
2023-07-27 18:45 ` [PATCH v6 3/4] intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs() Waiman Long
2023-10-04 15:47   ` [tip: sched/core] " tip-bot2 for Waiman Long
2023-10-07 17:10   ` tip-bot2 for Waiman Long [this message]
2023-07-27 18:46 ` [PATCH v6 4/4] intel_idle: Add ibrs_off module parameter to force disable IBRS Waiman Long
2023-10-04 15:47   ` [tip: sched/core] intel_idle: Add ibrs_off module parameter to force-disable IBRS tip-bot2 for Waiman Long
2023-10-07 17:10   ` tip-bot2 for Waiman Long
2023-08-16 20:42 ` [PATCH v6 0/4] x86/speculation: Disable IBRS when idle Waiman Long
2023-10-04 11:50 ` Ingo Molnar
2023-10-04 16:11   ` Waiman Long

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=169669865810.3135.4637182434325944599.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=torvalds@linux-foundation.org \
    --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 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.