From patchwork Sat Dec 23 16:09:51 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: 182980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1752045dyi; Sat, 23 Dec 2023 08:11:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeIQeuwY0FZiHnnkYH/kpTwWD9tsGhKsdEQDYDtjMqyeNr6TZt2wu33+hF62mkY73h/Yev X-Received: by 2002:a17:902:db0b:b0:1d3:f1b7:b467 with SMTP id m11-20020a170902db0b00b001d3f1b7b467mr4278261plx.14.1703347906799; Sat, 23 Dec 2023 08:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703347906; cv=none; d=google.com; s=arc-20160816; b=HtkBy+BRI1rHN23rAwwtu5F+FJjavfrxbJYQbsx9kEZqqVu57gPmrYYCkOxOvSEQUM 48nMpDdmp7B6mvUhyAw6+EnrDNkQawP2JdoX+L/3D/+RvuTTVlBuDEW+cxCILPsJ+s9L YmQanFR9R1TC8It1ank7J3z9cH+aQ10BeWqO1YsnqA4C35eKcoQ8I5D2rKqFzjptb/wD TOdDq7sV+3MBky7/jDVvawOGqPpouCneQVzfxVBGZ1fW+NrNj9+oxIz2RRss8/CY17AN RgsnefOjSnDs6sGAKyAf++Ge7TESV+TdEh4vu5I3idafoJDsOGp4KuKpkLRzpl8EuZ2q vGlw== 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=wjlXgqox03zc35mYon6VO8Qr24+OLsYom0EbYgttlNs=; fh=YFdUE+XUfmCsn4FhmpysnYc+yXqcREKLnn92Z6Akkkw=; b=sY98qEFQ559zec06i7ODzxEVmomFVNH1/z1pVFlDg5chRsFfG3SlIZiT1CnEbZjw70 f9q6JgReMlv++uOtn8Lrsx0ZNCzxIw5zxelq8GWXB/TWmv7Ap0Cl89+Z6CoPZcLyLvrc VYIwEb1qD9fRpx0RKtec1lF8PnPtmoTe5tChsgSHPKbnkGm0HjOw9i7QpXYHKETkFgcU Qdr4GyD/6perp8tE06ME3x0g5hAPIEbVbgHkutpOV8Wpeo/dP73CXJG8Z89FdTak7EY9 VZ96pz8G1jM7Z5CtazzP1zYhi7a2M691Ruqarhcte8tNoqyIhcQXRVrHAYhalFKizRga OnfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R/YSffjs"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-10490-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10490-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a1-20020a170902ecc100b001d43ea963c7si684332plh.371.2023.12.23.08.11.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 08:11:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10490-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R/YSffjs"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-10490-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10490-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 92E5D283F23 for ; Sat, 23 Dec 2023 16:11:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0F9C224D2; Sat, 23 Dec 2023 16:10:03 +0000 (UTC) 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" 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 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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784982340589455158 X-GMAIL-MSGID: 1786089734930294916 The following commit has been merged into the sched/core branch of tip: Commit-ID: 5477fa249b56c59c3baa1b237bf083cffa64c84a Gitweb: https://git.kernel.org/tip/5477fa249b56c59c3baa1b237bf083cffa64c84a 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@linaro.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_node *cpu_node, int cpu) void topology_init_cpu_capacity_cppc(void) { + u64 capacity, capacity_scale = 0; struct cppc_perf_caps perf_caps; int cpu; @@ -365,6 +366,10 @@ void topology_init_cpu_capacity_cppc(void) (perf_caps.highest_perf >= perf_caps.nominal_perf) && (perf_caps.highest_perf >= perf_caps.lowest_perf)) { raw_capacity[cpu] = perf_caps.highest_perf; + capacity_scale = max_t(u64, capacity_scale, raw_capacity[cpu]); + + per_cpu(capacity_freq_ref, cpu) = cppc_perf_to_khz(&perf_caps, raw_capacity[cpu]); + pr_debug("cpu_capacity: CPU%d cpu_capacity=%u (raw).\n", cpu, raw_capacity[cpu]); continue; @@ -375,7 +380,15 @@ void topology_init_cpu_capacity_cppc(void) goto exit; } - topology_normalize_cpu_scale(); + for_each_possible_cpu(cpu) { + capacity = raw_capacity[cpu]; + capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT, + capacity_scale); + topology_set_cpu_scale(cpu, capacity); + pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n", + cpu, topology_get_cpu_scale(cpu)); + } + schedule_work(&update_topology_flags_work); pr_debug("cpu_capacity: cpu_capacity initialization done\n");