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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B777DC4332F for ; Mon, 11 Apr 2022 10:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345601AbiDKKgQ (ORCPT ); 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 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 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 485BFC433EF for ; Mon, 11 Apr 2022 10:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZVCH5phRGCjJNLnZ9D2viAnYwBBC2fI8d/ufZ4KQXUY=; b=eo6tD3f3D22pgW 8C5iHKMGcmVYKgmA3R8U1BW+LtybTWIbwOSNyyB3RmEZfIchC3psddA20AaC24b5u9VwuSlzVkG91 +aM84BA1HHC4KQCLd4gPdOUrmxqkD/kYoaB6517SYtJkY3AkW3RfyO5HPi65/vuuac28kuiOSw6kM NvKOn66InyTSZRM6NGImedC08tHj/xIYqCjTnaFAC3S9vql/fKaiLc/CzBkP8LV4zMxzyd5LUBG98 dEJoOnVyGV1A+dl4ta4gw85QoDMUEWh3b8+fWwg4hpkWDyH2i4XGa4wYRvhjEhKRbM5tmqhXaj3Kj B489rD7C/+ue20etha8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndrVH-008RLd-Lm; Mon, 11 Apr 2022 10:42:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndrMt-008NTX-UX for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2022 10:34:01 +0000 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220411_033400_102850_42F8AFFC X-CRM114-Status: GOOD ( 20.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel