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:	Mon, 10 Oct 2011 18:15:20 +0530
From:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
To:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
CC:	rjw@...k.pl, bp@...64.org, pavel@....cz, len.brown@...el.com,
	tj@...nel.org, mingo@...e.hu, a.p.zijlstra@...llo.nl,
	akpm@...ux-foundation.org, suresh.b.siddha@...el.com,
	lucas.demarchi@...fusion.mobi, rusty@...tcorp.com.au,
	rdunlap@...otime.net, vatsa@...ux.vnet.ibm.com,
	ashok.raj@...el.com, tigran@...azian.fsnet.co.uk,
	tglx@...utronix.de, hpa@...or.com, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 2/3] Mutually exclude cpu online and suspend/hibernate

On 10/10/2011 06:03 PM, Srivatsa S. Bhat wrote:
> Don't allow cpu hotplug online operation and suspend/hibernate to run in
> parallel. If suspend/hibernate has already started, fail the cpu online
> operation.
> 
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@...ux.vnet.ibm.com>
> ---
> 
>  kernel/cpu.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 12b7458..bc8c7d4 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -15,6 +15,7 @@
>  #include <linux/stop_machine.h>
>  #include <linux/mutex.h>
>  #include <linux/gfp.h>
> +#include <linux/suspend.h>
> 
>  #ifdef CONFIG_SMP
>  /* Serializes the updates to cpu_online_mask, cpu_present_mask */
> @@ -366,6 +367,14 @@ int __cpuinit cpu_up(unsigned int cpu)
>  	}
>  #endif
> 
> +	/*
> +	 * Prevent cpu online and suspend/hibernate (including freezer)
> +	 * operations from running in parallel. Fail cpu online if suspend or
> +	 * hibernate has already started.
> +	 */
> +	if (!trylock_pm_sleep())

Would it be better to hook into the suspend/hibernate notifiers and
use them to exclude cpu hotplug from suspend/hibernate, instead of
trying to take pm_mutex lock like this?
Peter, I remember you pointing out in another patch's review
(http://thread.gmane.org/gmane.linux.kernel/1198312/focus=1199087)
that introducing more locks in cpu hotplug would be a bad idea. Does that
comment hold here as well, or is this fine?

Anyways, I'll start working on that other implementation that hooks onto
the suspend/hibernate notifiers and see if that works out better.

> +		return -EBUSY;
> +
>  	cpu_maps_update_begin();
> 
>  	if (cpu_hotplug_disabled) {
> @@ -377,6 +386,7 @@ int __cpuinit cpu_up(unsigned int cpu)
> 
>  out:
>  	cpu_maps_update_done();
> +	unlock_pm_sleep();
>  	return err;
>  }
> 
> 


-- 
Regards,
Srivatsa S. Bhat  <srivatsa.bhat@...ux.vnet.ibm.com>
Linux Technology Center,
IBM India Systems and Technology Lab

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ