[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1294222121.2016.221.camel@laptop>
Date: Wed, 05 Jan 2011 11:08:41 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Lin Ming <ming.m.lin@...el.com>
Cc: Stephane Eranian <eranian@...gle.com>,
"Luck, Tony" <tony.luck@...el.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Andi Kleen <andi@...stfloor.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/7] perf: Check if HT is supported and enabled
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists