From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 139E7C433B4 for ; Tue, 18 May 2021 13:12:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8FC36109E for ; Tue, 18 May 2021 13:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349472AbhERNNg (ORCPT ); Tue, 18 May 2021 09:13:36 -0400 Received: from foss.arm.com ([217.140.110.172]:51750 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbhERNNf (ORCPT ); Tue, 18 May 2021 09:13:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DA511D6E; Tue, 18 May 2021 06:12:17 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6DD873F73B; Tue, 18 May 2021 06:12:16 -0700 (PDT) From: Valentin Schneider To: Ionela Voinescu , Sudeep Holla , "Rafael J . Wysocki" , Thomas Gleixner , Ingo Molnar , Giovanni Gherdovich , Catalin Marinas , Will Deacon Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/3] arch_topology: obtain cpu capacity using information from CPPC In-Reply-To: <20210514095339.12979-3-ionela.voinescu@arm.com> References: <20210514095339.12979-1-ionela.voinescu@arm.com> <20210514095339.12979-3-ionela.voinescu@arm.com> Date: Tue, 18 May 2021 14:12:14 +0100 Message-ID: <87eee41901.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/05/21 10:53, Ionela Voinescu wrote: > +#ifdef CONFIG_ACPI_CPPC_LIB > +#include > + > +void init_cpu_capacity_cppc(void) > +{ > + struct cppc_perf_caps perf_caps; > + int cpu; > + > + if (likely(acpi_disabled || !acpi_cpc_valid())) > + return; > + > + raw_capacity = kcalloc(num_possible_cpus(), sizeof(*raw_capacity), > + GFP_KERNEL); Per the below loop, the memory shouldn't need to be cleared. > + if (!raw_capacity) > + return; > + > + for_each_possible_cpu(cpu) { > + if (!cppc_get_perf_caps(cpu, &perf_caps)) { > + raw_capacity[cpu] = perf_caps.highest_perf; > + pr_debug("%s: CPU%d cpu_capacity=%u (raw).\n", > + __func__, cpu, raw_capacity[cpu]); > + } else { > + pr_err("%s: CPU%d missing highest performance.\n", > + __func__, cpu); > + pr_err("%s: fallback to 1024 for all CPUs\n", > + __func__); > + goto exit; > + } > + } > + > + topology_normalize_cpu_scale(); > + schedule_work(&update_topology_flags_work); > + pr_debug("%s: cpu_capacity initialization done\n", __func__); > + > +exit: > + free_raw_capacity(); > +} > +#endif