From: Andrew Morton on
On Thu, 6 May 2010 18:52:49 +0200
Tejun Heo <tj(a)kernel.org> wrote:

> Reimplement stop_machine using cpu_stop. As cpu stoppers are
> guaranteed to be available for all online cpus,
> stop_machine_create/destroy() are no longer necessary and removed.
>
> With resource management and synchronization handled by cpu_stop, the
> new implementation is much simpler. Asking the cpu_stop to execute
> the stop_cpu() state machine on all online cpus with cpu hotplug
> disabled is enough.
>
> stop_machine itself doesn't need to manage any global resources
> anymore, so all per-instance information is rolled into struct
> stop_machine_data and the mutex and all static data variables are
> removed.
>
> The previous implementation created and destroyed RT workqueues as
> necessary which made stop_machine() calls highly expensive on very
> large machines. According to Dimitri Sivanich, preventing the dynamic
> creation/destruction makes booting faster more than twice on very
> large machines. cpu_stop resources are preallocated for all online
> cpus and should have the same effect.
>
> ...
>
> @@ -361,9 +357,6 @@ int disable_nonboot_cpus(void)
> {
> int cpu, first_cpu, error;
>
> - error = stop_machine_create();
> - if (error)
> - return error;
> cpu_maps_update_begin();
> first_cpu = cpumask_first(cpu_online_mask);
> /*

kernel/cpu.c: In function 'disable_nonboot_cpus':
kernel/cpu.c:397: warning: 'error' may be used uninitialized in this function

Looks like this is a real bug if the cpumask happens to contain only a
single CPU for some reason.

--- a/kernel/cpu.c~a
+++ a/kernel/cpu.c
@@ -355,7 +355,8 @@ static cpumask_var_t frozen_cpus;

int disable_nonboot_cpus(void)
{
- int cpu, first_cpu, error;
+ int cpu, first_cpu;
+ int error = 0;

cpu_maps_update_begin();
first_cpu = cpumask_first(cpu_online_mask);
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
Hello,

On 05/11/2010 11:50 PM, Andrew Morton wrote:
> kernel/cpu.c: In function 'disable_nonboot_cpus':
> kernel/cpu.c:397: warning: 'error' may be used uninitialized in this function
>
> Looks like this is a real bug if the cpumask happens to contain only a
> single CPU for some reason.

Indeed. Hmm... I wonder why my builds didn't find it.

Acked-by: Tejun Heo <tj(a)kernel.org>

Thank you.

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