Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp364447rdh; Tue, 19 Dec 2023 00:54:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpKpUuxgCvVBgKOFBEupNz2zzywWhF1xa3u/p+K2Av+/b/1a0KGdxRTB+bLqBixqe5gD5J X-Received: by 2002:a17:903:41cd:b0:1d0:7490:4ab8 with SMTP id u13-20020a17090341cd00b001d074904ab8mr8718008ple.7.1702976098728; Tue, 19 Dec 2023 00:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702976098; cv=none; d=google.com; s=arc-20160816; b=kISKdvAn6HzVX6WoHqQOMYSsdDC4Q3EZOsSw3Y5l/3CzqmVfj9ZU14FtlzxLK0JU/R 1T5A9UPvTdTEQaU1dIOj2EBoXUNGFvak5ykr32x6zYpZ5RlvWjP6eI8Bh+onl7dT4U/b 4EnwgsE/IOrxdEsWAi8hyxkbj9TgXEp0B+M9v/FFOIwtqkHQLCElSiV7W/MdBcSVPRoI dykZ6NWo7WeogXBHV/O0Jmx36EqkVVM1yh1XVBDJGFNT4+djMdAR1EJKMDtyphM2WwV4 6B9IvURAiew1GWW3fIGWpEICkDMUVTxEeR/CVUcM+Yl5hezsW31z20x1pVvRwhAmPOiV /kXQ== ARC-Message-Signature: i=1; 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=v4e9J0YGHk6j3FXTf4OWBfK5yZfrx/whUNMQh45asac=; fh=J/p+DtVyEoVa934YZKq/hgBNWRpdBKZo2Ma3QDpRqus=; b=jKTaAos5pJa9qh494on1B9CedJwuuGX2a5x+y8gm5CgaiKPqQCDl5Mw25SD3jKhslW dUzlHnCoMndxuomddZm6hlo9mFD0X6BAO8vVY8C5n0ay1ZAUQNFpjra33bKUVUecw5cc k9+s32DrJeCVQCkyB9PZCODNV2do7hh6xRC6qht5lgPLxaNMEK+bsXHJLn2jsSi4SLgW IAuJSFYg8hb04jeElL9cbVONmwOWTtWIHyGmIWCVYZFCzEPpyVBrixqFdwbFWpRogj69 +Ntt4asce2CDFOtMiiJf8FPcL+eRA59pB0ZzO0fvrStVZk2zmZWM1y8LR/lD6RxaqB3i QG0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n12-20020a1709026a8c00b001cfb316a183si3790814plk.141.2023.12.19.00.54.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 00:54:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4915-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0EDF2287AEA for ; Tue, 19 Dec 2023 08:48:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FD0A18022; Tue, 19 Dec 2023 08:46:06 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96F1B156E5; Tue, 19 Dec 2023 08:46:04 +0000 (UTC) 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 34EAC1FB; Tue, 19 Dec 2023 00:46:48 -0800 (PST) Received: from [10.57.85.227] (unknown [10.57.85.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 975A33F738; Tue, 19 Dec 2023 00:46:01 -0800 (PST) Message-ID: <581606cc-79ca-4f49-8ae4-cf4a18def0cb@arm.com> Date: Tue, 19 Dec 2023 08:47:07 +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 v5 23/23] Documentation: EM: Update with runtime modification design Content-Language: en-US To: Xuewen Yan Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org, dietmar.eggemann@arm.com, 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 References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-24-lukasz.luba@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/19/23 04:42, Xuewen Yan wrote: > On Wed, Nov 29, 2023 at 7:11 PM Lukasz Luba wrote: [snip] >> + >> + -> drivers/soc/example/example_em_mod.c >> + >> + 01 static void foo_get_new_em(struct device *dev) >> + 02 { >> + 03 struct em_perf_table __rcu *runtime_table; >> + 04 struct em_perf_state *table, *new_table; >> + 05 struct em_perf_domain *pd; >> + 06 unsigned long freq; >> + 07 int i, ret; >> + 08 >> + 09 pd = em_pd_get(dev); >> + 10 if (!pd) >> + 11 return; >> + 12 >> + 13 runtime_table = em_allocate_table(pd); >> + 14 if (!runtime_table) >> + 15 return; >> + 16 >> + 17 new_table = runtime_table->state; >> + 18 >> + 19 table = em_get_table(pd); >> + 20 for (i = 0; i < pd->nr_perf_states; i++) { >> + 21 freq = table[i].frequency; >> + 22 foo_get_power_perf_values(dev, freq, &new_table[i]); >> + 23 } >> + 24 em_put_table(); >> + 25 >> + 26 /* Calculate 'cost' values for EAS */ >> + 27 ret = em_dev_compute_costs(dev, table, pd->nr_perf_states); >> + 28 if (ret) { >> + 29 dev_warn(dev, "EM: compute costs failed %d\n", ret); >> + 30 em_free_table(runtime_table); >> + 31 return; >> + 32 } >> + 33 >> + 34 ret = em_dev_update_perf_domain(dev, runtime_table); >> + 35 if (ret) { >> + 36 dev_warn(dev, "EM: update failed %d\n", ret); >> + 37 em_free_table(runtime_table); >> + 38 return; >> + 39 } >> + 40 >> + 41 ctx->runtime_table = runtime_table; > > Because here is ctx, maybe the foo_get_new_em(struct device *dev) > shoule be foo_get_new_em(struct foo_context *ctx)? Make sense, I will change that bit. Thanks!