Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1730522rda; Tue, 24 Oct 2023 01:09:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCHEU9MMV27u8jacx69hzlURHO8M63qDpo7ke/E3A5cNHzXbZAPGf21/89n57b38nrcv6A X-Received: by 2002:a05:6359:4811:b0:168:e845:ec22 with SMTP id oj17-20020a056359481100b00168e845ec22mr3366532rwb.13.1698134973338; Tue, 24 Oct 2023 01:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698134973; cv=none; d=google.com; s=arc-20160816; b=TD4eCWLuOzN6mM2CP9SImhrUGfVmohF0RXdYHroqkUxMCSYfYC7d1mBXCybL5bWwUV /YhYLrwAzYNKtWyIX9b+c9LyiGnagJnQgjJFoWLVOayOHRXvNlXEiTD3VkplOTKBz52T 60Qa1Wygap62Tt19vkDvVAKd3m1Mz7gw8r/FnZr3Bi2U1k1umudqdNEEqa8J3o7kAarX 3u0LbDPnQfkrIf1atj2cQjeqHO+B4kgQaCrNYXFRfQ30OJT2OByPOZC5yBQ+5U5MAMxQ uTzB00LF5W6ERodJQzyw8g8irST+QRJD+hg+KS4ylFyPW7XuBAlY9oeBkMbDFtxABj+6 C3Kw== 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=TP9EF65jXIorzqFbsNhos38zuRhNERj08RNfoL8aq+k=; fh=qyZ8XHtTps8DyO8usAOfZjZKUKFZquCa3nwxKe7j5TE=; b=nMqExV39RpTeXAUG/icyymAKZ9r7PtlXZYf7YHb7v0Md0cAVHsinMqcQyh0KXYOEjz G9AznYDTHw2Mn9hJyi0EGVQ9HHL6npEzAndbyoB3HFFu0okdq2YUhdOV4naHDXL2dSn8 6l2T2zbMFNdwlDAyYdkJx9eZktwemBWLP92B1D+wcKj9Co7S2pnlitBQwCsITCIuTfQp ZWSa35NGKOUKgf6Ucv7CkqwH6yuZauFGWHLm3YDQfNbAwlW/dzaPUnOwhz8aoBTog+Gf 4DZ0NjaqM7HUtpPrHGgvm9sBPeaFEd7MbimxbRA9fPvrae5mOI9aToPXc+d/yv9Vq8DL 2r4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b005b7160263efsi522915pgb.489.2023.10.24.01.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 01:09:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 13213804C6C1; Tue, 24 Oct 2023 01:09:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbjJXIJW (ORCPT + 99 others); Tue, 24 Oct 2023 04:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbjJXIJO (ORCPT ); Tue, 24 Oct 2023 04:09:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 47EC699; Tue, 24 Oct 2023 01:09:01 -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 E43E82F4; Tue, 24 Oct 2023 01:09:41 -0700 (PDT) Received: from [10.57.83.179] (unknown [10.57.83.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCC823F762; Tue, 24 Oct 2023 01:08:58 -0700 (PDT) Message-ID: Date: Tue, 24 Oct 2023 09:09:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 04/18] PM: EM: Refactor em_pd_get_efficient_state() to be more flexible Content-Language: en-US To: Daniel Lezcano Cc: dietmar.eggemann@arm.com, rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org References: <20230925081139.1305766-1-lukasz.luba@arm.com> <20230925081139.1305766-5-lukasz.luba@arm.com> <6786c91e-12ce-a9dd-12fe-bc02c6d782b8@linaro.org> From: Lukasz Luba In-Reply-To: <6786c91e-12ce-a9dd-12fe-bc02c6d782b8@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 24 Oct 2023 01:09:30 -0700 (PDT) On 10/23/23 18:39, Daniel Lezcano wrote: > On 25/09/2023 10:11, Lukasz Luba wrote: >> The Energy Model (EM) is going to support runtime modification. There >> are going to be 2 EM tables which store information. This patch aims >> to prepare the code to be generic and use one of the tables. The function >> will no longer get a pointer to 'struct em_perf_domain' (the EM) but >> instead a pointer to 'struct em_perf_state' (which is one of the EM's >> tables). >> >> Prepare em_pd_get_efficient_state() for the upcoming changes and >> make it possible to re-use. Return an index for the best performance >> state for a given EM table. The function arguments that are introduced >> should allow to work on different performance state arrays. The caller of >> em_pd_get_efficient_state() should be able to use the index either >> on the default or the modifiable EM table. >> >> Signed-off-by: Lukasz Luba >> --- > > [ ... ] > >> @@ -251,7 +253,9 @@ static inline unsigned long em_cpu_energy(struct >> em_perf_domain *pd, >>        * Find the lowest performance state of the Energy Model above the >>        * requested frequency. >>        */ >> -    ps = em_pd_get_efficient_state(pd, freq); >> +    i = em_pd_get_efficient_state(pd->table, pd->nr_perf_states, freq, >> +                      pd->flags); > > nitpicking but s/i/state/ Here it makes sense, I'll try to use 'state', but if that could be a bit odd in later patches code, where I have: ps = &runtime_table->state[i]; than: '->state[state]' won't fly. Although, let me check, because I'm going to drop the 2 tables design so some fields might get different names. > > Other than that: > > Reviewed-by: Daniel Lezcano Thanks! > > >> +    ps = &pd->table[i]; >>       /* >>        * The capacity of a CPU in the domain at the performance state >> (ps) >