linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Yunhui Cui <cuiyunhui@bytedance.com>,
	Jeremy Linton <jeremy.linton@arm.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	Ionela Voinescu <ionela.voinescu@arm.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Christopher Harris" <chris.harris79@gmail.com>,
	<linux-pm@vger.kernel.org>,
	"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
	"Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
Subject: [PATCH v2 5/5] cpufreq/amd-pstate: Call cppc_set_auto_sel() only for online CPUs
Date: Fri, 7 Nov 2025 13:11:45 +0530	[thread overview]
Message-ID: <20251107074145.2340-6-gautham.shenoy@amd.com> (raw)
In-Reply-To: <20251107074145.2340-1-gautham.shenoy@amd.com>

amd_pstate_change_mode_without_dvr_change() calls cppc_set_auto_sel()
for all the present CPUs.

However, this callpath eventually calls cppc_set_reg_val() which
accesses the per-cpu cpc_desc_ptr object. This object is initialized
only for online CPUs via acpi_soft_cpu_online() -->
__acpi_processor_start() --> acpi_cppc_processor_probe().

Hence, restrict calling cppc_set_auto_sel() to only the online CPUs.

Fixes: 3ca7bc818d8c ("cpufreq: amd-pstate: Add guided mode control support via sysfs")
Suggested-by: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index b44f0f7a5ba1..602e4fa81d6c 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1282,7 +1282,7 @@ static int amd_pstate_change_mode_without_dvr_change(int mode)
 	if (cpu_feature_enabled(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE)
 		return 0;
 
-	for_each_present_cpu(cpu) {
+	for_each_online_cpu(cpu) {
 		cppc_set_auto_sel(cpu, (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
 	}
 
-- 
2.34.1


  parent reply	other threads:[~2025-11-07  7:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  7:41 [PATCH v2 0/5] CPPC/amd-pstate: Fixes to limit actions to online CPUs Gautham R. Shenoy
2025-11-07  7:41 ` [PATCH v2 1/5] ACPI: CPPC: Detect preferred core availability on " Gautham R. Shenoy
2025-11-07  7:41 ` [PATCH v2 2/5] ACPI: CPPC: Check _CPC validity for only the " Gautham R. Shenoy
2025-11-07  7:41 ` [PATCH v2 3/5] ACPI: CPPC: Perform fast check switch only for " Gautham R. Shenoy
2025-11-07  7:41 ` [PATCH v2 4/5] ACPI: CPPC: Limit perf ctrs in PCC check only to " Gautham R. Shenoy
2025-11-07  7:41 ` Gautham R. Shenoy [this message]
2025-11-07 17:41 ` [PATCH v2 0/5] CPPC/amd-pstate: Fixes to limit actions " Rafael J. Wysocki
2025-11-09  4:04   ` Chris Harris

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=20251107074145.2340-6-gautham.shenoy@amd.com \
    --to=gautham.shenoy@amd.com \
    --cc=chris.harris79@gmail.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=ionela.voinescu@arm.com \
    --cc=jeremy.linton@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=rafael@kernel.org \
    --cc=superm1@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).