From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF4A1CA0EC0 for ; Mon, 11 Sep 2023 21:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349118AbjIKVcj (ORCPT ); Mon, 11 Sep 2023 17:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239946AbjIKOcD (ORCPT ); Mon, 11 Sep 2023 10:32:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D348CCF0 for ; Mon, 11 Sep 2023 07:31:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2963EC433C7; Mon, 11 Sep 2023 14:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694442718; bh=wn4tdGZwvmYV7QkXXAW2KiN0qUzQS6rvda70Cse9x/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2C0/7JQ8id3ur109RnXj+dyJKsHUSkiZQGzloegtuChAGxzDPQMQnvsWrsk9mlA0 L5SL6ylGh8daUpqrNlFWcJX7khsQAgf01sqKskrs+fArYOykKLwjYEt0zZApJ3qsNv Hg46YDc/Mv4oFVgXyDsqy1p9TUrHcTdio/r6nndY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yang Jie , Doug Smythies , "Rafael J. Wysocki" Subject: [PATCH 6.4 087/737] cpufreq: intel_pstate: set stale CPU frequency to minimum Date: Mon, 11 Sep 2023 15:39:06 +0200 Message-ID: <20230911134652.934272058@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911134650.286315610@linuxfoundation.org> References: <20230911134650.286315610@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Doug Smythies commit d51847acb018d83186e4af67bc93f9a00a8644f7 upstream. The intel_pstate CPU frequency scaling driver does not use policy->cur and it is 0. When the CPU frequency is outdated arch_freq_get_on_cpu() will default to the nominal clock frequency when its call to cpufreq_quick_getpolicy_cur returns the never updated 0. Thus, the listed frequency might be outside of currently set limits. Some users are complaining about the high reported frequency, albeit stale, when their system is idle and/or it is above the reduced maximum they have set. This patch will maintain policy_cur for the intel_pstate driver at the current minimum CPU frequency. Reported-by: Yang Jie Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217597 Signed-off-by: Doug Smythies [ rjw: White space damage fixes and comment adjustment ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Keyon Jie Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/intel_pstate.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2570,6 +2570,11 @@ static int intel_pstate_set_policy(struc intel_pstate_clear_update_util_hook(policy->cpu); intel_pstate_hwp_set(policy->cpu); } + /* + * policy->cur is never updated with the intel_pstate driver, but it + * is used as a stale frequency value. So, keep it within limits. + */ + policy->cur = policy->min; mutex_unlock(&intel_pstate_limits_lock);