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, 29 Apr 2013 10:00:40 +0530
From:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
To:	liguang <lig.fnst@...fujitsu.com>
CC:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
	Anton Vorontsov <anton.vorontsov@...aro.org>
Subject: Re: [PATCH] cpu: rid cpu_hotplug_disabled check for cpu_down()

On 04/29/2013 08:19 AM, liguang wrote:
> in cpu_down(), _cpu_down() will do
> "
>         if (num_online_cpus() == 1)
>                  return -EBUSY;
> "
> when cpu_hotplug_disabled was set, num_online_cpus
> will return 1 for there's only 1 boot cpu.
> so, it's unnecessary to check cpu_hotplug_disabled
> here.
>

The 2 checks serve very different purposes; they are not the same!

The num_online_cpus() check is to ensure that the user doesn't do
something insane like trying to offline the last online CPU in the
system.

Whereas, the flag 'cpu_hotplug_disabled' is used to prevent user-
triggered CPU hotplug (such as those initiated through sysfs).
This is useful in cases where the system itself wants to initiate CPU
hotplug and it doesn't want annoying races with CPU hotplug going
on in parallel due to other reasons. One such case is suspend/resume.
That's why, if you have noticed, the suspend/resume code invokes the
_cpu_down() version, in order to bypass the flag and get its job done.

So, no, I think the check needs to stay.

Regards,
Srivatsa S. Bhat

> Signed-off-by: liguang <lig.fnst@...fujitsu.com>
> ---
>  kernel/cpu.c |    6 ------
>  1 files changed, 0 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index b5e4ab2..cd166d3 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -330,14 +330,8 @@ int __ref cpu_down(unsigned int cpu)
> 
>  	cpu_maps_update_begin();
> 
> -	if (cpu_hotplug_disabled) {
> -		err = -EBUSY;
> -		goto out;
> -	}
> -
>  	err = _cpu_down(cpu, 0);
> 
> -out:
>  	cpu_maps_update_done();
>  	return err;
>  }
> 

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