mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
arm: Add simple cpu_{sibling, core}_mask
This needs to be done for all cpus. The allocations require smp_prepare_cpus to be called a bit later on. In a previous version of this patch these maps were being zeroed (instead of setting the CPU itself in them). This in turn causes cpumask_first to return NR_CPUS, which in turn was causing default_vcpu0_location to misbehave and read off the end of its cnt array. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
aa25a619d3
commit
fdffada5f2
3 files changed
+23
-4
No files matched your search
@@ -7,8 +7,6 @@ x: .word 0xe7f000f0 /* Undefined instruction */
|
||||
x: mov pc, lr
|
||||
|
||||
/* SMP support */
|
||||
DUMMY(per_cpu__cpu_core_mask);
|
||||
DUMMY(per_cpu__cpu_sibling_mask);
|
||||
DUMMY(node_online_map);
|
||||
DUMMY(smp_send_state_dump);
|
||||
|
||||
|
||||
@@ -173,8 +173,6 @@ void __init start_xen(unsigned long boot_phys_offset,
|
||||
set_current((struct vcpu *)0xfffff000); /* debug sanity */
|
||||
idle_vcpu[0] = current;
|
||||
|
||||
smp_prepare_cpus(cpus);
|
||||
|
||||
init_xen_time();
|
||||
|
||||
setup_mm(atag_paddr, fdt_size);
|
||||
@@ -214,6 +212,8 @@ void __init start_xen(unsigned long boot_phys_offset,
|
||||
|
||||
local_irq_enable();
|
||||
|
||||
smp_prepare_cpus(cpus);
|
||||
|
||||
initialize_keytable();
|
||||
|
||||
console_init_postirq();
|
||||
|
||||
@@ -52,6 +52,23 @@ unsigned long __initdata ready_cpus = 0;
|
||||
|
||||
/* ID of the PCPU we're running on */
|
||||
DEFINE_PER_CPU(unsigned int, cpu_id);
|
||||
/* XXX these seem awfully x86ish... */
|
||||
/* representing HT siblings of each logical CPU */
|
||||
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
|
||||
/* representing HT and core siblings of each logical CPU */
|
||||
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
|
||||
|
||||
static void setup_cpu_sibling_map(int cpu)
|
||||
{
|
||||
if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)) ||
|
||||
!zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
|
||||
panic("No memory for CPU sibling/core maps\n");
|
||||
|
||||
/* A CPU is a sibling with itself and is always on its own core. */
|
||||
cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
|
||||
cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
|
||||
}
|
||||
|
||||
|
||||
void __init
|
||||
smp_prepare_cpus (unsigned int max_cpus)
|
||||
@@ -65,6 +82,8 @@ smp_prepare_cpus (unsigned int max_cpus)
|
||||
for ( i = 0; i < max_cpus; i++ )
|
||||
cpumask_set_cpu(i, &cpu_possible_map);
|
||||
cpumask_copy(&cpu_present_map, &cpu_possible_map);
|
||||
|
||||
setup_cpu_sibling_map(0);
|
||||
}
|
||||
|
||||
void __init
|
||||
@@ -115,6 +134,8 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
|
||||
|
||||
set_current(idle_vcpu[cpuid]);
|
||||
|
||||
setup_cpu_sibling_map(cpuid);
|
||||
|
||||
/* Run local notifiers */
|
||||
notify_cpu_starting(cpuid);
|
||||
wmb();
|
||||
|
||||