Messages in this thread | | | Subject | Re: [PATCH 4/7] perf: Check if HT is supported and enabled | From | Peter Zijlstra <> | Date | Wed, 05 Jan 2011 11:08:41 +0100 |
| |
On Wed, 2011-01-05 at 13:45 +0800, Lin Ming wrote: > static void intel_pmu_cpu_starting(int cpu) > { > struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); > struct intel_percore *pc; > int core_id = topology_core_id(cpu); > int i; > > init_debug_store_on_cpu(cpu); > /* > * Deal with CPUs that don't clear their LBRs on power-up. > */ > intel_pmu_lbr_reset(); > > if (!ht_enabled(cpu)) > return; > > cpuc->per_core = kzalloc_node(sizeof(struct intel_percore), > GFP_KERNEL, cpu_to_node(cpu));
#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running. * Called on the new cpu, just before * enabling interrupts. Must not sleep, * must not fail */
> if (!cpuc->per_core) > return; > > raw_spin_lock_init(&cpuc->per_core->lock); > pc = cpuc->per_core; > > for_each_cpu(i, topology_thread_cpumask(cpu)) { > cpuc = &per_cpu(cpu_hw_events, cpu); > > cpuc->per_core = pc; > cpuc->per_core->core_id = core_id; > cpuc->per_core->refcnt++; > } > }
Anyway, I think something like:
static bool ht_capable(void) { return boot_cpu_has(X86_FEATURE_HT) && smp_num_siblings > 1; }
is sufficient, the whole hotplug issues makes relying on enumeration results impractical.
| |