[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6 01/14] x86: add socket_to_cpumask
Maintain socket_to_cpumask which contains all the HT and core siblings in the same socket. Signed-off-by: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx> --- xen/arch/x86/smpboot.c | 15 +++++++++++++++ xen/include/asm-x86/smp.h | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 116c8f8..d236f18 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -59,6 +59,9 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask); cpumask_t cpu_online_map __read_mostly; EXPORT_SYMBOL(cpu_online_map); +unsigned int nr_sockets __read_mostly; +cpumask_t *socket_to_cpumask __read_mostly; + struct cpuinfo_x86 cpu_data[NR_CPUS]; u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = @@ -301,6 +304,8 @@ static void set_cpu_sibling_map(int cpu) } } } + + cpumask_set_cpu(cpu, &socket_to_cpumask[cpu_to_socket(cpu)]); } void start_secondary(void *unused) @@ -717,6 +722,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus) stack_base[0] = stack_start; + nr_sockets = DIV_ROUND_UP(nr_cpu_ids, boot_cpu_data.x86_max_cores * + boot_cpu_data.x86_num_siblings); + ASSERT(nr_sockets > 0); + + socket_to_cpumask = xzalloc_array(cpumask_t, nr_sockets); + if ( !socket_to_cpumask ) + 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)) ) panic("No memory for boot CPU sibling/core maps"); @@ -782,6 +795,8 @@ remove_siblinginfo(int cpu) int sibling; struct cpuinfo_x86 *c = cpu_data; + cpumask_clear_cpu(cpu, &socket_to_cpumask[cpu_to_socket(cpu)]); + for_each_cpu ( sibling, per_cpu(cpu_core_mask, cpu) ) { cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, sibling)); diff --git a/xen/include/asm-x86/smp.h b/xen/include/asm-x86/smp.h index 67518cf..3ffddde 100644 --- a/xen/include/asm-x86/smp.h +++ b/xen/include/asm-x86/smp.h @@ -58,6 +58,14 @@ int hard_smp_processor_id(void); void __stop_this_cpu(void); +/* + * This value is considered to not change from the initial startup. + * Otherwise all the relevant places need to be retrofitted. + */ +extern unsigned int nr_sockets; + +/* Representing HT and core siblings in each socket */ +extern cpumask_t *socket_to_cpumask; #endif /* !__ASSEMBLY__ */ #endif -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |