[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230620140625.1001886-1-longman@redhat.com>
Date: Tue, 20 Jun 2023 10:06:20 -0400
From: Waiman Long <longman@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Len Brown <lenb@...nel.org>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
linux-pm@...r.kernel.org, Robin Jarry <rjarry@...hat.com>,
Joe Mario <jmario@...hat.com>, Waiman Long <longman@...hat.com>
Subject: [PATCH v2 0/5] x86/speculation: Disable IBRS when idle
For Intel processors that need to turn on IBRS to protect against
Spectre v2 and Retbleed, the IBRS bit in the SPEC_CTRL MSR affects
the performance of the whole core even if only one thread is turning
it on when running in the kernel. For user space heavy applications,
the performance impact of occasionally turning IBRS on during syscalls
shouldn't be significant. Unfortunately, that is not the case when the
sibling thread is idling in the kernel. In that case, the performance
impact can be significant.
When DPDK is running on an isolated CPU thread processing network packets
in user space while its sibling thread is idle. The performance of the
busy DPDK thread with IBRS on and off in the sibling idle thread are:
IBRS on IBRS off
------- --------
packets/second: 7.8M 10.4M
avg tsc cycles/packet: 282.26 209.86
This is a 25% performance degradation. The test system is a Intel Xeon
4114 CPU @ 2.20GHz.
Commit bf5835bcdb96 ("intel_idle: Disable IBRS during long idle")
disables IBRS when the CPU enters long idle (C6 or below). However, there
are existing users out there who have set "intel_idle.max_cstate=1" or
even "intel_idle.max_cstate=0" to decrease latency. Those users won't be
able to benefit from this commit. This patch series extends this commit
by providing a new "intel_idle.no_ibrs" module option to force disable
IBRS even when "intel_idle.max_cstate=1" at the expense of increased IRQ
response latency. It also includes commit to allow the disabling of IBRS
with "intel_idle.max_cstate=0" as well as when a CPU becomes offline.
The first patch adds a new x86/spec_ctrl_msrs debugfs file which display
the current cached values of the SPEC_CTRL MSRs of all the CPUs. This
allows us to verify that IBRS bit is correctly turned off in idle CPUs
for various cstate values.
Waiman Long (5):
x86/speculation: Provide a debugfs file to dump SPEC_CTRL MSRs
x86/idle: Disable IBRS when cpu is offline
intel_idle: Sync up the SPEC_CTRL MSR value to x86_spec_ctrl_current
intel_idle: Add no_ibrs module parameter to force disable IBRS
x86/idle: Disable IBRS entering mwait idle and enable it on wakeup
arch/x86/include/asm/mwait.h | 17 ++++++++
arch/x86/kernel/cpu/bugs.c | 79 ++++++++++++++++++++++++++++++++++++
arch/x86/kernel/smpboot.c | 13 ++++++
drivers/idle/intel_idle.c | 22 ++++++++--
4 files changed, 127 insertions(+), 4 deletions(-)
--
2.31.1
Powered by blists - more mailing lists