Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp801577pxb; Tue, 12 Apr 2022 13:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3fzo5OlJnbURtw4dLr6DGRJmn3LBuYlONo0B/QaLyU7MJMnMdbZjs3li245Y7Djxj8Z6J X-Received: by 2002:a63:2248:0:b0:39d:48fd:7d73 with SMTP id t8-20020a632248000000b0039d48fd7d73mr10825387pgm.372.1649796720126; Tue, 12 Apr 2022 13:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649796720; cv=none; d=google.com; s=arc-20160816; b=cbQn9wZ/vYWbVw+zFlylgm81smW6wb+9JaH/DU2U4UslgfbZzVTlc5AFYqAuxoOcb6 nXGT9RTX/ZNXDjTJIVTxCalXRaoVd3jewpo+hnEaJH/tz3vVr5huBHyZcd09riFTUjcG wtRJJjkJ6HJN0mLHRi3G9mWdN6OINl/6BwFCW9IteBdLhELNu+yZSc4RGmyx381hIkhY wELUTltfECsaB552JbOrE81Z/hraeXXin2Rzaey80/mXYch1aU53QVj1L5Ju5ucC24h4 oi7zRGIMhTDauV+RhYEOLac4Ym6p9JbvC1pliZCEo4LWIRyQi9hVucSuvotsYFOE89VN LEMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=TdpNrxEV0cg6B65+pdJqkagMcncls5FXdOC1ccv63lo=; b=EObrN8c/+Nd4MLk/ZqLMWF9wq0PaphvCA1TQrTTlAWXWs1JKFqdt4/cd0zLUSSZ9fC kS7by5r4674COsiQeyP60rjm1SOd+sEjtR7gmpCJgdMRCTB7yGfycx74DYELFrTxPFIr 0aZ08zcX8KhWURMWajrvEmPW39vm2rwmAcToYSEp4wj5MehN1ivqVi8aS+U5PZlh/D5/ 9WLI8WBEZVOaIKB8byqK3Tng/5FmngV9gZCSRiOVpyIbpbV9smC/IP3oNauaC7WbwVrY dVVEZ6YEBjKiQfJmJrSsmxOS1HO31B0/QRjhY1Q2++cjyibP+UP7uztw7Ik5XD8p2JDV dSqw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c17-20020a6566d1000000b0039d9af9b639si2474149pgw.807.2022.04.12.13.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:52:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 252E4C8BD6; Tue, 12 Apr 2022 13:19:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239001AbiDKKgQ (ORCPT + 99 others); Mon, 11 Apr 2022 06:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345624AbiDKKgN (ORCPT ); Mon, 11 Apr 2022 06:36:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D9C343AF3; Mon, 11 Apr 2022 03:33:59 -0700 (PDT) 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 EE8F8169C; Mon, 11 Apr 2022 03:33:58 -0700 (PDT) Received: from [192.168.1.11] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9923B3F5A1; Mon, 11 Apr 2022 03:33:55 -0700 (PDT) Message-ID: Date: Mon, 11 Apr 2022 12:34:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2 1/3] cpufreq: CPPC: Add cppc_cpufreq_search_cpu_data Content-Language: en-US To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, Ionela.Voinescu@arm.com, Lukasz.Luba@arm.com, Morten.Rasmussen@arm.com, Dietmar.Eggemann@arm.com, maz@kernel.org, Catalin Marinas , Will Deacon , "Rafael J. Wysocki" , Mark Rutland , Ard Biesheuvel , Fuad Tabba , Valentin Schneider , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org References: <20220407081620.1662192-1-pierre.gondois@arm.com> <20220407081620.1662192-2-pierre.gondois@arm.com> <20220411031015.skh3dw6vcbtn5f4u@vireshk-i7> From: Pierre Gondois In-Reply-To: <20220411031015.skh3dw6vcbtn5f4u@vireshk-i7> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/11/22 05:10, Viresh Kumar wrote: > On 07-04-22, 10:16, Pierre Gondois wrote: >> From: Pierre Gondois >> >> cppc_cpufreq_get_cpu_data() allocates a new struct cppc_cpudata >> for the input CPU at each call. >> >> To search the struct associated with a cpu without allocating >> a new one, add cppc_cpufreq_search_cpu_data(). >> Also add an early prototype. >> >> This will be used in a later patch, when generating artificial >> performance states to register an artificial Energy Model in the >> cppc_cpufreq driver and enable the Energy Aware Scheduler for ACPI >> based systems. >> >> Signed-off-by: Pierre Gondois >> --- >> drivers/cpufreq/cppc_cpufreq.c | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> >> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c >> index 82d370ae6a4a..ffcd9704add2 100644 >> --- a/drivers/cpufreq/cppc_cpufreq.c >> +++ b/drivers/cpufreq/cppc_cpufreq.c >> @@ -41,6 +41,8 @@ >> */ >> static LIST_HEAD(cpu_data_list); >> >> +static struct cppc_cpudata *cppc_cpufreq_search_cpu_data(unsigned int cpu); >> + >> static bool boost_supported; >> >> struct cppc_workaround_oem_info { >> @@ -479,6 +481,19 @@ static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy) >> policy->driver_data = NULL; >> } >> >> +static struct cppc_cpudata * >> +cppc_cpufreq_search_cpu_data(unsigned int cpu) >> +{ >> + struct cppc_cpudata *iter, *tmp; >> + >> + list_for_each_entry_safe(iter, tmp, &cpu_data_list, node) { >> + if (cpumask_test_cpu(cpu, iter->shared_cpu_map)) >> + return iter; >> + } >> + >> + return NULL; >> +} > > Did you miss this in cppc_cpufreq_cpu_init() ? > > policy->driver_data = cpu_data; > > The data is saved inside the policy and it shouldn't be difficult to > fetch it from there, instead of going through the list. > A previous (internal) implementation required this function, but this is not necessary anymore indeed. I will drop this patch, Thanks for the review, Pierre