mbox series

[v1,0/4] x86: Remove direct use of MSR_IA32_ENERGY_PERF_BIAS

Message ID 20201029190259.3476-1-bp@alien8.de
Headers show
Series x86: Remove direct use of MSR_IA32_ENERGY_PERF_BIAS | expand

Message

Borislav Petkov Oct. 29, 2020, 7:02 p.m. UTC
From: Borislav Petkov <bp@suse.de>

Hi,

here's v2 with some of Shuah's comments integrated.

If no one has anything against it, I'll route them all through tip.

Thx.

---
Changelog:

v0:
--

here's something from my todo list: remove all in-kernel tools use of
that MSR and lastly drop it from the allowed-MSRs-list in the filtering.

Out-of-tree tools should do a similar, trivial conversion.

Constructive comments are, as always, appreciated.

Borislav Petkov (4):
  tools/power/cpupower: Read energy_perf_bias from sysfs
  tools/power/turbostat: Read energy_perf_bias from sysfs
  tools/power/x86_energy_perf_policy: Read energy_perf_bias from sysfs
  x86/msr: Do not allow writes to MSR_IA32_ENERGY_PERF_BIAS

 arch/x86/kernel/msr.c                         |   3 -
 tools/power/cpupower/lib/cpupower.c           |  23 +++-
 tools/power/cpupower/lib/cpupower_intern.h    |   5 +
 tools/power/cpupower/utils/cpupower-info.c    |   2 +-
 tools/power/cpupower/utils/cpupower-set.c     |   2 +-
 tools/power/cpupower/utils/helpers/helpers.h  |   8 +-
 tools/power/cpupower/utils/helpers/misc.c     |  48 ++++++++
 tools/power/cpupower/utils/helpers/msr.c      |  28 -----
 tools/power/x86/turbostat/turbostat.c         |  29 ++++-
 .../x86_energy_perf_policy.c                  | 109 ++++++++++++++++--
 10 files changed, 204 insertions(+), 53 deletions(-)

Comments

Shuah Khan Oct. 30, 2020, 5:12 p.m. UTC | #1
On 10/29/20 1:02 PM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>

> 

> Now that all in-kernel-tree users are converted to using the sysfs file,

> remove the MSR from the "allowlist".

> 

> Signed-off-by: Borislav Petkov <bp@suse.de>

> ---

>   arch/x86/kernel/msr.c | 3 ---

>   1 file changed, 3 deletions(-)

> 

> diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c

> index c0d409810658..b1147862730c 100644

> --- a/arch/x86/kernel/msr.c

> +++ b/arch/x86/kernel/msr.c

> @@ -99,9 +99,6 @@ static int filter_write(u32 reg)

>   	if (!__ratelimit(&fw_rs))

>   		return 0;

>   

> -	if (reg == MSR_IA32_ENERGY_PERF_BIAS)

> -		return 0;

> -

>   	pr_err("Write to unrecognized MSR 0x%x by %s (pid: %d). Please report to x86@kernel.org.\n",

>   	       reg, current->comm, current->pid);

>   

> 


Thanks. Looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>


thanks,
-- Shuah