Re: <PING> Re: [patch x86/core] x86: allow number of additionalhotplug CPUs to be set at compile time

From: Thomas Gleixner
Date: Sun Oct 05 2008 - 10:53:20 EST


On Sun, 5 Oct 2008, Ingo Molnar wrote:
> * Chuck Ebbert <cebbert@xxxxxxxxxx> wrote:
>
> > Yes, it works and I don't see how it could cause any problems.
> >
> > Ingo, can we get this in 2.6.27? You can drop my original patch.
> >
> > Tested-by: Chuck Ebbert <cebbert@xxxxxxxxxx>
>
> looks good, applied to tip/x86/core, thanks!

No, this patch is horrible.

The correct check is num_present_cpus(). There is no need to make the
weird additional_cpus hackery globally available.

Btw, additional_cpus has interesting properties. Providing a negative
number < -1 on the kernel command line - happened due to a typo -
explodes in early boot, which is not really surprising, but should be
sanity checked.

Thanks,

tglx
---------------->
Subject: x86: make UP alternatives switch depend on present cpus
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Sun, 05 Oct 2008 16:45:22 +0200

num_possible_cpus() can be > 1 when disabled CPUs have been accounted.

Disabled CPUs are not in the cpu_present_map, so we can use
num_present_cpus() as a safe indicator to switch to UP alternatives.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index fb04e49..a84ac7b 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -444,7 +444,7 @@ void __init alternative_instructions(void)
_text, _etext);

/* Only switch to UP mode if we don't immediately boot others */
- if (num_possible_cpus() == 1 || setup_max_cpus <= 1)
+ if (num_present_cpus() == 1 || setup_max_cpus <= 1)
alternatives_smp_switch(0);
}
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/