From patchwork Tue Apr 26 14:15:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 566401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98834C433EF for ; Tue, 26 Apr 2022 14:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351529AbiDZOSg (ORCPT ); Tue, 26 Apr 2022 10:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351526AbiDZOSe (ORCPT ); Tue, 26 Apr 2022 10:18:34 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FEC112769 for ; Tue, 26 Apr 2022 07:15:22 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id g19so32214368lfv.2 for ; Tue, 26 Apr 2022 07:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5o32wUvvQH//2mVRnrNn2QEStbroChjE5Xk/XzAuRBk=; b=ZS+FRmGXxGxWy+Sr0qmhaRwRYeghMgckGEwpLe57mjpM/s7TW3ohc4Mcat9ZFwf6jh HbHzKOSNz2NJDBeVwwMgcitMnahz1LqMhGC+7jO78Edqz5IKSKFcO3pd60CyC747oNVB iEFbAfWik+yhAKMHjP1h55bT97a53CxnUJSXEaDVlppg2l0ocHDEmamIQ3FagetDHvOI OiGCe3HnIBSdu0xvbHgUqS1+0H9Vbbf3iPJDDvVFxS32aIbFk5VtiZiDb6h/z95xRfk3 3BSqZHaeXWlCUdJiz9jBsMTjxeJN22axVv6/M4EEuZ7raz+IclxnjJ9ZA0+2P6b2Ziim mGgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5o32wUvvQH//2mVRnrNn2QEStbroChjE5Xk/XzAuRBk=; b=5DewpmrXZl3FbfbrCHuOsp9pP1/ro1bCie2YB85j/FGhCQH+ShiPWYOiRp/DNigSLb 9s5squiKafIDc+cjAUruedAgnFYh+D/+sKP+ZC7q9jW+rXasbS98a7da7owghCQCofea mz1b+LEK9g6+k9n525yNr0d4Tve5MJrHSH612GmQaPb/RTSPhHl8qx8/WU7U/r6OjIs2 Se6IeXxpWm25A9islBhS9bb54Edd1L39krwHtfaMhIJ8ongEx7pE0YB7djka/WLbWXU+ P7mAK2fTWwSOTrsLv2g4h+FFn+pe9hbfPFp8zNVQq00d/DsYKqvJ3VT/l7PJ/mfzrugb hXnw== X-Gm-Message-State: AOAM5319L8+GNUemf2KPVbWOLsKunkRWK+d1wYpBF0RsmDRXGZh4qCt5 zk+opuEcLW+1AKnhsZkZzokT7w== X-Google-Smtp-Source: ABdhPJxI1wm79Ps82LwseJjrRMrpea/rINXfvkndAZAVAPzCBHLRmNGZgLrDZEbnnIZcFl3Yso6hVg== X-Received: by 2002:a05:6512:3f01:b0:46b:a5ba:3b89 with SMTP id y1-20020a0565123f0100b0046ba5ba3b89mr17067969lfa.28.1650982520769; Tue, 26 Apr 2022 07:15:20 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id g23-20020a2ea4b7000000b0024f096abebdsm1043360ljm.78.2022.04.26.07.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 07:15:18 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Kevin Hilman , Vincent Guittot , Geert Uytterhoeven , Dmitry Osipenko , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] PM: domains: Add GENPD_FLAG_RPM_ALWAYS_ON for the always-on governor Date: Tue, 26 Apr 2022 16:15:05 +0200 Message-Id: <20220426141507.89868-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426141507.89868-1-ulf.hansson@linaro.org> References: <20220426141507.89868-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Rather than relying on the genpd provider to set the corresponding flag, GENPD_FLAG_RPM_ALWAYS_ON, when the always-on governor is being used, let's add it in pm_genpd_init(). In this way, it starts to benefits all genpd providers immediately. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 18cd7965e5d6..262bda9b56ef 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2016,6 +2016,10 @@ int pm_genpd_init(struct generic_pm_domain *genpd, genpd->dev_ops.start = pm_clk_resume; } + /* The always-on governor works better with the corresponding flag. */ + if (gov == &pm_domain_always_on_gov) + genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON; + /* Always-on domains must be powered on at initialization. */ if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) && !genpd_status_on(genpd)) From patchwork Tue Apr 26 14:15:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 568736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31E07C433FE for ; Tue, 26 Apr 2022 14:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351525AbiDZOSl (ORCPT ); Tue, 26 Apr 2022 10:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351524AbiDZOSk (ORCPT ); Tue, 26 Apr 2022 10:18:40 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5788F13E9E for ; Tue, 26 Apr 2022 07:15:28 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id w1so32169310lfa.4 for ; Tue, 26 Apr 2022 07:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zxzRefBI77z9hgqatEhKgv+DKfty9U6ghK1LVbo7j6g=; b=QLGRhd2Pi4JCAUmodnhxjytlHsjYsMztxt8K9xc9qpYANI7AaZrhTsscio79IjkUQI yXTk3H5XAsGl1hvlWbmja6j8KSC4ujPyuzGpvoJ01C56f1V0zQfoiuUmz3llwVoHJKBg 4mSQSgXTuwl2xGlP0GuQRQ1CKGSwZ/N6zsFtXfB8Wn3ROzZS1nEFZHTrsxZ0cQlZcroP 7v7G8RaiUEDKK2NNHSGXscxZjbEwOqX3Fw7eaNovtrd6HauNzxO+YfXM4TdncNnICHFv PdU/ClRkVedYyYqtUjd9ZuU23nbodUEy0nQIR2/45L2R9leg7o8jvY1UQa95gM8Y9CD+ f2QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zxzRefBI77z9hgqatEhKgv+DKfty9U6ghK1LVbo7j6g=; b=dDi4RkW3aYmUyPQht1rVEu8gzZb9j+K1AMwQaYqvalzKp/WG8n73M1cCMAusL/cgbX 47MV+niaZBQK++8i29RLUKCAspWq2iYMD8SvUgNQGtrdZtycC0yU7gFL9WOb2jpoCfaR bZyOE4AfOsVQsiCO8kEu5NakOGwmYCSc671TkH/JbFplGqFP+fWA8K6WFr03+lFFzomc kR5vVe+OiOzoNKsPnfCiyv5QDmwABuIJtuTomJLMnnwL7WloMTMNmnT4nmHB3XqesKOJ Z3JH9KZ4H1V/MRVkQcs01Qic8Elnfs4YGc+kjo3ZzQgEVrJv55IvoMzobDcW8Do9++Dr cRJQ== X-Gm-Message-State: AOAM530mIZz3ibvFHwzTVw3hjGUHdSalc3iQ5Q58ynbMF8b7ZFi6D/dG /4zns814zMY0R3rZ0huqau5/MA== X-Google-Smtp-Source: ABdhPJwZM0hz5NTNslZdZTT4y9WKN1tMWLtl28kfh2I/DoQpBRrptcN0q0StrVDO9i2WSkdgy7mAhw== X-Received: by 2002:a05:6512:6c2:b0:46b:9578:7c63 with SMTP id u2-20020a05651206c200b0046b95787c63mr17462809lff.204.1650982527150; Tue, 26 Apr 2022 07:15:27 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id g23-20020a2ea4b7000000b0024f096abebdsm1043360ljm.78.2022.04.26.07.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 07:15:22 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Kevin Hilman , Vincent Guittot , Geert Uytterhoeven , Dmitry Osipenko , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] PM: domains: Drop redundant code for genpd always-on governor Date: Tue, 26 Apr 2022 16:15:06 +0200 Message-Id: <20220426141507.89868-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426141507.89868-1-ulf.hansson@linaro.org> References: <20220426141507.89868-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Due to recent changes, the always-on governor is always used with a genpd that has the GENPD_FLAG_RPM_ALWAYS_ON flag being set. This means genpd, doesn't invoke the governor's ->power_down_ok() callback, which makes the code in governor redundant, so let's drop it. Signed-off-by: Ulf Hansson --- drivers/base/power/domain_governor.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index cd08c5885190..c13e44823f16 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -327,11 +327,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) return _default_power_down_ok(pd, ktime_get()); } -static bool always_on_power_down_ok(struct dev_pm_domain *domain) -{ - return false; -} - #ifdef CONFIG_CPU_IDLE static bool cpu_power_down_ok(struct dev_pm_domain *pd) { @@ -401,6 +396,5 @@ struct dev_power_governor simple_qos_governor = { * pm_genpd_gov_always_on - A governor implementing an always-on policy */ struct dev_power_governor pm_domain_always_on_gov = { - .power_down_ok = always_on_power_down_ok, .suspend_ok = default_suspend_ok, }; From patchwork Tue Apr 26 14:15:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 566400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 437CEC433EF for ; Tue, 26 Apr 2022 14:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351539AbiDZOSu (ORCPT ); Tue, 26 Apr 2022 10:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351551AbiDZOSs (ORCPT ); Tue, 26 Apr 2022 10:18:48 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B464715A1B for ; Tue, 26 Apr 2022 07:15:35 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id n14so11473184lfu.13 for ; Tue, 26 Apr 2022 07:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6uWDDfHKgK8+yoOD+Pzrd9WOCbfsrsht1ynrIKudfso=; b=ej4+Bx6xsGOH1fAYVCANQZk2dOz8IPnGV43ikFNr5907fDFzF+LC4hNSwjs0yUKphb LlQcAqu6SYB9cIITtCLUcl14KCtEhMawPgVduTYHzdTyrwCcgKnmedX1eQzkzjB37JHO zGCMPlgOhE55LQG7hJQHMcjjXWkik63SJIlvlZ6KMauZTOGgCVkgZ+yba7liNdFvAG1l i139SGagphUzRBobjJet6dT0uNxatiQJ096u8Pql+KL2VIFCp9abO9Y+Lwb22wbZfyhp EgtzT/D/fSyXw7+PFyCHJAWKS72toMh8bBDR7dlI2y+aoy7j2gcl8MPM8ADmiqwFN2iE vXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6uWDDfHKgK8+yoOD+Pzrd9WOCbfsrsht1ynrIKudfso=; b=iuOMgO9XlAnCXXoUBA6EaDQzG6C162YySfqrTMIXmuVZlkuK/3Mbot1ktmKmZviqvs 09HcPgBcyCaEwiFWcxflzk8WyweREe/3RN9Y/Zweo0BeHvziDdYkB3QNzrX81gxaClg2 lYiwvrPjmNyIaKy6Knh9XW+rz5T4TSpooVQTAtfktmoLywVjhaoIAsc3LnK7lN6y41y0 KhLqHewX2/RsZMQ7QxWh7YZ4/+7DMIvxwkAJpkg/QiTiOh52ZKajv+QzI6DB8DRTiGIV igLsnCrgOEvWEBPiE8DCWOziEvrIVdF/qiiLz/pj/uWkG3l2IAPdcYNcWYGt9+jaYgrg LNZA== X-Gm-Message-State: AOAM53227GrP6Ems/yopaUKD1Hd8/ryb+pAHU76DndNwo0fEdrGMwGjJ VWOA4IxFssF4CY2gTfT9nqlxVQ== X-Google-Smtp-Source: ABdhPJzVJYvpLNFNnLneCLs3awIMzJab4hFZqee6Y1nyrzQD/yDf8uZ2syfAyE7PbC6lRc5j5FlZkA== X-Received: by 2002:a19:4f53:0:b0:472:1714:61f1 with SMTP id a19-20020a194f53000000b00472171461f1mr2746170lfk.473.1650982533737; Tue, 26 Apr 2022 07:15:33 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id g23-20020a2ea4b7000000b0024f096abebdsm1043360ljm.78.2022.04.26.07.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 07:15:30 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Kevin Hilman , Vincent Guittot , Geert Uytterhoeven , Dmitry Osipenko , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] PM: domain: Don't check PM_QOS_FLAG_NO_POWER_OFF in genpd Date: Tue, 26 Apr 2022 16:15:07 +0200 Message-Id: <20220426141507.89868-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426141507.89868-1-ulf.hansson@linaro.org> References: <20220426141507.89868-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Back in the days when genpd supported intermediate power states of its devices, it made sense to check the PM_QOS_FLAG_NO_POWER_OFF in genpd_power_off(). This because the attached devices were all being put into low power state together when the PM domain was also being powered off. At this point, the flag PM_QOS_FLAG_NO_POWER_OFF is better checked by drivers from their ->runtime_suspend() callbacks, like in the usb_port_runtime_suspend(), for example. Or perhaps an even better option is to set the QoS resume latency constraint for the device to zero, which informs the runtime PM core to prevent the device from being runtime suspended. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 262bda9b56ef..5059c5d2e64a 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -648,12 +648,6 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, } list_for_each_entry(pdd, &genpd->dev_list, list_node) { - enum pm_qos_flags_status stat; - - stat = dev_pm_qos_flags(pdd->dev, PM_QOS_FLAG_NO_POWER_OFF); - if (stat > PM_QOS_FLAGS_NONE) - return -EBUSY; - /* * Do not allow PM domain to be powered off, when an IRQ safe * device is part of a non-IRQ safe domain.