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: <87hai8kwgh.fsf@nemi.mork.no>
Date:	Sun, 12 May 2013 18:13:34 +0200
From:	Bjørn Mork <bjorn@...k.no>
To:	paulmck@...ux.vnet.ibm.com
Cc:	"Paul E. McKenney" <paul.mckenney@...aro.org>,
	linux-kernel@...r.kernel.org, Borislav Petkov <bp@...e.de>
Subject: Re: Bisected post-3.9 regression: Resume takes 5 times as much time as with v3.9

"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> writes:

> We don't want to back out the RCU_FAST_NO_HZ changes due to their
> energy-efficiency benefits.

Yes, that's what I assumed.  Just didn't know where to start dissecting
it...

>  So could you please try out Borislav's
> patch below?  He ran into the same issue a few weeks ago, and this
> one fixed it for him.
>
> 							Thanx, Paul
>
> ------------------------------------------------------------------------
>
> rcu: Expedite grace periods during suspend/resume
>
> CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
> a factor of four, which can result in long suspend and resume times.
> Thus, this commit temporarily switches to expedited grace periods when
> suspending the box and return to normal settings when resuming.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
>
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index a9610d1..d9604a4 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -53,6 +53,7 @@
>  #include <linux/delay.h>
>  #include <linux/stop_machine.h>
>  #include <linux/random.h>
> +#include <linux/suspend.h>
>  
>  #include "rcutree.h"
>  #include <trace/events/rcu.h>
> @@ -3003,6 +3004,22 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
>  	return NOTIFY_OK;
>  }
>  
> +static int rcu_pm_notify(struct notifier_block *self,
> +			 unsigned long action, void *hcpu)
> +{
> +	switch (action) {
> +	case PM_HIBERNATION_PREPARE:
> +		rcu_expedited = 1;
> +		break;
> +	case PM_POST_RESTORE:
> +		rcu_expedited = 0;
> +		break;
> +	default:
> +		break;
> +	}
> +	return NOTIFY_OK;
> +}
> +
>  /*
>   * Spawn the kthread that handles this RCU flavor's grace periods.
>   */
> @@ -3243,6 +3260,7 @@ void __init rcu_init(void)
>  	 * or the scheduler are operational.
>  	 */
>  	cpu_notifier(rcu_cpu_notify, 0);
> +	pm_notifier(rcu_pm_notify, 0);
>  	for_each_online_cpu(cpu)
>  		rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
>  }


Thanks!  This patch did not make any difference for me by itself, for
pretty obvious reasons (I didn't time restore from hibernate - only from
suspend). But it pointed me in the right direction.  Applying the
attached patch on top of that one fixed the problem.

Note that I'm also changing the restore from hibernate hook. According
to Documentation/power/notifiers.txt :

 PM_POST_RESTORE         An error occurred during restore from hibernation.
                         Device drivers' restore callbacks have been executed
                         and tasks have been thawed.


I believe Borislav must have meant 

 PM_POST_HIBERNATION     The system memory state has been restored from a
                         hibernation image or an error occurred during
                         hibernation.  Device drivers' restore callbacks have
                         been executed and tasks have been thawed.

in the above patch?

Please include some combination of these patches in your upcoming v3.10
fixes.  Thanks.



Bjørn


View attachment "0001-rcu-Really-switch-to-expedited-grace-periods-for-sus.patch" of type "text/x-diff" (1260 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ