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: 9562783 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 AA2BD60434 for ; Wed, 8 Feb 2017 16:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C95B127317 for ; Wed, 8 Feb 2017 16:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD50A2840B; Wed, 8 Feb 2017 16:37:07 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 221DB283E8 for ; Wed, 8 Feb 2017 16:37:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753760AbdBHQgz (ORCPT ); Wed, 8 Feb 2017 11:36:55 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:35655 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577AbdBHQfo (ORCPT ); Wed, 8 Feb 2017 11:35:44 -0500 Received: by mail-pf0-f176.google.com with SMTP id f144so43422997pfa.2 for ; Wed, 08 Feb 2017 08:35:10 -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=tWr9oz9eH5qvnnHvE7C9A/qPxK2N4MnJgBUI/7XlgDpl2zfk6bn214W7Yw0pYWiQu3 zNdDiaQ8wp+aMATe8TDSRnRFL+LyCmD8WsT1h7KGS+x1kVde3S+wPDuzX69OAz5xP1y8 xMRc256MPzS+VDDbCQ8qZkrGTkQ1faZTbR+CUjC06qxi06pFWgw784LymSk+bloC3GVd UksyYx6fzgiExZcJg/XMuAbGiboH/xBbsmW2sQz+ti3HVtyhpJGNBr8gYuf46u4K1uqc yKERQz1kBE7g03R4g83LE/qWVDlfhiMsmGWN3RNX4Toe9oGn+N2NIBv1uTTJbwJSKnNA PImQ== X-Gm-Message-State: AIkVDXJNCDDe70TIhGmRg/2MxKiVgXjpOCKCfB19QQbxR2jcEoBkCMapIveWYJumiRIjszX9 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 Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, brendan.jackman@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, Juri.Lelli@arm.com, Lina Iyer 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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); }