lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 6 Oct 2021 15:58:27 +0530
From:   Maulik Shah <mkshah@...eaurora.org>
To:     Ulf Hansson <ulf.hansson@...aro.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        linux-pm@...r.kernel.org
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Len Brown <len.brown@...el.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Srinivas Rao L <lsrao@...eaurora.org>
Subject: Re: [PATCH 2/2] PM: sleep: Fix runtime PM based cpuidle support

Hi,

Thanks for the patch. Looks good to me.

Reviewed-by: Maulik Shah <mkshah@...eaurora.org>

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 <mkshah@...eaurora.org>
> Suggested-by: Maulik Shah <mkshah@...eaurora.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
> ---
>   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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ