From patchwork Mon Jan 18 01:13:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365825 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 97545C43381 for ; Mon, 18 Jan 2021 01:17:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75B1622597 for ; Mon, 18 Jan 2021 01:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730891AbhARBRg (ORCPT ); Sun, 17 Jan 2021 20:17:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730610AbhARBOh (ORCPT ); Sun, 17 Jan 2021 20:14:37 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE268C061574; Sun, 17 Jan 2021 17:13:55 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id w26so16547981ljo.4; Sun, 17 Jan 2021 17:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ky1yRRPYE3K2/PqCBcIuIXx+q8eWWpmi1zq1iqBWRVA=; b=q+diSSe2R030qndeAFAfZRgHCAIgGRJ6B4aLARKXHXH5QwjRF7xBWB+T+5FpvOTflu jbZp4IVRNExbQlJAYK+fpbxcUSx6lGFwtsi9gV0dX9QoyO14ZmVJ2uPsxNMftGEJW/Vv R/PDVc9pkjEmeOK7saEgS2btpJyGdnU6iCFApPSZ5ccAMLaaCfvpjTY1HZS53A45lqPh vNwbTjbTUUw1XGKw4mt60ehkKpgGTOZhti25T0MDxWUEPeM3LxTcuOZuLSJFtuEd/RLx TiXTuxemmY2hrz2ajxGHR2zUIc0v/M8xiBI8ZSWj5oZrvtYM8OXQcajtJTCJb5sbjYAn rk1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ky1yRRPYE3K2/PqCBcIuIXx+q8eWWpmi1zq1iqBWRVA=; b=bk1eCRaQzME3nsLDPhhakBtf4ByRl1PRW983kMiFwS/xEvTBc4vWhKpPyT4hZOjJ7c WApLSgFwONC2U/iFI1H578fm9cHVGUkJBQIPJrPZV7Eac5yB/JqLcbPxbCjm0/LY+R7t KpSt/DpTeMwRWytoo+un8WfWQRGcvvuxtqWhtdaa9F5BUIt2m0+t253qAu1ASeeLlFKv jQkYfFCRa01DoZFmaCy3AXZFHCeZpCHRZS0qFZkj84uyKjwd/2+aapB02qCvdpfU/YjN ukxMQtJSMGGw9oeKa+Yigc06VKUvlhA7Nnw4Xlxy0jol9gDoNdKusFQzWUKDhRoc1V8k 3I3Q== X-Gm-Message-State: AOAM533up44qQAcdJ9zxsgBmM9LWgoN3K7V3RvajcXofmEyUzxG4rCzp 0/qkdViuK2LCLRl5IVF3jFM= X-Google-Smtp-Source: ABdhPJzP8/KyLz++yd6Vo1A+C0ydVblu+PMmSfSpVzN0iuYCstDuNRogG2NSYmgsci6UsnvRuZCJaw== X-Received: by 2002:a2e:920b:: with SMTP id k11mr9606381ljg.313.1610932434282; Sun, 17 Jan 2021 17:13:54 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id l84sm1710836lfd.75.2021.01.17.17.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 17:13:53 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Greg Kroah-Hartman , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 1/3] PM: domains: Make set_performance_state() callback optional Date: Mon, 18 Jan 2021 04:13:28 +0300 Message-Id: <20210118011330.4145-2-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118011330.4145-1-digetx@gmail.com> References: <20210118011330.4145-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Make set_performance_state() callback optional in order to remove the need from power domain drivers to implement a dummy callback. If callback isn't implemented by a GENPD driver, then the performance state is passed to the parent domain. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Suggested-by: Ulf Hansson Reviewed-by: Ulf Hansson Signed-off-by: Dmitry Osipenko Reviewed-by: Viresh Kumar --- drivers/base/power/domain.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 9a14eedacb92..a3e1bfc233d4 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -339,9 +339,11 @@ static int _genpd_set_performance_state(struct generic_pm_domain *genpd, goto err; } - ret = genpd->set_performance_state(genpd, state); - if (ret) - goto err; + if (genpd->set_performance_state) { + ret = genpd->set_performance_state(genpd, state); + if (ret) + goto err; + } genpd->performance_state = state; return 0; @@ -399,9 +401,6 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) if (!genpd) return -ENODEV; - if (unlikely(!genpd->set_performance_state)) - return -EINVAL; - if (WARN_ON(!dev->power.subsys_data || !dev->power.subsys_data->domain_data)) return -EINVAL; From patchwork Mon Jan 18 01:13:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365826 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 0C986C433DB for ; Mon, 18 Jan 2021 01:16:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7BF62075B for ; Mon, 18 Jan 2021 01:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730652AbhARBPd (ORCPT ); Sun, 17 Jan 2021 20:15:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730611AbhARBOh (ORCPT ); Sun, 17 Jan 2021 20:14:37 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2619C061575; Sun, 17 Jan 2021 17:13:56 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id o17so21705198lfg.4; Sun, 17 Jan 2021 17:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nCuBXNhGojlrgJVxSay00xtDttizwyfPZHpVA3kvWHc=; b=oszOrekknXS9fkwgtul+5DMPuV0bcT2R17dEPyNlxmF5V8qqrCiR/PYZlrPH4FvAKv NQGq3zrIW/aFj5OzgxIzhYnIDLkneLKWXkyOxrChrYQxsb3W/VRXaWjVKyQr00nwF1HX Y7mJERYIIGCzZQ/OKIaYxA0Y51eq0yXy6Pqej5kmqjj28a/T+Fn4ylCwcwkEwdpU+KMT XVdRgswyw49QRSzkf+BsqjA6M8B6iK98k6J8z15HqJLGV9SyHx71FHn6X5o0AqO2zu62 9D1s7gFO+bB4DkhKSQ0+ej5xehNOJ9FaSIstrVO1ldNXBj7ZLxFBOGNrYEfIGphZulFz iAUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nCuBXNhGojlrgJVxSay00xtDttizwyfPZHpVA3kvWHc=; b=nff3WvxcXtohYgDWKt5+zIRE6Fic5eaA1hwx4vLoxxA92Va5M29IHeRz3UDNbnFpBS NNAxCP3WKa3+DUccXZXZPCHGhnd6aO+KDUWBPQmcnHbyt9imCCAuN+DyE4em8VQgjt64 /27BtaZZHOcB6f4tafUgR5cnzyMDOwL7/QisyC18mBaFzZ3hsZnRiQRZtQJBtE/hh/4k 6Ndcs9KrL/j4SmF6hIoVpbRmJ0+WV5C9gDNf4zo9bDELYoo+/AcMbGzdVPkyPhaMwLBS w+dXd56nTbFV95iwxxxfc8D28A1z/NxWytIE5ncIXZVVR+V3NG7QI5ykG8FyWbQhxFEB Sg+w== X-Gm-Message-State: AOAM533gkRF9U7vIZnAPbseRfC7mdH45ihHQk1pmH5k0jDwhVu3MYGUM 8oRyC78LLYDV9e7xTZQCP80= X-Google-Smtp-Source: ABdhPJz0XMurcJmPJ3DTpkXeeGjl31IA9sGKlHz+e92BjWIqjVlBNPlNEO69/gxvaNhBszp3jKaAMg== X-Received: by 2002:ac2:4a71:: with SMTP id q17mr9711227lfp.11.1610932435222; Sun, 17 Jan 2021 17:13:55 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id l84sm1710836lfd.75.2021.01.17.17.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 17:13:54 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Greg Kroah-Hartman , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 2/3] PM: domains: Add "performance" column to debug summary Date: Mon, 18 Jan 2021 04:13:29 +0300 Message-Id: <20210118011330.4145-3-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118011330.4145-1-digetx@gmail.com> References: <20210118011330.4145-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add "performance" column to debug summary which shows performance state of all power domains and theirs devices. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Reviewed-by: Ulf Hansson Signed-off-by: Dmitry Osipenko --- drivers/base/power/domain.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index a3e1bfc233d4..2ab77aa516eb 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2951,7 +2951,15 @@ static void rtpm_status_str(struct seq_file *s, struct device *dev) else WARN_ON(1); - seq_puts(s, p); + seq_printf(s, "%-25s ", p); +} + +static void perf_status_str(struct seq_file *s, struct device *dev) +{ + struct generic_pm_domain_data *gpd_data; + + gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); + seq_put_decimal_ull(s, "", gpd_data->performance_state); } static int genpd_summary_one(struct seq_file *s, @@ -2979,7 +2987,7 @@ static int genpd_summary_one(struct seq_file *s, else snprintf(state, sizeof(state), "%s", status_lookup[genpd->status]); - seq_printf(s, "%-30s %-15s ", genpd->name, state); + seq_printf(s, "%-30s %-50s %u", genpd->name, state, genpd->performance_state); /* * Modifications on the list require holding locks on both @@ -2987,6 +2995,8 @@ static int genpd_summary_one(struct seq_file *s, * Also genpd->name is immutable. */ list_for_each_entry(link, &genpd->parent_links, parent_node) { + if (list_is_first(&link->parent_node, &genpd->parent_links)) + seq_printf(s, "\n%48s", " "); seq_printf(s, "%s", link->child->name); if (!list_is_last(&link->parent_node, &genpd->parent_links)) seq_puts(s, ", "); @@ -3001,6 +3011,7 @@ static int genpd_summary_one(struct seq_file *s, seq_printf(s, "\n %-50s ", kobj_path); rtpm_status_str(s, pm_data->dev); + perf_status_str(s, pm_data->dev); kfree(kobj_path); } @@ -3016,9 +3027,9 @@ static int summary_show(struct seq_file *s, void *data) struct generic_pm_domain *genpd; int ret = 0; - seq_puts(s, "domain status children\n"); + seq_puts(s, "domain status children performance\n"); seq_puts(s, " /device runtime status\n"); - seq_puts(s, "----------------------------------------------------------------------\n"); + seq_puts(s, "----------------------------------------------------------------------------------------------\n"); ret = mutex_lock_interruptible(&gpd_list_lock); if (ret)