From nobody Sat Dec 27 03:20:18 2025 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 A3CB712B76; Sat, 23 Dec 2023 16:09:59 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="R/YSffjs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Vhaj9sAt" Date: Sat, 23 Dec 2023 16:09:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703347792; 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=wjlXgqox03zc35mYon6VO8Qr24+OLsYom0EbYgttlNs=; b=R/YSffjswpF9HVPZXKFVUKY5O8+aDf5teojhdEN130QRRO6Ogy15IJ9M5LvuK0tjZSgAug 33G02iCyoUfzxv0XUBst4Qa0tJNlfYX4VqyD3PVXF2kDDMB/g7vajbKCCUNfA9ajx6CeSL fbGXY4LRVrNwN4X99t1JUUZVR7eGDWOIE0a15fRIGCCWT7TdAeebzE7Xk/hYHOaiNDWyKV h07iUGFCv+KrwjfiTiIsNUrM+8yzj93PmnB+BBgOZjDWmrtRyqfho2DO3sXcBBNdgxjxia GUZYllmlY4e5xpm2zwo1JOGcrNRoZgFO1Hc5ZKSjI2CWXvHDumR5EcQn0WNDEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703347792; 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=wjlXgqox03zc35mYon6VO8Qr24+OLsYom0EbYgttlNs=; b=Vhaj9sAty8w/ziE/44AXDSz90q3z/9XCkI2Rvgz9icZL3237tstbxw7GuYydfo7P7NgsCZ sWLyW8FrCSF5F9DQ== 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/cppc: Set the frequency used for computing the capacity Cc: Vincent Guittot , Ingo Molnar , Pierre Gondois , Sudeep Holla , Viresh Kumar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231211104855.558096-7-vincent.guittot@linaro.org> References: <20231211104855.558096-7-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: <170334779172.398.3874376570543618455.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: 5477fa249b56c59c3baa1b237bf083cffa64c84a Gitweb: https://git.kernel.org/tip/5477fa249b56c59c3baa1b237bf083cff= a64c84a Author: Vincent Guittot AuthorDate: Mon, 11 Dec 2023 11:48:54 +01:00 Committer: Ingo Molnar CommitterDate: Sat, 23 Dec 2023 15:52:36 +01:00 cpufreq/cppc: Set the frequency used for computing the capacity Save the frequency associated to the performance that has been used when initializing the capacity of CPUs. Also, cppc cpufreq driver can register an artificial energy model. In such case, it needs the frequency for this compute capacity. Signed-off-by: Vincent Guittot Signed-off-by: Ingo Molnar Tested-by: Pierre Gondois Acked-by: Sudeep Holla Acked-by: Viresh Kumar Link: https://lore.kernel.org/r/20231211104855.558096-7-vincent.guittot@lin= aro.org --- drivers/base/arch_topology.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 0c9ae5b..1aa76b5 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -349,6 +349,7 @@ bool __init topology_parse_cpu_capacity(struct device_n= ode *cpu_node, int cpu) =20 void topology_init_cpu_capacity_cppc(void) { + u64 capacity, capacity_scale =3D 0; struct cppc_perf_caps perf_caps; int cpu; =20 @@ -365,6 +366,10 @@ void topology_init_cpu_capacity_cppc(void) (perf_caps.highest_perf >=3D perf_caps.nominal_perf) && (perf_caps.highest_perf >=3D perf_caps.lowest_perf)) { raw_capacity[cpu] =3D perf_caps.highest_perf; + capacity_scale =3D max_t(u64, capacity_scale, raw_capacity[cpu]); + + per_cpu(capacity_freq_ref, cpu) =3D cppc_perf_to_khz(&perf_caps, raw_ca= pacity[cpu]); + pr_debug("cpu_capacity: CPU%d cpu_capacity=3D%u (raw).\n", cpu, raw_capacity[cpu]); continue; @@ -375,7 +380,15 @@ void topology_init_cpu_capacity_cppc(void) goto exit; } =20 - topology_normalize_cpu_scale(); + for_each_possible_cpu(cpu) { + capacity =3D raw_capacity[cpu]; + capacity =3D div64_u64(capacity << SCHED_CAPACITY_SHIFT, + capacity_scale); + topology_set_cpu_scale(cpu, capacity); + pr_debug("cpu_capacity: CPU%d cpu_capacity=3D%lu\n", + cpu, topology_get_cpu_scale(cpu)); + } + schedule_work(&update_topology_flags_work); pr_debug("cpu_capacity: cpu_capacity initialization done\n");