Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp215752pxb; Wed, 6 Oct 2021 03:30:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9TugjwIE2hSjr9kpH7b+RngTMSM/mlxoDM0Ysimsatqyng82noPTZxolERv0VPDFv67Hj X-Received: by 2002:a17:906:7716:: with SMTP id q22mr31499537ejm.457.1633516259371; Wed, 06 Oct 2021 03:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633516259; cv=none; d=google.com; s=arc-20160816; b=LfGm1sC2qjw+1iUHMqrwLpn2lGeCA79kemaZRD/6+GwvyDF7Db5iu3Pj6V2OlNF/7q 80N/VytrZUfNbR/p6+fX6KpycrCwomwKwQPldA0SfRvKLaNu69UhvlkX2Nr2IHkI9mRw 3sSfAGEicXO4p9nKwEaq4FA1VWlV5B3IlPdcS8u7QKoMGH4W92KVweLCxBEZh9JMmNPF 0i5LTvRa5q8SVHP6rfxLEMLf4io6fBB2wlQeGNndw5a+uLE0ybiUwnLYGdllXg9i4jZT uaP9SaPmLP5nv9kWgTENeet9EmhG+dBcN6pslBQHoOWvgn3j+pfhQmgyM6d/CTXpMZ8t t6yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=5gHobSVO2kPLJnKWdgczaJYxS33RSCMny/Mt0NGh7Zw=; b=Iezs2JMKQ39s+I9TkhM/BA4NJZvm7hfn5V3DPVW1q7sjnz41o++hqyTW5a46lRFMgQ WeUXaW8kCq7D7LDopnlWLrIUd0ZRtJtNKilec7sOFuMuleovxkirWsxuS/C6Ta+QYYmf k9H8++lFS5SHdwkdLPQDEmcGHpIsnaXx7DSFfBk5Ivq01NnBahptQ1W2AbrgX7ztpXCV pJ4+OnX4gBTT81ayqV5KjA/iN2cY7n4IhVuFxfKMUWEfzmnCTqksLRXyvK7rKFIEowG6 JgypOdKPzaRndLzRs8JgGQp84U+uSE3qNB8/cpXgjZj/94SJ7IR+IrUz7L0yDx6C1AAM IOKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=kx8cKFT3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si30486957eje.548.2021.10.06.03.30.35; Wed, 06 Oct 2021 03:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=kx8cKFT3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238030AbhJFKa2 (ORCPT + 99 others); Wed, 6 Oct 2021 06:30:28 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:11083 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbhJFKa1 (ORCPT ); Wed, 6 Oct 2021 06:30:27 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1633516115; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=5gHobSVO2kPLJnKWdgczaJYxS33RSCMny/Mt0NGh7Zw=; b=kx8cKFT3cmEJc51aXPiHebA/T17FqugmG4KT5XLqSchAkBHIM1QCNpTjGYR+8uivirNPjXJ0 V5nyVapBIVWCG9rtdkVBTO9GUfXWq/BvzXCkiFnbCw8vFKxPYBTo8HsgPC3Lv+oOmGOajjbm 7rgYbWoHH5oKeJgj/G4aJOFWHYo= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 615d7a5330ce13d2b4e8e828 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 06 Oct 2021 10:28:35 GMT Sender: mkshah=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3CE51C4360C; Wed, 6 Oct 2021 10:28:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.29.129] (unknown [49.36.85.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 43FD9C43460; Wed, 6 Oct 2021 10:28:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 43FD9C43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Subject: Re: [PATCH 2/2] PM: sleep: Fix runtime PM based cpuidle support To: Ulf Hansson , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Peter Zijlstra , Vincent Guittot , Len Brown , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Srinivas Rao L References: <20210929144451.113334-1-ulf.hansson@linaro.org> <20210929144451.113334-3-ulf.hansson@linaro.org> From: Maulik Shah Message-ID: Date: Wed, 6 Oct 2021 15:58:27 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210929144451.113334-3-ulf.hansson@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks for the patch. Looks good to me. Reviewed-by: Maulik Shah Thanks, Maulik On 9/29/2021 8:14 PM, Ulf Hansson wrote: > In the cpuidle-psci case, runtime PM in combination with the generic PM > domain (genpd), may be used when entering/exiting an idlestate. More > precisely, genpd relies on runtime PM to be enabled for the attached device > (in this case it belongs to a CPU), to properly manage the reference > counting of its PM domain. > > This works fine most of the time, but during system suspend in the > dpm_suspend_late() phase, the PM core disables runtime PM for all devices. > Beyond this point and until runtime PM becomes re-enabled in the > dpm_resume_early() phase, calls to pm_runtime_get|put*() will fail. > > To make sure the reference counting in genpd becomes correct, we need to > prevent cpuidle-psci from using runtime PM when it has been disabled for > the device. Therefore, let's move the call to cpuidle_pause() from > dpm_suspend_noirq() to dpm_suspend_late() - and cpuidle_resume() from > dpm_resume_noirq() into dpm_resume_early(). > > Diagnosed-by: Maulik Shah > Suggested-by: Maulik Shah > Signed-off-by: Ulf Hansson > --- > drivers/base/power/main.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c > index cbea78e79f3d..1c753b651272 100644 > --- a/drivers/base/power/main.c > +++ b/drivers/base/power/main.c > @@ -747,8 +747,6 @@ void dpm_resume_noirq(pm_message_t state) > > resume_device_irqs(); > device_wakeup_disarm_wake_irqs(); > - > - cpuidle_resume(); > } > > /** > @@ -870,6 +868,7 @@ void dpm_resume_early(pm_message_t state) > } > mutex_unlock(&dpm_list_mtx); > async_synchronize_full(); > + cpuidle_resume(); > dpm_show_time(starttime, state, 0, "early"); > trace_suspend_resume(TPS("dpm_resume_early"), state.event, false); > } > @@ -1336,8 +1335,6 @@ int dpm_suspend_noirq(pm_message_t state) > { > int ret; > > - cpuidle_pause(); > - > device_wakeup_arm_wake_irqs(); > suspend_device_irqs(); > > @@ -1467,6 +1464,7 @@ int dpm_suspend_late(pm_message_t state) > int error = 0; > > trace_suspend_resume(TPS("dpm_suspend_late"), state.event, true); > + cpuidle_pause(); > mutex_lock(&dpm_list_mtx); > pm_transition = state; > async_error = 0; > -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation