Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp972156pxp; Wed, 16 Mar 2022 23:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzst9OSD57jhPWMzym32REujXS5SH2Pipo0M3Qj/sUWpsjPAcgHJCPCt4zAFBqaAYn72Etb X-Received: by 2002:a17:902:8601:b0:153:95da:fcdd with SMTP id f1-20020a170902860100b0015395dafcddmr3148829plo.104.1647497103724; Wed, 16 Mar 2022 23:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647497103; cv=none; d=google.com; s=arc-20160816; b=EiRHdpkp07x1fLDx5MtcKkT+E5Gj35HTH9EgeMclhb95wOCJVlzw6jVCccV/7KV4zC 28ZB2r6djQn4M1UiQnP0ODF8D310ksZFpr6z1+lmuEy0Efu3tQHgg3209Xtaew+ctc8H vzUs3dscwS/z9hs/IQJpa9lYByGMDa7qTc0TiNiXbjhLu+B3MuFYq7So5lT7mXe4Hzlf 8eQsyG4weQt2ejC7fecY+cG74aj81K8PAtIFcoOWDoenXidn54sxOqPLjwx+A8JZAyIQ EjIfawoRw4BeSu4gUwtBPWJ27ww3/QwbZAD210T8rse8kUz4KezlHEbd4PO00rIUrsV7 eRUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=4l1IjK/V6gWCi6L59LMBO2xOXKYClT2IM/sIKlVtEYU=; b=eKrL2rK9BWnOfwAkqmckAcH9IIcujmxuIsE4KIfpG5nr/0kHEhC5iBt3XokhEY4VQo CHNt4QTAHJ0f06TCFdHsF+uG5GGRn4dPqAuKxWf9Y2WxtnOGds2/OnxzWhDIlZVTZhcX 3ANIPkz2V4N5TAYYV85ahNuryC1oNulMOSRKDCbbis/hvflHVt2Fh5NSVksDTnbOi+0L 40a3iR7FoFwnh6oaosN4GaUKd7VLzpllgsq+Aa9/cJsAxpzHVw+ZaIUDKgm9wWfSnwyh AB/7iXfcky9xJTh9U9LtlfC7Npydar4N5Fl9yRQjm3RBM54T0+cuA12RZ8ONDkmP1AaD yaQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s11-20020a170902b18b00b0014f947e42cesi3652297plr.160.2022.03.16.23.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C6131C6EC9; Wed, 16 Mar 2022 22:09:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351712AbiCPXxt (ORCPT + 99 others); Wed, 16 Mar 2022 19:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349533AbiCPXxo (ORCPT ); Wed, 16 Mar 2022 19:53:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF240DA6; Wed, 16 Mar 2022 16:52:29 -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 AAB86152B; Wed, 16 Mar 2022 16:52:29 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.19.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C9B813F766; Wed, 16 Mar 2022 16:52:26 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org Cc: lukasz.luba@arm.com, dietmar.eggemann@arm.com, Pierre.Gondois@arm.com, ionela.voinescu@arm.com, viresh.kumar@linaro.org, rafael@kernel.org, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, mka@chromium.org, nm@ti.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, cristian.marussi@arm.com, sudeep.holla@arm.com, matthias.bgg@gmail.com Subject: [[PATCH 2/8] PM: EM: Add artificial EM flag Date: Wed, 16 Mar 2022 23:52:05 +0000 Message-Id: <20220316235211.29370-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220316235211.29370-1-lukasz.luba@arm.com> References: <20220316235211.29370-1-lukasz.luba@arm.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre Gondois The Energy Model (EM) can be used on platforms which are missing real power information. Those platforms would implement .get_cost() which populates needed values for the Energy Aware Scheduler (EAS). The EAS doesn't use 'power' fields from EM, but other frameworks might use them. Thus, to avoid miss-usage of this specific type of EM, introduce a new flags which can be checked by other frameworks. Signed-off-by: Pierre Gondois Signed-off-by: Lukasz Luba --- include/linux/energy_model.h | 5 +++++ kernel/power/energy_model.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h index 0a3a5663177b..92e82a322859 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h @@ -67,11 +67,16 @@ struct em_perf_domain { * * EM_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip inefficient states when estimating * energy consumption. + * + * EM_PERF_DOMAIN_ARTIFICIAL: The power values are artificial and might be + * created by platform missing real power information */ #define EM_PERF_DOMAIN_MILLIWATTS BIT(0) #define EM_PERF_DOMAIN_SKIP_INEFFICIENCIES BIT(1) +#define EM_PERF_DOMAIN_ARTIFICIAL BIT(2) #define em_span_cpus(em) (to_cpumask((em)->cpus)) +#define em_is_artificial(em) ((em)->flags & EM_PERF_DOMAIN_ARTIFICIAL) #ifdef CONFIG_ENERGY_MODEL #define EM_MAX_POWER 0xFFFF diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index 0153b0ca7b23..6ecee99af842 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -384,6 +384,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states, if (milliwatts) dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS; + else if (cb->get_cost) + dev->em_pd->flags |= EM_PERF_DOMAIN_ARTIFICIAL; em_cpufreq_update_efficiencies(dev); -- 2.17.1