From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385450; b=Xd6Jvy06KYKurUip1jKI7qwV2Ud+zCJ7OFoGLYtqR0xbHo3nJ+I/kIa7PR8T61VISTg5 kWYpcJA9k3CiZTGF3WZuMPQJA9ctC4SXMlNoIhy5Nu+ihYSPnOCnQs3fga3ny7amgAUME 1D63RP5qJoiY+40v+bq/Xh7159dNTuGgnMg9eA5vcXTQ0butM6spt4OA9Knrsm1H4swRS krHYjHL6gkdpizKov2b9CR3eLGHJdxVYqawnmet9WsJ6faoI8mdklvftivY7Ol/ZJ9/jB N5SvfXgFpYp7MeQARd50q+hGx+nyQf89b1fLCfUJRKU4vdv0W3E+m8+forGvFUAM2Bg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385450; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=hYm0qSXpUFdOTV0MrrADC3u59epKk5FLRGP6PkYjBJg=; b=fK+HKdoLuJbH+lVld1hsDx9HP+e3y5gkUQWhFdJzEyRFFlYz1hiRktUWexwpM2bSm39F SwmNNcbfMZLungXixdNMoOia9l/sybMVf3JuQWNK9VXfJo8g/FTSrxizSKAjlzcFF53zm 2ijzdJ9uyS+Fn9KuihZiO5es22yprdYEqwjf/7JAlu3mI+xMiwpGugazxaNN6TBCRjUJI AFzmYc4tUboBbG0BO28FoYBeAEeJZyD1v4eXSD9HljIFZLUH/dRgz5YEl+xlVrCn+npAI 928sv+QQOHP7UG1b68zPXeRzLL4UHw7quCVGSXZ+w0bV9sFRX22yk/Q8Y6Zoxm1qCeA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uH8FlBzN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67B96606A332; Fri, 4 Dec 2026 11:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uH8FlBzN Received: by smtp.kernel.org (Postfix) with ESMTPSA id DADA91F0092C; Fri, 4 Dec 2026 11:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385450; bh=hYm0qSXpUFdOTV0MrrADC3u59epKk5FLRGP6PkYjBJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uH8FlBzN/Me4DmB+9XFFBXsxGLVjFTKM3JcJZp9QJ8r2NeDXMa6qYqWXKv0HDNHmX 0PEIdLRSbXD1LIZoKTbnmH7B+Ru4ZhbEHoKg4/+Ka6AKKc79xmNgrJIDrkxWYRELwu TnPQLimeka4Ouxp9TENQsFJIFSnGabMrX2/iWivQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zak Brighton Knight , Doug Smythies , "Rafael J. Wysocki" , Zhongqiu Han , Viresh Kumar , Christian Loehle Subject: [PATCH 6.6 0544/1167] cpufreq: intel_pstate: Clear last written P-state value on suspend Date: Fri, 4 Dec 2026 18:59:31 +0900 Message-ID: <20261204100716.225832643@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki commit 02e77af824d5be3a94fdd885835a352f90d24c5c upstream. Preserving cpu->pstate.current_pstate across system suspend-resume cycles, when running in the passive mode with HWP disabled, is a mistake because its value from before system suspend may become stale after the subsequent system resume and in some cases it prevents MSR_IA32_PERF_CTL from being updated properly after system resume [1]. Address this by clearing cpu->pstate.current_pstate after the governor has been stopped during system suspend. Fixes: 001c76f05b01 ("cpufreq: intel_pstate: Generic governors support") Fixes: 4adcf2e5829f ("cpufreq: intel_pstate: Add ->offline and ->online callbacks") Link: https://lore.kernel.org/linux-pm/20261027143725.3763827-1-zakbrightonknight@gmail.com/ [1] Reported-by: Zak Brighton Knight Reported-by: Doug Smythies Cc: All applicable # 342d3a73c5db cpufreq: Force passing target frequency to driver during resume Signed-off-by: Rafael J. Wysocki Tested-by: Zak Brighton Knight Reviewed-by: Zhongqiu Han Acked-by: Viresh Kumar Tested-by: Doug Smythies Tested-by: Christian Loehle Link: https://patch.msgid.link/14150222.uLZWGnKmhe@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/intel_pstate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -3057,10 +3057,11 @@ static void intel_cpufreq_cpu_exit(struc static int intel_cpufreq_suspend(struct cpufreq_policy *policy) { + struct cpudata *cpu = all_cpu_data[policy->cpu]; + intel_pstate_suspend(policy); if (hwp_active) { - struct cpudata *cpu = all_cpu_data[policy->cpu]; u64 value = READ_ONCE(cpu->hwp_req_cached); /* @@ -3071,6 +3072,17 @@ static int intel_cpufreq_suspend(struct value &= ~HWP_DESIRED_PERF(~0L); wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); WRITE_ONCE(cpu->hwp_req_cached, value); + } else { + /* + * Invalidate the cached P-state value that may be stale when + * the governor is started again during resume and may prevent + * MSR_IA32_PERF_CTL from being updated. + * + * This does not require synchronization because the core + * prevents frequency updates for suspended policies from + * occurring. + */ + cpu->pstate.current_pstate = 0; } return 0;