|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/SMP: CPU0's scratch mask is needed earlier
commit 7469686ccc959765542cd10551f9bd7a602f2cbd
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Dec 19 11:49:20 2016 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Dec 19 11:49:20 2016 +0100
x86/SMP: CPU0's scratch mask is needed earlier
When putting together commit 3b61726458 ("x86: introduce and use
scratch CPU mask") I failed to remember that AMD IOMMU setups needs the
scratch mask prior to smp_prepare_cpus() having run. Use a static mask
for the boot CPU instead.
Note that the definition of scratch_cpu0mask could also be put inside a
"NR_CPUS > 2 * BITS_PER_LONG" conditional, but it seems preferable to
me to carry the extra variable in all cases and avoid the #ifdef-ary.
Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/smpboot.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index ba651fb..9b390b8 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -57,6 +57,7 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, scratch_cpumask);
+static cpumask_t scratch_cpu0mask;
cpumask_t cpu_online_map __read_mostly;
EXPORT_SYMBOL(cpu_online_map);
@@ -648,7 +649,8 @@ static void cpu_smpboot_free(unsigned int cpu)
free_cpumask_var(per_cpu(cpu_sibling_mask, cpu));
free_cpumask_var(per_cpu(cpu_core_mask, cpu));
- free_cpumask_var(per_cpu(scratch_cpumask, cpu));
+ if ( per_cpu(scratch_cpumask, cpu) != &scratch_cpu0mask )
+ free_cpumask_var(per_cpu(scratch_cpumask, cpu));
if ( per_cpu(stubs.addr, cpu) )
{
@@ -795,8 +797,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
panic("No memory for socket CPU siblings map");
if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, 0)) ||
- !zalloc_cpumask_var(&per_cpu(cpu_core_mask, 0)) ||
- !alloc_cpumask_var(&per_cpu(scratch_cpumask, 0)) )
+ !zalloc_cpumask_var(&per_cpu(cpu_core_mask, 0)) )
panic("No memory for boot CPU sibling/core maps");
set_cpu_sibling_map(0);
@@ -850,8 +851,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
void __init smp_prepare_boot_cpu(void)
{
- cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
- cpumask_set_cpu(smp_processor_id(), &cpu_present_map);
+ unsigned int cpu = smp_processor_id();
+
+ cpumask_set_cpu(cpu, &cpu_online_map);
+ cpumask_set_cpu(cpu, &cpu_present_map);
+#if NR_CPUS > 2 * BITS_PER_LONG
+ per_cpu(scratch_cpumask, cpu) = &scratch_cpu0mask;
+#endif
}
static void
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |