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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 15 Jan 2012 23:24:14 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Fenghua Yu <fenghua.yu@...el.com>
CC:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	H Peter Anvin <hpa@...or.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Asit K Mallick <asit.k.mallick@...el.com>,
	Tony Luck <tony.luck@...el.com>,
	Arjan van de Ven <arjan.van.de.ven@...el.com>,
	Suresh B Siddha <suresh.b.siddha@...el.com>,
	Len Brown <len.brown@...el.com>,
	Randy Dunlap <rdunlap@...otime.net>,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Chen Gong <gong.chen@...ux.intel.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-pm <linux-pm@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v5 12/12] x86/topology.c: debug CPU0 hotplug

On 01/12/2012 01:04 AM, Fenghua Yu wrote:
> From: Fenghua Yu <fenghua.yu@...el.com>
> 
> CONFIG_DEBUG_HOTPLUG_CPU0 is for debuging the CPU0 hotplug feature. The switch
> offlines CPU0 as soon as possible and boots userspace up with CPU0 offlined.
> User can online CPU0 back after boot time. The default value of the switch is
> off.
> 
> To debug CPU0 hotplug, you need to enable CPU0 offline/online feature by either
> turning on CONFIG_BOOTPARAM_HOTPLUG_CPU0 during compilation or giving
> cpu0_hotplug kernel parameter at boot.
> 
> It's safe and early place to take down CPU0 after all hotplug notifiers
> are installed and SMP is booted.
> 
> Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
> ---
>  arch/x86/Kconfig           |   15 +++++++++++++++
>  arch/x86/kernel/topology.c |   39 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index c2cf195..36b6a2c 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1748,6 +1748,21 @@ config BOOTPARAM_HOTPLUG_CPU0
>  	  You still can enable the CPU0 hotplug feature at boot by kernel
>  	  parameter cpu0_hotplug.
>  
> +config DEBUG_HOTPLUG_CPU0
> +	def_bool n
> +	prompt "Debug CPU0 hotplug"
> +	depends on HOTPLUG_CPU && EXPERIMENTAL
> +	---help---
> +	  Enabling this option offlines CPU0 (if CPU0 can be offlined) as
> +	  soon as possible and boots up userspace with CPU0 offlined. User
> +	  can online CPU0 back after boot time.
> +
> +	  To debug CPU0 hotplug, you need to enable CPU0 offline/online
> +	  feature by either turning on CONFIG_BOOTPARAM_HOTPLUG_CPU0 during
> +	  compilation or giving cpu0_hotplug kernel parameter at boot.
> +
> +	  If unuser, say N.
> +
>  config COMPAT_VDSO
>  	def_bool y
>  	prompt "Compat VDSO support"
> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index 8cec15c..3f697dd 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -49,6 +49,45 @@ static int __init enable_cpu0_hotplug(char *str)
>  __setup("cpu0_hotplug", enable_cpu0_hotplug);
>  #endif
>  
> +#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
> +/*
> + * This function offlines CPU0 as early as possible and allows userspace to
> + * boot up without CPU0. CPU0 can be onlined back by user after boot.
> + *
> + * This is only called for debugging CPU0 offline feature.
> + */
> +static void __init _debug_hotplug_cpu(int num)
> +{
> +	int ret;
> +	struct sys_device *dev = get_cpu_sysdev(num);
> +
> +	/*
> +	 * Take hotpluggable online CPU0 down.
> +	 */
> +	if (num || !per_cpu(cpu_devices, num).cpu.hotpluggable || !dev ||
> +	    !cpu_online(num)) {
> +		pr_debug("CPU0 can't be offlined.\n");
> +		return;
> +	}
The usage of parameter num seems a little inconsistent. 
Suggest either to remove the num parameter or to get rid of the assumption
that num is always zero.

> +
> +	cpu_hotplug_driver_lock();
> +
> +	ret = cpu_down(num);
> +	if (!ret)
> +		kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
> +	else
> +		pr_debug("Can't offline CPU%d.\n", num);
> +
> +	cpu_hotplug_driver_unlock();
> +}
> +static int __init debug_hotplug_cpu(void)
> +{
> +	_debug_hotplug_cpu(0);
> +	return 0;
> +}
> +device_initcall_sync(debug_hotplug_cpu);
> +#endif /* CONFIG_DEBUG_HOTPLUG_CPU0 */
> +
>  int __ref arch_register_cpu(int num)
>  {
>  	/*

--
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