From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-pm@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: intel_pstate_get_hwp_cap on wrong CPU
Date: Wed, 29 May 2024 16:08:19 -0700 [thread overview]
Message-ID: <ca47b6f812175ea60f6ad615274223aa7fee295d.camel@linux.intel.com> (raw)
In-Reply-To: <20240529155740.Hq2Hw7be@linutronix.de>
[-- Attachment #1: Type: text/plain, Size: 2137 bytes --]
Hi Sebastian,
On Wed, 2024-05-29 at 17:57 +0200, Sebastian Andrzej Siewior wrote:
> Hi,
>
> this just popped up:
> > [ 6538.614568] unchecked MSR access error: RDMSR from 0x771 at rIP:
Please check if the attached change fixes?
Thanks,
Srinivas
> > 0xffffffff817d2250 (__rdmsr_on_cpu+0x20/0x50)
> > [ 6538.625714] Call Trace:
> > [ 6538.629156] <TASK>
> > [ 6538.675067] generic_exec_single+0x58/0x120
> > [ 6538.680236] smp_call_function_single+0xbf/0x110
> > [ 6538.696333] rdmsrl_on_cpu+0x46/0x60
> > [ 6538.700894] intel_pstate_get_hwp_cap+0x1b/0x70
> > [ 6538.706420] intel_pstate_update_limits+0x2a/0x60
> > [ 6538.712110] acpi_processor_notify+0xb7/0x140
> > [ 6538.717479] acpi_ev_notify_dispatch+0x3b/0x60
> > [ 6538.722910] acpi_os_execute_deferred+0xf/0x20
> > [ 6538.728346] process_one_work+0x13d/0x350
> > [ 6538.733342] worker_thread+0x2c2/0x3d0
> > [ 6538.743066] kthread+0xca/0x100
> > [ 6538.751844] ret_from_fork+0x2c/0x40
> > [ 6538.761073] ret_from_fork_asm+0x11/0x20
> > [ 6538.765993] </TASK>
>
> > root@h:~# grep . /sys/devices/system/cpu/intel_pstate/*
> > /sys/devices/system/cpu/intel_pstate/max_perf_pct:100
> > /sys/devices/system/cpu/intel_pstate/min_perf_pct:36
> > /sys/devices/system/cpu/intel_pstate/no_turbo:0
> > /sys/devices/system/cpu/intel_pstate/num_pstates:4294967285
> ^ => -EAGAIN
>
> > /sys/devices/system/cpu/intel_pstate/status:passive
> > /sys/devices/system/cpu/intel_pstate/turbo_pct:0
>
> > # cpupower frequency-info
> > analyzing CPU 0:
> > driver: intel_cpufreq
> …
>
> from turbostat:
> > CPUID(0): GenuineIntel 0xf CPUID levels
> > CPUID(1): family:model:stepping 0x6:3f:4 (6:63:4) microcode 0x1a
> > CPUID(0x80000000): max_extended_levels: 0x80000008
> > CPUID(1): SSE3 MONITOR SMX EIST TM2 TSC MSR ACPI-TM HT TM
> > CPUID(6): APERF, TURBO, DTS, PTM, No-HWP, No-HWPnotify, No-
> > HWPwindow, No-HWPepp, No-HWPpkg, EPB
> > cpu4: MSR_IA32_MISC_ENABLE: 0x00850089 (TCC EIST MWAIT PREFETCH
> > TURBO)
> > CPUID(7): No-SGX No-Hybrid
>
> This is v6.10.0-rc1.
>
> Sebastian
>
[-- Attachment #2: 0001-cpufreq-intel_pstate-Fix-unchecked-HWP-MSR-access.patch --]
[-- Type: text/x-patch, Size: 1393 bytes --]
From f85a83508ef029bceaf9192cb648d66f32b61d02 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Wed, 29 May 2024 15:30:49 -0700
Subject: [PATCH] cpufreq: intel_pstate: Fix unchecked HWP MSR access
HWP MSR 0x771 can be only read on a CPU which supports HWP and enabled.
Hence intel_pstate_get_hwp_cap() can only be called when hwp_active is
true.
Reported-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Closes: https://lore.kernel.org/linux-pm/20240529155740.Hq2Hw7be@linutronix.de/
Fixes: e8217b4bece3 ("cpufreq: intel_pstate: Update the maximum CPU frequency consistently")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/cpufreq/intel_pstate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4b986c044741..65d3f79104bd 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1153,7 +1153,8 @@ static void intel_pstate_update_policies(void)
static void __intel_pstate_update_max_freq(struct cpudata *cpudata,
struct cpufreq_policy *policy)
{
- intel_pstate_get_hwp_cap(cpudata);
+ if (hwp_active)
+ intel_pstate_get_hwp_cap(cpudata);
policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ?
cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
--
2.25.1
next prev parent reply other threads:[~2024-05-29 23:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 15:57 intel_pstate_get_hwp_cap on wrong CPU Sebastian Andrzej Siewior
2024-05-29 23:08 ` srinivas pandruvada [this message]
2024-05-31 11:02 ` Sebastian Andrzej Siewior
2024-05-31 11:56 ` srinivas pandruvada
2024-05-31 14:01 ` Sebastian Andrzej Siewior
2024-05-31 22:27 ` srinivas pandruvada
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=ca47b6f812175ea60f6ad615274223aa7fee295d.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.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