Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1774011rda; Tue, 24 Oct 2023 02:57:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEffKdT0mXBdjrj7uve+COI4LGZ+04WDheQ+ntSPwzG5NTvdN/wiTRBTD7qUL7aD/tvRsCD X-Received: by 2002:a05:6a00:10c6:b0:691:2d4:2389 with SMTP id d6-20020a056a0010c600b0069102d42389mr9702116pfu.21.1698141438755; Tue, 24 Oct 2023 02:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698141438; cv=none; d=google.com; s=arc-20160816; b=yNcTVdpu+YDEqh3BmG/5cQ9O3Peya8/qGZYmQcELLwnhqbyz32lwqKXfxInGnWOOZR 09TsTFOApv0f/bHdlM6JiQkzK1p9iQiVXWhErSv/d4F0csHLYnXmbu8eddH2O4Dpn2Gg UwTJJ5/UYlBe79ev38Ps/n5MhOr3C4vpVvoFBBi0FvRfi9dHKddwKJ8UIIp6oUZb+c4R IdVZao6P618JQFeo6MNh/Y8KV1kvv70lx1DHTG27OARMJpjUx+8MboBFePq86BfCHwRP vUoLxXo6KM8YZRLNznXf3yhvBQs9Qq2OrldWf2PEzlh4yplX1JX4SyNu3g4faGZREiWx nc1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9ZmQw87wWu1ilebiZdLFiZTY4pr7HbiJ8vUC+a+GPRs=; fh=20dM/jgof8nur50iMxsi0KgWSPyp1CKjHbKB/Yjf2fg=; b=Z+gp4h67VId3JAVp4cySj76cGQAixtVQiKPPd2wiWJnx3WfMEAJuOtBp3WqwI+JT1T OB7++Sf6pWa57t5JgWEDVRUj/SgSWcNQboF+77TIO1xsydoTAivnWixepVVaFahPJ5E2 SDbHX6tdqiAECV3nihJrdueCEpXPVxJHM4ggt3LIoAI1zPBOvXfNB93imtZdn5sM890n cucLET+bozWoUD8j48wWZB86AA5erNxDYlbrvHdmtyFQqEDiGYhTxCf8tzDSJlGhhlTc Qnw6dkfioOLHt5Fzk82pXou7F9X3UWz/JRaZEVnztUyzDVvf4p7HGFywiLaaPe5ymBp+ FnIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y1wxrMZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d9-20020a056a0010c900b006be04dec663si8166172pfu.311.2023.10.24.02.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 02:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y1wxrMZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 4B0A98047507; Tue, 24 Oct 2023 02:57:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbjJXJ5E (ORCPT + 99 others); Tue, 24 Oct 2023 05:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234208AbjJXJ5C (ORCPT ); Tue, 24 Oct 2023 05:57:02 -0400 Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94B2F9 for ; Tue, 24 Oct 2023 02:56:59 -0700 (PDT) Received: by mail-ua1-x92f.google.com with SMTP id a1e0cc1a2514c-7b6cd2afaf2so1499953241.0 for ; Tue, 24 Oct 2023 02:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698141418; x=1698746218; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9ZmQw87wWu1ilebiZdLFiZTY4pr7HbiJ8vUC+a+GPRs=; b=Y1wxrMZy1k/4FBm8A2U476YZIHerlSRC/2lZEGR3TsdTro02PKRW9bEEBrI+OrX2jZ x2O8pPR63iXPR79TfbMTP+2C6IsLwpYjWJyYkwUFE0a5pK8cVU+mxATxae2dhXHSafQ2 +HGVzVHt7HkKWb4QOZFVDb41tkfA+jSfeCwkM/G8OfAm3ACV/STR+eDTQE5z+P+DK82U fWSB24SRol9vRk9f3S8AAf//8zzDVOyOr3K5WrmyxLMsGNYoZ96/yZYxXahdbZmRrlX+ 6Q2ahxHTvVJxO3c9Ue4d/o4TOEP+iYl0cumWmsWUmKnrPTsaOHZiAZwBTkrddvfLXKYc nA9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698141418; x=1698746218; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9ZmQw87wWu1ilebiZdLFiZTY4pr7HbiJ8vUC+a+GPRs=; b=LuSYQXCmwh70VzEKhuGQSMmya3kN9rjU7RuQsoCz5uXDJ5HdLlx1qihzief89xGXKI KRVzSLnNQcNROb0TCF5ziLh8g54aD/M0ku8hyKOZyQH2Nwi5pIjr0bTZt1jg3WIZq1tv 2YMl3mGEVCB48CLCXsjROMWBQFwTJZgMqneQGM+zQbiGMYKU1vYsOnrhNQJg9iK/bPCJ 1CS8uOLTyY7Qc6m44izN9jp2SJLhB7rRzBHLD8tMP66934w9+/3wPL/gCshNTyU+A18k qT+nA+Do7WVNgZK+VO1fEtUucYZMNs9uFkRu6e68bc479KWzyLF117gG8rp/9P9ZJGsu z7jg== X-Gm-Message-State: AOJu0Yy8X+ezNI+dhmbaJ5EXI9Ohuwghh5qeNy/9hGSSlq2EyauQS5Af U9+r4cTxuzlBM8dfIg8QVQpCwzFXRlhvdY0zyZGQZA== X-Received: by 2002:a67:ac48:0:b0:45a:67da:658 with SMTP id n8-20020a67ac48000000b0045a67da0658mr5359507vsh.33.1698141418696; Tue, 24 Oct 2023 02:56:58 -0700 (PDT) MIME-Version: 1.0 References: <20231018162540.667646-1-vincent.guittot@linaro.org> <20231018162540.667646-6-vincent.guittot@linaro.org> <60497d6d-dfe3-4edc-9553-311fdd9c63d0@arm.com> In-Reply-To: <60497d6d-dfe3-4edc-9553-311fdd9c63d0@arm.com> From: Vincent Guittot Date: Tue, 24 Oct 2023 11:56:46 +0200 Message-ID: Subject: Re: [PATCH v3 5/6] cpufreq/cppc: set the frequency used for computing the capacity To: Pierre Gondois 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, 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, viresh.kumar@linaro.org, lenb@kernel.org, robert.moore@intel.com, lukasz.luba@arm.com, ionela.voinescu@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, conor.dooley@microchip.com, suagrfillet@gmail.com, ajones@ventanamicro.com, lftan@kernel.org, "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 02:57:16 -0700 (PDT) On Fri, 20 Oct 2023 at 18:05, Pierre Gondois wrote= : > > Hello Vincent, > > On 10/18/23 19:26, Rafael J. Wysocki wrote: > > On Wed, Oct 18, 2023 at 6:25=E2=80=AFPM Vincent Guittot > > wrote: > >> > >> Save the frequency associated to the performance that has been used wh= en > >> 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. > >> We moved and renamed cppc_perf_to_khz and cppc_perf_to_khz to use them > >> outside cppc_cpufreq in topology_init_cpu_capacity_cppc(). > >> > >> Signed-off-by: Vincent Guittot > > > > For the changes in drivers/acpi/cppc_acpi.c : > > > > Acked-by: Rafael J. Wysocki > > > >> --- > >> drivers/acpi/cppc_acpi.c | 93 ++++++++++++++++++++++ > >> drivers/base/arch_topology.c | 15 +++- > >> drivers/cpufreq/cppc_cpufreq.c | 141 ++++++-------------------------= -- > >> include/acpi/cppc_acpi.h | 2 + > >> 4 files changed, 133 insertions(+), 118 deletions(-) > >> > > [snip] > > >> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology= .c > >> index 9a073c2d2086..2372ce791bb4 100644 > >> --- a/drivers/base/arch_topology.c > >> +++ b/drivers/base/arch_topology.c > >> @@ -350,6 +350,7 @@ bool __init topology_parse_cpu_capacity(struct dev= ice_node *cpu_node, int cpu) > >> void topology_init_cpu_capacity_cppc(void) > >> { > >> struct cppc_perf_caps perf_caps; > >> + u64 capacity, capacity_scale; > > I think capacity_scale should be initialized to 0 here, > since it is used to find the max value of raw_capacity[cpu]. yes > > >> int cpu; > >> > >> if (likely(!acpi_cpc_valid())) > >> @@ -365,6 +366,10 @@ void topology_init_cpu_capacity_cppc(void) > >> (perf_caps.highest_perf >=3D perf_caps.nominal_pe= rf) && > >> (perf_caps.highest_perf >=3D perf_caps.lowest_per= f)) { > >> raw_capacity[cpu] =3D perf_caps.highest_perf; > >> + capacity_scale =3D max_t(u64, capacity_scale, = raw_capacity[cpu]); > >> + > >> + per_cpu(capacity_ref_freq, cpu) =3D cppc_perf_= to_khz(&perf_caps, raw_capacity[cpu]); > > I think capacity_ref_freq in in Hz, so the freq should be multiplied by 1= 000 . yes, I forgot the *1000. I'm going to add * HZ_PER_KHZ > > With these two modifications, the patches worked well on a cppc-based pla= tform. > > Sorry I forgot to detail what it was. It's a modified Juno with CPPC enab= led. AMUs are not > enabled, so the CPPC performance counters are not handled correctly and F= IE cannot be enabled, > but it is possible to change frequencies. > > The _CPC objects are setup as: > little CPUs: > - lowest_freq =3D 450 (MHz) > - nominal_freq =3D 800 (MHz) > - highest_perf =3D 383 * 1000 > - nominal_perf =3D 322 * 1000 > - lowest_perf =3D 181 * 1000 > - lowest_nonlinear_perf =3D 181 * 1000 > > big CPUs: > - lowest_freq =3D 600 (MHz) > - nominal_freq =3D 1200 (MHz) > - highest_perf =3D 1024 * 1000 > - nominal_perf =3D 833 * 1000 > - lowest_perf =3D 512 * 1000 > - lowest_nonlinear_perf =3D 512 * 1000 > > As a remainder, available frequencies are: > - little CPUs: 450, 800, 950 MHz > - big CPUs: 600, 1000, 1200 Mhz > So the platform is setup to have the last frequency as a boost frequency = (for testing). > > ---- > > Just to make a note of 2 potential side-issues for later (independent fro= m these patches): > > - When testing with boosted/non-bossted frequencies, it didn't seem that = cpu_overutilized() > was taking the maximum frequency into consideration. This might mean t= hat when lowering the > maximum frequency of a policy, the maximum capacity of the CPUs of thi= s policy is used > to detect over-utilization. > I would have thought that the over-utilization threshold would be lowe= red at the same time. No it's not, It will be part of a next step patchset. This patchset aims to consolidate and use the same reference so we can then easily propagate changes if needed > > - Similarly for EAS, the energy computation doesn't take into account the= maximum frequency > of the policy. This should mean that EAS is taking into consideration = frequencies that > are not actually available. > > > Regards, > Pierre