Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3047189rdb; Tue, 6 Feb 2024 05:55:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcuoy5k5VZHh7KPefDdtPDkd7OydziNahdvye1NdW2Lood3sy1At+SM11Mh5dlWUbNPymi X-Received: by 2002:a05:6214:ca2:b0:68c:6720:fe8d with SMTP id s2-20020a0562140ca200b0068c6720fe8dmr3062024qvs.5.1707227726136; Tue, 06 Feb 2024 05:55:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707227726; cv=pass; d=google.com; s=arc-20160816; b=ke+PAoHDaNxBoilLugWpVCOObrYVMatnDqlgCxJR/Py9DLnyMmXawJP+LFpbiMgJxm UeEcHwFoWg3eAECPeObqJ2ttHknZy07InWRbMVoLWpxu42GSGW/ZFNT3BZ0XMCh7XreT EmzC8W7oo07hY19HJfHIpgCzYN1gtbZtxz5LzIVzWE4gAGYbQF7CFMLiRfZfqLqKKlu1 YhRh7JC9ipaiSASJCfbZ8HBO5Gh46N2vmBt/UIxAPNMZV33JH2sYg6mbdj6utB0ryRkI z2CKCUA4/tOvwDJZXMuxFbMz6Fv0ri0Mvc8sHhSb32/VXBBnQFkK3DJLaKK1+kLssj4/ CHXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=CHdY/YJXqItHhroaGu4//Iplr3oa3AdC/0+VZR2L2EE=; fh=dHYNafoj5WLHZfSEcLUI7/pSOzghrQkk8T8USA8Z8kE=; b=eZdNWBlozy61NRhSFtRt7d+f2/wOYn8bHyg3HCcQUzSlgL1S0ALxJ7Qk6bIy/14Jgb GyYBL7s3cuHAKAzfatJKLU+6tvfUmpRHLyxRcteHfkd87QKOUpKgTp5YPegvtoBseWAY suhyzb5VS/7MT3zWVHafw6k6/4jewfXLFkGtIwmMiUYS2BebpTpBYSthFqkfQlcp3ugo 7dAFjpYE/5fsb77hYAnNyJBdwEuVASsL/8J5LgbwcWRLV5WOYDuDoiK5Rqm+x4k16mdM eDUvCP2GhRnHom6h8cIjAUD2fSWn2/0uvuDdXuv7KiU8FcEw82RqJVbRt0pj3q3k9kKx wsQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-55058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55058-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCV3KidtTHv47wGLQWNp/rYvm1cE0P9b8OmJfgvahmkOkpM3yRWJv+Qg6gNme4abcEgTX4OoHd7U98g4CvuU7LgIv3JpyL/wlPosVYG0tA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c4-20020ad45ae4000000b0068cb1b44a1fsi1875820qvh.20.2024.02.06.05.55.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 05:55:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-55058-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55058-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 44DCD1C24597 for ; Tue, 6 Feb 2024 13:55:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1849413175F; Tue, 6 Feb 2024 13:55:08 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B9DE13172C; Tue, 6 Feb 2024 13:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707227707; cv=none; b=dPVniAUjek+49KEfeJcWmZCu274Nixzh+pE2AbO7fs5bD6ebkmmzn6YmZBznqnQb7axLngJSuSuxvpUejPWUeBauA0Bhu60YnSnGbXTBwhjCRz7bOSFsLR+FO+q4sg+wSlaDSFHYDWbRp4sdtrak1l54xDOn2sTmdwCQkBhwbvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707227707; c=relaxed/simple; bh=y7hFzdM5gfW98UTKnof7sSf3t1mVUOaS5iaSkMOD3gA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Rr/+LOpZZUknxMz4AgNEBYC9KrJ0wG2fdEftOl7OmR/dxrOIpgD3ORFlxKMqqGCJuVUVs4/Le267UQ4x9peDLjfhVLQ7u7ASxiT1SUpcaY3nZKQ+avLmw7cVHwUKm0VnpX5TnFPHr25F12NwRwo9vDd/YU9Z2kWp7bU0CQbcuPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 610991FB; Tue, 6 Feb 2024 05:55:47 -0800 (PST) Received: from [10.57.8.150] (unknown [10.57.8.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7AFDE3F5A1; Tue, 6 Feb 2024 05:55:02 -0800 (PST) Message-ID: Date: Tue, 6 Feb 2024 13:55:13 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 12/23] PM: EM: Add em_perf_state_from_pd() to get performance states table Content-Language: en-US To: Dietmar Eggemann Cc: rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com, xuewen.yan94@gmail.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org References: <20240117095714.1524808-1-lukasz.luba@arm.com> <20240117095714.1524808-13-lukasz.luba@arm.com> <3e1a2865-e40e-4a7e-9c75-5768d717a1a6@arm.com> From: Lukasz Luba In-Reply-To: <3e1a2865-e40e-4a7e-9c75-5768d717a1a6@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/29/24 18:13, Dietmar Eggemann wrote: > On 17/01/2024 10:57, Lukasz Luba wrote: > > [...] > >> diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h >> index 494df6942cf7..5ebe9dbec8e1 100644 >> --- a/include/linux/energy_model.h >> +++ b/include/linux/energy_model.h >> @@ -339,6 +339,23 @@ static inline int em_pd_nr_perf_states(struct em_perf_domain *pd) >> return pd->nr_perf_states; >> } >> >> +/** >> + * em_perf_state_from_pd() - Get the performance states table of perf. >> + * domain >> + * @pd : performance domain for which this must be done >> + * >> + * To use this function the rcu_read_lock() should be hold. After the usage >> + * of the performance states table is finished, the rcu_read_unlock() should >> + * be called. >> + * >> + * Return: the pointer to performance states table of the performance domain >> + */ >> +static inline >> +struct em_perf_state *em_perf_state_from_pd(struct em_perf_domain *pd) > > This is IMHO hard to get since: > > struct em_perf_table { > struct rcu_head rcu; > struct kref kref; > struct em_perf_state state[]; > }; > > So very often a 'struct em_perf_table' is named 'table' and 'struct > em_perf_table::state' as well. E.g. in em_adjust_new_capacity(). > > struct em_perf_state *new_table; > > new_table = em_table->state; > > In older EM code, we used 'struct em_perf_state *ps' to avoid this > confusion, I guess. > > And what you get from the PD is actually a state vector so maybe: > > struct em_perf_state *em_get_perf_states(struct em_perf_domain *pd) > > The 'from_pd' seems obvious because of the parameter? Rafael proposed that function name in his review comments, so I followed. I might address your comment about the: 'struct em_perf_state *ps' while I will do re-basing and sending v8.