From patchwork Sat Dec 23 16:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 182985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1752364dyi; Sat, 23 Dec 2023 08:12:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9dyibk9s6anBhnLnu127zGU20Inca5GeV5qLg3qkCWUQgLZ9TQL3RMVSMbOEv6BcofG7V X-Received: by 2002:a17:906:a2d9:b0:a26:8c28:1b68 with SMTP id by25-20020a170906a2d900b00a268c281b68mr1540966ejb.111.1703347942572; Sat, 23 Dec 2023 08:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703347942; cv=none; d=google.com; s=arc-20160816; b=YfqifrMHtUBPMdj49sXLUGj5bqi7VdGDof4ugy6YwLXORVLu2EzClFVnAzMvpXKxVO azSTCRCEVkmjcU/DRugSmkTkYLQOXWjnj2diwx5YzA/VaN2p1DdHuFPq21MtMlRwNjqg t4QkFDU7I0GVq2MiXDCUtRuRX/y3aKIJNMsJHrb6L2d14fCmcIW8RRltyWVgcfz/90hF tqKyVVBE703Awwx20YLg4nGkVgvmAUbm1xIl/MD5GYY3/dCKNDSP6NLkLutJ1Reqhybt HPQOWfbOw38okm8/okhlpU5jLfM/rs6p79StiBNPHHMzvshkr37HEQhfCJTK8zLM9v5W 6z6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=tqdSeALGoqNstEKfMnT0w2wxKUVJZu18ej/KQGyl3rQ=; fh=N2+10SoQKeHgn78dBOtrg7J0SgehVKXqEPwJ0qVnDMY=; b=Uy1NMZKTbTbAShGuFA2NG36aQb+xA0RY6hYP9ocEeyMd85HSMneRAmWbUGCoSyMX/d vxwZQd9jT3YqH/YbUUapX8oqxcm+tG1Mw085ibvVBHgbWhkUeVYEyQQhv91DcAigLY9u 7VLTD2/aOK5bS7BNHIrg+mvfgT4z+/Dkf60o8nMFUbUQppFj7S5V+7QMNN0NIMWTJv12 RQ47b7hGw1PcvSV+EG8qX9sn3bytA6RxGVWwL+Du7ILMEnpbpFP15wmdHZA4VoXOG5xw 9Gl0CBMIaDk8eITLbK5FaMMu5hYsfrpbtWWpA+mIBgbl2ebEWIrOor1W0AmEqdR2JT2b pvaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mgv3x6Bg; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel+bounces-10495-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10495-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g23-20020a1709067c5700b00a269876ae8esi2882531ejp.811.2023.12.23.08.12.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 08:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10495-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mgv3x6Bg; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel+bounces-10495-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10495-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3489B1F2137F for ; Sat, 23 Dec 2023 16:12:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAAF622EFE; Sat, 23 Dec 2023 16:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mgv3x6Bg"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3yh3HECF" X-Original-To: linux-kernel@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 267F614F90; Sat, 23 Dec 2023 16:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Sat, 23 Dec 2023 16:09:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703347795; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tqdSeALGoqNstEKfMnT0w2wxKUVJZu18ej/KQGyl3rQ=; b=mgv3x6BgE9KMydjyYhHl3dUSTvG9gxa/D+YA0NQfkGEIebOxEFWeyKszG3uQ4yjYgmW8bp AtWxlL+E5/yXCAl1ygTClk2ujsG1UhBVtDkLyNQAcEgnt131Mnm8A3GKQ6ZptJO/tV5fM8 T8kIEt1mPA85xdPUsIQhg1BtgOiSK+2CxxRH2tqcCJOset+lAB+GxzR/iBLrekxs1yPOUX HxUYesb1b3AYLycXh7LEbV3pnNgkVU7XKLLi1IUBIzZ+1po3z5kqUdXODeyG79tKx7jBL0 NekyHU6iAul/Espyorc1CEMqrUBdaacK1Q5+0ysN30USQ4RPV5J/xxBq7CLWwQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703347795; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tqdSeALGoqNstEKfMnT0w2wxKUVJZu18ej/KQGyl3rQ=; b=3yh3HECFKSat4LX+Wivedc3aAo5t8DOndTQ/DYtqd1gnUcZst6Zyskvl2KhKYDOeB2tLDD AePqFoIhUs/GhGDg== From: "tip-bot2 for Vincent Guittot" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] cpufreq: Use the fixed and coherent frequency for scaling capacity Cc: Vincent Guittot , Ingo Molnar , Lukasz Luba , Viresh Kumar , "Rafael J. Wysocki" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231211104855.558096-3-vincent.guittot@linaro.org> References: <20231211104855.558096-3-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170334779477.398.11717943380884738392.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784982286086680096 X-GMAIL-MSGID: 1786089772162465914 The following commit has been merged into the sched/core branch of tip: Commit-ID: 599457ba15403037b489fe536266a3d5f9efaed7 Gitweb: https://git.kernel.org/tip/599457ba15403037b489fe536266a3d5f9efaed7 Author: Vincent Guittot AuthorDate: Mon, 11 Dec 2023 11:48:50 +01:00 Committer: Ingo Molnar CommitterDate: Sat, 23 Dec 2023 15:52:34 +01:00 cpufreq: Use the fixed and coherent frequency for scaling capacity cpuinfo.max_freq can change at runtime because of boost as an example. This implies that the value could be different from the frequency that has been used to compute the capacity of a CPU. The new arch_scale_freq_ref() returns a fixed and coherent frequency that can be used to compute the capacity for a given frequency. [ Also fix a arch_set_freq_scale() newline style wart in . ] Signed-off-by: Vincent Guittot Signed-off-by: Ingo Molnar Tested-by: Lukasz Luba Reviewed-by: Lukasz Luba Acked-by: Viresh Kumar Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20231211104855.558096-3-vincent.guittot@linaro.org --- drivers/cpufreq/cpufreq.c | 4 ++-- include/linux/cpufreq.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 934d35f..44db4f5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, arch_set_freq_scale(policy->related_cpus, policy->cur, - policy->cpuinfo.max_freq); + arch_scale_freq_ref(policy->cpu)); spin_lock(&policy->transition_lock); policy->transition_ongoing = false; @@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, policy->cur = freq; arch_set_freq_scale(policy->related_cpus, freq, - policy->cpuinfo.max_freq); + arch_scale_freq_ref(policy->cpu)); cpufreq_stats_record_transition(policy, freq); if (trace_cpu_frequency_enabled()) { diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 1c5ca92..afda5f2 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -1203,6 +1203,7 @@ void arch_set_freq_scale(const struct cpumask *cpus, { } #endif + /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;