Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1673882pxj; Wed, 19 May 2021 11:09:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxexEBfb1FQSScte92iLBFJlCM2wgWwlnNCcG9mMgbMxpTt1EuI/ldV0hTYYt3UdLbO7V8F X-Received: by 2002:a92:d306:: with SMTP id x6mr342261ila.88.1621447787896; Wed, 19 May 2021 11:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621447787; cv=none; d=google.com; s=arc-20160816; b=KPjCkr0T6k46uA5BemCjo/J7jtYvnAeGF975gIue/LEK65WkFBPcItvAkfYxBxGshA DQyaeTtTm1qim1ecopMrfmY4olttlBRL94qi/dAcX8al4YiGdD+cYy+P11lDknUlnm1l 36sh4iVIlgbtQ9MCKe6GeoNjFDYUK81TvY/Hws2ZFCuwyQtdRhtgkSqaK35rbFNzCQBw OCef+txtBIZYcMNr7zA3upkJr5QLsKDIbg/dPGiKR2UlysNXTIJspKJKb03T5UnWt5ZP iUTh3ooNwDhbQIdjo+KpDEYR79Ub/2e0YufkZJn+ws53skjSqpk5Exk9brUCaaYng7+F nNjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=DzIL2UzZDFpthycuvuiEmwNlRN4MMWa0G9kJO0ADy38=; b=iJ66LGdW5BeKPSfVv2hTtT0NGgJwTVT57TpB5o6TkG4KmWMapMPFlNi3JB8elW98nD 1eS32rGWCKzwLobPKa86gmiQQm+ZM7EGXQ/o3VFn1Sl9bCIjXboE7kkuvMRaV4gG35vN 6BUaN9P9hERfiGVI3R+IwGxxoNR3qmw02eOX3YaE9K+KGo5aTzJmh6IEli4Zsf6Wk30R ggGk5jiTumMgbbNMkfxHilsc7AhUKdV6Ejl1XXoKUtbkZVIRtNZhLrFoQSzXBivU6fsa qVtoiUmDB85JGeG7pOv5HgzWFwisWbP25D4rqnCUKfxQGbPNUGo2obQsNFWFWec5ban0 akgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si386339ilm.11.2021.05.19.11.09.35; Wed, 19 May 2021 11:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349468AbhERNNg (ORCPT + 99 others); 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