Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1418702imm; Wed, 10 Oct 2018 14:22:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV615hAkPMgAvIG6VizUq+H87GQiNTkFz8jym3+YCHHjPmQOj9Yhw1zw1Z7EpB9HNFxL2/so3 X-Received: by 2002:a17:902:b03:: with SMTP id 3-v6mr26965260plq.141.1539206544089; Wed, 10 Oct 2018 14:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539206544; cv=none; d=google.com; s=arc-20160816; b=IM3wzKMOLzAUktktsQPMafSFtSfqVEtm87MdqPd4MphFajp3rSG3HAiF4vF14COxH/ 2/rHxerAOv99Y1EhzVvhuJRDy/fHQmeJ58rq9ZhOlTch6FPB3yUHcgV1zQhV9lQfFcqD O+NBo78NXuicGLrO+M/D8phPqPKT+wqh3rBkpTgCP6cdRMcPiNH5fP6gBGwCNsGBSqwX laG4AaInEMdhElHWC5bwK25d9ilsxd85z9bwIHdrlvZmDGx9o/1tvUp1+u4S1Q0fUuBm fqp2vkJXRkUwNwKtjP1kR49NRGf9gpQMIhMJyOf1GcpaxWL7V8yZeTo86lPDJ+9AHGUQ VUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=n8pj1hQfz8Ebcphf72EYBeoiqVlaDy3yQqqlBZzex7M=; b=ehmjQFpYBhkX2Ty7B4Ie1tW4DBF4C5iA6nq7rVsY04YTCBQYXB+Y6tciddPF+8Q4Id qk40D0qI+a5JoclKpGsTLRn4yKL3sSvOuUXp/i7ei0ZsHI1lyWt9Z7UbmfSFqelQ8B9C sTtEod4idqGLJvMg0rgzUCLFY7EpwnOriIZvr8zH/iKDWETSkIn0QgxH9ztlJ14yYdAC gZNmi9CPJRBYwfGcSJ24Vj36jJC8xk7+1bPo3E4q6LsugEGUHE22K39FSoRtPThuIWu/ lngvJhVIYbZvWVQCJ221TLdQCdv1iSLPldK+fLucvi94GINIw38+u7PEn0i906uQnJX7 hSGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hNMwJtCm; dkim=pass header.i=@codeaurora.org header.s=default header.b=PXSjiaZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7-v6si24859489pgb.301.2018.10.10.14.22.09; Wed, 10 Oct 2018 14:22:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hNMwJtCm; dkim=pass header.i=@codeaurora.org header.s=default header.b=PXSjiaZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbeJKEpe (ORCPT + 99 others); Thu, 11 Oct 2018 00:45:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37964 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbeJKEpe (ORCPT ); Thu, 11 Oct 2018 00:45:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B0AC760C7D; Wed, 10 Oct 2018 21:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206494; bh=0lhzS25MklLZZhZMk9kpgz6k/DU9SoDNv2mDTJSstZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNMwJtCmEJcUNt3bqiAWxA1FBr/TRO+oQBi+e1EnrEYgTGIGagurwBPiKVI8Lmtgc fs7sI68S37HamyjZ/Vr+cPNNiFkQoc7DdZrgwuhIg36lTBpemvQhBsIzJCJ4W9Vtyx 5Wl0RwEaqkMQ9c7Y3DPAJoxXII6NdWVnejBT8WSs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,FROM_LOCAL_NOVOWEL autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6FFD2601A8; Wed, 10 Oct 2018 21:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206492; bh=0lhzS25MklLZZhZMk9kpgz6k/DU9SoDNv2mDTJSstZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXSjiaZn50nT3CCY3AVL28DHlfMzKeiAmk1xrc2iwXEVlYGJjDT2JR3jd+vCLm5bb oejVBq5y4+0GlcWVRKgJDBEFSlush87+TdD2+o++QppzAMixL4sfnfqzxKw76TXKZy ap2AoqPr/ny6qcs8HR9TLse1z5HCxwTR3mFsb5H0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6FFD2601A8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rplsssn@codeaurora.org From: "Raju P.L.S.S.S.N" To: andy.gross@linaro.org, david.brown@linaro.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH RFC v1 2/8] kernel/cpu_pm: Manage runtime PM in the idle path for CPUs Date: Thu, 11 Oct 2018 02:50:49 +0530 Message-Id: <1539206455-29342-3-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> References: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson To allow CPUs being power managed by PM domains, let's deploy support for runtime PM for the CPU's corresponding struct device. More precisely, at the point when the CPU is about to enter an idle state, decrease the runtime PM usage count for its corresponding struct device, via calling pm_runtime_put_sync_suspend(). Then, at the point when the CPU resumes from idle, let's increase the runtime PM usage count, via calling pm_runtime_get_sync(). Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Signed-off-by: Raju P.L.S.S.S.N (am from https://patchwork.kernel.org/patch/10478153/) --- kernel/cpu_pm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c index 67b02e1..492d4a8 100644 --- a/kernel/cpu_pm.c +++ b/kernel/cpu_pm.c @@ -16,9 +16,11 @@ */ #include +#include #include #include #include +#include #include #include @@ -91,6 +93,7 @@ int cpu_pm_enter(void) { int nr_calls; int ret = 0; + struct device *dev = get_cpu_device(smp_processor_id()); ret = cpu_pm_notify(CPU_PM_ENTER, -1, &nr_calls); if (ret) @@ -100,6 +103,9 @@ int cpu_pm_enter(void) */ cpu_pm_notify(CPU_PM_ENTER_FAILED, nr_calls - 1, NULL); + if (!ret && dev && dev->pm_domain) + pm_runtime_put_sync_suspend(dev); + return ret; } EXPORT_SYMBOL_GPL(cpu_pm_enter); @@ -118,6 +124,11 @@ int cpu_pm_enter(void) */ int cpu_pm_exit(void) { + struct device *dev = get_cpu_device(smp_processor_id()); + + if (dev && dev->pm_domain) + pm_runtime_get_sync(dev); + return cpu_pm_notify(CPU_PM_EXIT, -1, NULL); } EXPORT_SYMBOL_GPL(cpu_pm_exit); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation.