Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1813487rdb; Mon, 9 Oct 2023 04:02:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGXjR+2EWwI3+L0apfJH/y2KFZfxbONzxLLZcWbkopld6xm0sD0BU6vJWEAI/Jfm2pXuzC X-Received: by 2002:a17:902:cec6:b0:1c8:7d41:5b8c with SMTP id d6-20020a170902cec600b001c87d415b8cmr15880713plg.32.1696849342456; Mon, 09 Oct 2023 04:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696849342; cv=none; d=google.com; s=arc-20160816; b=dgwrPgP39SulYOSrQxqR909qFPIwZlpy6cvs/v4jFGjTprPFE7OwRPBxCiUfsyYhtO kR2rUWpEFjZGN+/hZpN6Ka6vthovWdiYBeu2uFSOMQZgwWyYTGnQJ3w7+ziaDqv21PNA HSz3Sf4f6YUGLO01Tx5cw/FQeQJHJZZLINqCXdDREOaM/AmZu/axoUOuXyWDrtqolMx6 EgykD792GyDX5h3s4oFUo61ctfr2AZh5V+HOWFdJUexLC4Ldwl8nHvjtl8sFCPZ7q3sg CLjeZEIWcrb4ReibdZP3ZkO4IpLB3eKZErmFi+XXsNnGrF0H8sWzk9LNaq3T5V8TjrPW nNJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=20UBSnZ21RVqEDRJGZ13WLMQlN/IzJeVLBl1dR+JWvA=; fh=4xywi5wnvtmrL+LB9vM2EIzIlDk2eax45jqv3qLxim0=; b=vflOVlp14uCD2A//4GWhmEiZoSELazyE8L68fdQHY2cnIdg3mVgL7Nqbt+rR5D66Wy djcYFSazMbjaqE1gHrUMVqLniSR7NRfn8zCubp2qFAAtGUcVoEywlZGyHLPb5jVn7gFR My9PoBfNB2uHFl5ZKNOJinyMT3ehCSumk0gy7jtk2QhCySQhSdVv8gHJ9d+6Nndj4pzP ER6mQbFuo6p+uSk4O+/bKWkUs3Xy3H3swnFLfJ4/X4+5A1gPBrDMm6r0zEEbc0pcIuJG H70XHWdIm/1lD2Xk2vAE9B0vG8ggBKwl7xCVLg9OpV04BDNSQ10EDd81IIfmtGxUG/Qg faoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SyuHM73Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n6-20020a170902d2c600b001b8a4954be1si10168360plc.595.2023.10.09.04.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 04:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SyuHM73Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C6D00805C14C; Mon, 9 Oct 2023 04:01:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346110AbjJILBS (ORCPT + 99 others); Mon, 9 Oct 2023 07:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234513AbjJILBQ (ORCPT ); Mon, 9 Oct 2023 07:01:16 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567A09C for ; Mon, 9 Oct 2023 04:01:14 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso3905279b3a.2 for ; Mon, 09 Oct 2023 04:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849274; x=1697454074; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=20UBSnZ21RVqEDRJGZ13WLMQlN/IzJeVLBl1dR+JWvA=; b=SyuHM73QZaxDoPGX22cjAdV1/EJ64tT156cd54rUQtMhuEBfs87xFRQuDMmmRZlkTq ULFjT0u8qNok/ApgZaaWZci08cDiAlwYrqltGj7QJyfKic1/TkK9pomiCde7JwB42mqE nb+qEGva+HCgaWRkNEhAx1ineQHwxFsDNfa0J9aGB2+e2HZNCMm2s4t/OIcPO7xkgo/Q 1UeR9Rrv+8c2TyuSvGxAx+kRr7dh19Qn9eftWLHjUqrtA2+1d/zo0EgY/qbmkd3PApYp i+yTSWj8zr8nO8XQuHj+vbwn0Z3o2ZHawA448Giah38NFc61p2puuACE7XIrROJo1gnv m7sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849274; x=1697454074; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=20UBSnZ21RVqEDRJGZ13WLMQlN/IzJeVLBl1dR+JWvA=; b=DxUbahcDw6RVPTkrC9vaTgym0iRl3C/P3xvpVMXYoO3sdOFiYtkxw0UJhXEa7c5B7t +KZVnCcabANI39RE9seLR2zi8ADJStaB6Q1TRX2XSYCWZ+ISXuUcBRu0i8DbPn+tuVXp cQh8iqpd7/BwnUL5kfws0JZJIzVxwduJhyEcsyh2oo/K2Luss41jM5SG3vbfzEB7tIIq V+JcY9fWTgI94qmuXpdHFPZ4Zf2AHwzVeQZUxiV9J2i3gt0Kznea+nuE91L9h5S+2GtD hkWmcpwsC4BnxCCd1jIddVILQ3fe26b0soFkbPZRw5PWKMZprjvYepwNXPOBt84f5Oh0 O2rg== X-Gm-Message-State: AOJu0YxwAYnQbnabC2oIkHNsNbJKR94jh0NWmWOX/ipQyuWVg1zV+5ll 9hiZbJJeWw19w7fzIpBoB2LNzBvdwI7mjZL6zZg= X-Received: by 2002:a05:6a00:2da2:b0:68f:cc47:fcd7 with SMTP id fb34-20020a056a002da200b0068fcc47fcd7mr17093067pfb.28.1696849273710; Mon, 09 Oct 2023 04:01:13 -0700 (PDT) Received: from localhost ([122.172.81.92]) by smtp.gmail.com with ESMTPSA id gu21-20020a056a004e5500b00690c2cd7e0esm6146001pfb.49.2023.10.09.04.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 04:01:13 -0700 (PDT) Date: Mon, 9 Oct 2023 16:31:11 +0530 From: Viresh Kumar To: Vincent Guittot Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, lukasz.luba@arm.com, ionela.voinescu@arm.com, pierre.gondois@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pm@vger.kernel.org, conor.dooley@microchip.com, suagrfillet@gmail.com, ajones@ventanamicro.com, lftan@kernel.org Subject: Re: [PATCH v2 3/6] cpufreq: use the fixed and coherent frequency for scaling capacity Message-ID: <20231009110111.tdehkpammwyigzia@vireshk-i7> References: <20231009103621.374412-1-vincent.guittot@linaro.org> <20231009103621.374412-4-vincent.guittot@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009103621.374412-4-vincent.guittot@linaro.org> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 04:01:53 -0700 (PDT) X-Spam-Level: ** On 09-10-23, 12:36, Vincent Guittot wrote: > 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. > > Signed-off-by: Vincent Guittot > --- > drivers/cpufreq/cpufreq.c | 4 ++-- > include/linux/cpufreq.h | 9 +++++++++ > 2 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 60ed89000e82..8c4f9c2f9c44 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 71d186d6933a..bbc483b4b6e5 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -1211,6 +1211,15 @@ void arch_set_freq_scale(const struct cpumask *cpus, > { > } > #endif > + > +#ifndef arch_scale_freq_ref > +static __always_inline > +unsigned int arch_scale_freq_ref(int cpu) > +{ > + return 0; > +} > +#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; Acked-by: Viresh Kumar -- viresh