From patchwork Wed Feb 8 16:34:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 9562799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3E4860216 for ; Wed, 8 Feb 2017 16:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A79283ED for ; Wed, 8 Feb 2017 16:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C93D628505; Wed, 8 Feb 2017 16:45:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6298A283ED for ; Wed, 8 Feb 2017 16:45:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cbVMc-00012A-7G; Wed, 08 Feb 2017 16:45:02 +0000 Received: from mail-pg0-f52.google.com ([74.125.83.52]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cbVMW-0000yn-So for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2017 16:44:59 +0000 Received: by mail-pg0-f52.google.com with SMTP id 204so50319200pge.0 for ; Wed, 08 Feb 2017 08:44:36 -0800 (PST) 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; bh=hD0nbDRZ8c9FSUl8u7AUwvDaa2mVWWaQqit2DQ5+ATw=; b=VYIEQM1AyN/3fT3UFI2BxnW0Xhux/2ZFVfeL0hI7B7frO4KQW6mjIutrvXFeD6pl3z Bft+aGZJpDMcS3vXUk8wYaQdD1KkB0Pm+ai6AHZCptsBlN23x/vZ8XLk9wISsPkNZVTl OGd2YCXYwQ3UCCg6g8x3tzETmEmN72hIhoxrk= 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; bh=hD0nbDRZ8c9FSUl8u7AUwvDaa2mVWWaQqit2DQ5+ATw=; b=par8MYSPVKyCq7bE1Ud0IIPt8QqAMd4dKntO3crEikjNCnJMpGzpa4HNjI17tiIPuo 5BdcfagIhhX2AQ9w0Xk4Kh7tt/GPiVgSGPK30gNeDoiiS0MuBSnmxkljSc4vFchpwHtA IP0z118rQE3sLfowNcmnMGJ3Zh8cpum6deyzdQ8KiziwMYsjXDRXlZ60gUs43iiRcOgA XTQ+U6bW9V32UF8Udogd3Xv/6PORa2pwQDG2u/xvAOeIsG2MymLIOSSTe11VUzJ7p3ia LfMd4b2KyiZczpUx1NTDnooAzYbchNbapgxPh+snKaAEnUx+prso6FyoKUbqhnrHO0Z5 1UPg== X-Gm-Message-State: AIkVDXLtit3/8djGFLqrbBZZCPNYXclNTBm0a6K/6qWKV0Q0AT2K6dyWThI2NS8NgRyDtcCG X-Received: by 10.99.95.16 with SMTP id t16mr28142692pgb.212.1486571710256; Wed, 08 Feb 2017 08:35:10 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id y23sm21653325pfi.66.2017.02.08.08.35.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 08:35:09 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] PM / Domains: Support in context powering off parent domain Date: Wed, 8 Feb 2017 08:34:52 -0800 Message-Id: <1486571692-33212-4-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> References: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170208_084456_984725_7E37A64B X-CRM114-Status: GOOD ( 12.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lorenzo.pieralisi@arm.com, Juri.Lelli@arm.com, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, brendan.jackman@arm.com, sudeep.holla@arm.com, andy.gross@linaro.org, Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Powering off a domain schedules a work to opportunistically power off the parent domains. Domains that are IRQ safe may have parents that are also IRQ safe. It would be beneficial to power off such IRQ safe parents in the same context as well. Signed-off-by: Lina Iyer --- drivers/base/power/domain.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 3825bb9..51e2254 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -375,7 +375,8 @@ static int genpd_dev_pm_qos_notifier(struct notifier_block *nb, * If all of the @genpd's devices have been suspended and all of its subdomains * have been powered down, remove power from @genpd. */ -static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) +static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async, + unsigned int depth) { struct pm_domain_data *pdd; struct gpd_link *link; @@ -442,7 +443,17 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) list_for_each_entry(link, &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); - genpd_queue_power_off_work(link->master); + /* + * Power off the parent in the same context if the parent + * domain is also IRQ safe. + */ + if (genpd_is_irq_safe(genpd) && + genpd_is_irq_safe(link->master)) { + genpd_lock_nested(link->master, depth + 1); + genpd_power_off(link->master, false, depth + 1); + genpd_unlock(link->master); + } else + genpd_queue_power_off_work(link->master); } return 0; @@ -459,7 +470,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) genpd = container_of(work, struct generic_pm_domain, power_off_work); genpd_lock(genpd); - genpd_power_off(genpd, true); + genpd_power_off(genpd, true, 0); genpd_unlock(genpd); } @@ -578,7 +589,7 @@ static int genpd_runtime_suspend(struct device *dev) return 0; genpd_lock(genpd); - genpd_power_off(genpd, false); + genpd_power_off(genpd, false, 0); genpd_unlock(genpd); return 0; @@ -658,7 +669,7 @@ static int genpd_runtime_resume(struct device *dev) if (!pm_runtime_is_irq_safe(dev) || (pm_runtime_is_irq_safe(dev) && genpd_is_irq_safe(genpd))) { genpd_lock(genpd); - genpd_power_off(genpd, 0); + genpd_power_off(genpd, 0, 0); genpd_unlock(genpd); }