lkml.org 
[lkml]   [2011]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/7] perf: Check if HT is supported and enabled
From
Date
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.


\
 
 \ /
  Last update: 2011-01-05 11:11    [W:0.095 / U:2.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site