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]
Message-ID: <20200625051534.GA22907@chenyu-office.sh.intel.com>
Date:   Thu, 25 Jun 2020 13:15:34 +0800
From:   Chen Yu <yu.c.chen@...el.com>
To:     "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Len Brown <len.brown@...el.com>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Len Brown <lenb@...nel.org>
Subject: Re: [PATCH 2/2][v3] PM / s2idle: Code cleanup to make s2idle
 consistent with normal idle path

Hi Rafael,
On Tue, Jun 23, 2020 at 07:57:59PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> Subject: [PATCH] cpuidle: Rearrange s2idle-specific idle state entry code
> 
> Implement call_cpuidle_s2idle() in analogy with call_cpuidle()
> for the s2idle-specific idle state entry and invoke it from
> cpuidle_idle_call() to make the s2idle-specific idle entry code
> path look more similar to the "regular" idle entry one.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>  drivers/cpuidle/cpuidle.c |    6 +++---
>  kernel/sched/idle.c       |   15 +++++++++++----
>  2 files changed, 14 insertions(+), 7 deletions(-)
> 
> Index: linux-pm/kernel/sched/idle.c
> ===================================================================
> --- linux-pm.orig/kernel/sched/idle.c
> +++ linux-pm/kernel/sched/idle.c
> @@ -96,6 +96,15 @@ void __cpuidle default_idle_call(void)
>  	}
>  }
>  
> +static int call_cpuidle_s2idle(struct cpuidle_driver *drv,
> +			       struct cpuidle_device *dev)
> +{
> +	if (current_clr_polling_and_test())
> +		return -EBUSY;
> +
> +	return cpuidle_enter_s2idle(drv, dev);
> +}
> +
>  static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>  		      int next_state)
>  {
> @@ -171,11 +180,9 @@ static void cpuidle_idle_call(void)
>  		if (idle_should_enter_s2idle()) {
>  			rcu_idle_enter();
>  
> -			entered_state = cpuidle_enter_s2idle(drv, dev);
> -			if (entered_state > 0) {
> -				local_irq_enable();
> +			entered_state = call_cpuidle_s2idle(drv, dev);
I guess this changes the context a little bit that(comparing to [1/2 patch],
after this modification, when we found that TIF_NEED_RESCHED is set we can have
a second chance in the following call_cpuidle to do a second s2idle try. However
in [1/2 patch], it might exit the s2idle phase directly once when we see
TIF_NEED_RESCHED is set(because entered_state is postive we treat it as a successful
s2idle). In summary I think the change (patch [2/2]) is more robust.
Acked-by: Chen Yu <yu.c.chen@...el.com>

Thanks,
Chenyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ