From patchwork Thu Jul 9 06:52:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 11653463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 463CC13B1 for ; Thu, 9 Jul 2020 06:54:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1EFB92065D for ; Thu, 9 Jul 2020 06:54:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qopxQXct"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jJWpSWZ0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EFB92065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=sWN8zyqaCAQIeOgb3+vCDAySGKxl/jwnt+vBzTXIYqU=; b=qopxQXctIE+srvD8avOoQ/SNGH gLi4XHVnScpzmSLAmcu9MzLUkBPjN+kycCx44DXBeCgwMVpqez2dhA+wFo6uiw23RR3y65gqeYhT6 BjFuLht+MJTOjscS5ZERfhIn4tjRwwyJhkVqxNQqCge2zJhc+3sJxnqerC2ZDvkiyetjfnF6xQCWm j208DTwPVAaRbYEXVlQoEdcQXp6kjEgCNzXr+Bd9/Op9BnlysBdT3lDqeITZ7/PDH9tPrnIhm/AKo w2urv+VvlZHi4U7JeZktizn8ou2LE2XzOGLNLVPPzdhwWMBnGQJGQ4lpkgNNPd9On1RjcASyuPGFj 9eZk58Tg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtQQX-0007YM-06; Thu, 09 Jul 2020 06:53:01 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtQQT-0007XF-Ue for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2020 06:52:58 +0000 Received: by mail-pf1-x442.google.com with SMTP id x72so601521pfc.6 for ; Wed, 08 Jul 2020 23:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xi0IjXZT0vlAn+aLE/RD/PtWZze7khXZnjoaecCKN1M=; b=jJWpSWZ0U1zA1yILc3YaBGQs7u1fLp3eg6M+JC6uPvP26eNchIerrsO8/U0B7XZKc5 3nHVMfK78KaQSwJsKScWm/1BI0cBmhgknmhpfvtHN8luFokG5nMn7gEG7MD8n8xSVvMt nu4Fs40ttO/wMoOti/Cuwqk1ZH4IDhoKTKSPlmDNk9ykwC5vH/1G/fo0Jm1YgBO4xKsU Q62jQpaDESE46iJpl2Y5n7aBPLWYlo5HcwnKlAyLtbB9ttMCG8BAMcHCl+Cv4I7SaBd7 AfGeE5vufhYP5jAKVMFk7OUw3IIlASsJikFyLu+nD7uS6F/f63y+7YGvggxOuFE/fCXJ /BvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xi0IjXZT0vlAn+aLE/RD/PtWZze7khXZnjoaecCKN1M=; b=hbOpSPEx538BvOdPcUyLaw8HxEHvTap6zQRagGp2zQb48dszLz6LaQ3OGkK6BdBNay bYc+aMakUt1bimiZEKkx51hy+JhhNGKQoP8Oe3aj7iJei+hHOgzZ/hEnyxf2KfGG+HhS lyloVvImcOskoG56nT7PxO8/ncHjUXzHn8JfQxlOupXlTx2yk53d94elp6wtJqW340jP Sv6e+Kxd6THDUZj6XNvTscsdL+R8P1NgykRcv9Cdva66Lc0XUYJ+OiE/j8drNxEhb+9a tHwWYSMpufXfMPhvuWCKKsLWR8+CbvortfMGLMvud6p79IraypBpkQHD6yTNrId3vyft 4Drw== X-Gm-Message-State: AOAM5322KntFkyZAMJEjEtGaqLgTBKa/7BpgMolonga9jS1LcBT0yZRL bTHKrA+MXEkz4e8ieB1A3dULHQ== X-Google-Smtp-Source: ABdhPJyakv2z/Yj0ViE4yrP6D4rSzJtc+69r45BNRWe9J9ut1E1xICUdWAeLHyU5Zig+MEgceti5Zw== X-Received: by 2002:a63:20d:: with SMTP id 13mr53135099pgc.166.1594277574260; Wed, 08 Jul 2020 23:52:54 -0700 (PDT) Received: from localhost ([122.172.40.201]) by smtp.gmail.com with ESMTPSA id p127sm1710281pfb.17.2020.07.08.23.52.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2020 23:52:53 -0700 (PDT) From: Viresh Kumar To: Ionela Voinescu , Catalin Marinas , Will Deacon Subject: [PATCH] arm64: topology: Don't support AMU without cpufreq Date: Thu, 9 Jul 2020 12:22:45 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_025258_008660_F6BDD54E X-CRM114-Status: GOOD ( 13.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Vincent Guittot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The commit cd0ed03a8903 ("arm64: use activity monitors for frequency invariance"), mentions that: "if CONFIG_CPU_FREQ is not enabled, the use of counters is enabled on all CPUs only if all possible CPUs correctly support the necessary counters" But that's not really true as validate_cpu_freq_invariance_counters() fails if max_freq_hz is returned as 0 (in case there is no policy for the CPU). And the AMUs won't be supported in that case. Make the code reflect this reality. Signed-off-by: Viresh Kumar --- arch/arm64/kernel/topology.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 0801a0f3c156..b7da372819fc 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -187,14 +187,13 @@ static int validate_cpu_freq_invariance_counters(int cpu) return 0; } -static inline bool -enable_policy_freq_counters(int cpu, cpumask_var_t valid_cpus) +static inline void update_amu_fie_cpus(int cpu, cpumask_var_t valid_cpus) { struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); if (!policy) { pr_debug("CPU%d: No cpufreq policy found.\n", cpu); - return false; + return; } if (cpumask_subset(policy->related_cpus, valid_cpus)) @@ -202,8 +201,6 @@ enable_policy_freq_counters(int cpu, cpumask_var_t valid_cpus) amu_fie_cpus); cpufreq_cpu_put(policy); - - return true; } static DEFINE_STATIC_KEY_FALSE(amu_fie_key); @@ -212,7 +209,6 @@ static DEFINE_STATIC_KEY_FALSE(amu_fie_key); static int __init init_amu_fie(void) { cpumask_var_t valid_cpus; - bool have_policy = false; int ret = 0; int cpu; @@ -228,18 +224,9 @@ static int __init init_amu_fie(void) if (validate_cpu_freq_invariance_counters(cpu)) continue; cpumask_set_cpu(cpu, valid_cpus); - have_policy |= enable_policy_freq_counters(cpu, valid_cpus); + update_amu_fie_cpus(cpu, valid_cpus); } - /* - * If we are not restricted by cpufreq policies, we only enable - * the use of the AMU feature for FIE if all CPUs support AMU. - * Otherwise, enable_policy_freq_counters has already enabled - * policy cpus. - */ - if (!have_policy && cpumask_equal(valid_cpus, cpu_present_mask)) - cpumask_or(amu_fie_cpus, amu_fie_cpus, valid_cpus); - if (!cpumask_empty(amu_fie_cpus)) { pr_info("CPUs[%*pbl]: counters will be used for FIE.", cpumask_pr_args(amu_fie_cpus));