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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDAE9C64E8A for ; Wed, 2 Dec 2020 17:10:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A55121D81 for ; Wed, 2 Dec 2020 17:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbgLBRKb (ORCPT ); Wed, 2 Dec 2020 12:10:31 -0500 Received: from foss.arm.com ([217.140.110.172]:45360 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbgLBRKa (ORCPT ); Wed, 2 Dec 2020 12:10:30 -0500 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 4442D1FB; Wed, 2 Dec 2020 09:09:44 -0800 (PST) Received: from [10.57.31.176] (unknown [10.57.31.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BBE363F575; Wed, 2 Dec 2020 09:09:40 -0800 (PST) Subject: Re: [PATCH v4 4/4] powercap/drivers/dtpm: Add CPU energy model based support To: Daniel Lezcano Cc: rjw@rjwysocki.net, ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Thara Gopinath , Lina Iyer , Ram Chandrasekar , Zhang Rui , Palmer Dabbelt , Anup Patel , Michael Ellerman , Kajol Jain , Zqiang , Daniel Jordan , Mike Leach , Atish Patra , Andrew Jones References: <20201201192801.27607-1-daniel.lezcano@linaro.org> <20201201192801.27607-5-daniel.lezcano@linaro.org> From: Lukasz Luba Message-ID: <54ca2ae1-a7c5-f587-c1e7-583b5e3113af@arm.com> Date: Wed, 2 Dec 2020 17:09:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20201201192801.27607-5-daniel.lezcano@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/1/20 7:28 PM, Daniel Lezcano wrote: > With the powercap dtpm controller, we are able to plug devices with > power limitation features in the tree. > > The following patch introduces the CPU power limitation based on the > energy model and the performance states. > > The power limitation is done at the performance domain level. If some > CPUs are unplugged, the corresponding power will be subtracted from > the performance domain total power. > > It is up to the platform to initialize the dtpm tree and add the CPU. > > Here is an example to create a simple tree with one root node called > "pkg" and the CPU's performance domains. > > static int dtpm_register_pkg(struct dtpm_descr *descr) > { > struct dtpm *pkg; > int ret; > > pkg = dtpm_alloc(NULL); > if (!pkg) > return -ENOMEM; > > ret = dtpm_register(descr->name, pkg, descr->parent); > if (ret) > return ret; > > return dtpm_register_cpu(pkg); > } > > static struct dtpm_descr descr = { > .name = "pkg", > .init = dtpm_register_pkg, > }; > DTPM_DECLARE(descr); > > Cc: Thara Gopinath > Cc: Lina Iyer > Cc: Ram Chandrasekar > Cc: Zhang Rui > Signed-off-by: Daniel Lezcano LGTM Reviewed-by: Lukasz Luba Tested-by: Lukasz Luba Regards, Lukasz