Re: [RFC PATCH 2/3 v3] perf: Implement Nehalem uncore pmu

From: Stephane Eranian
Date: Thu Jan 13 2011 - 12:14:30 EST


Lin,

On Thu, Dec 2, 2010 at 6:20 AM, Lin Ming <ming.m.lin@xxxxxxxxx> wrote:
> +static void uncore_pmu_enable_all(int nmi_core)
> +{
> + Â Â Â u64 ctrl;
> +
> + Â Â Â ctrl = ((1 << UNCORE_NUM_GENERAL_COUNTERS) - 1) | MSR_UNCORE_PERF_GLOBAL_CTRL_EN_FC0;
> +
> + Â Â Â /* Route all interrupts to the first core that accesses uncore */
> + Â Â Â ctrl |= 1ULL << (48 + nmi_core);
> +
> + Â Â Â wrmsrl(MSR_UNCORE_PERF_GLOBAL_CTRL, ctrl);
> +}

Are you sure nmi_core is always between 0-3 on a 4-core system and 0-5
on a 6-core system?
In other words, is that what topology_core_id(raw_smp_processor_id()) returns?

Note that, unfortunately, I have not seen documentation that says on
6-core system
UNC_GLOBAL_CTRL has 6 interrupt target bits, but it would make sense.


Otherwise, you will get a kernel panic when you wrmsr UNC_GLOBAL_CTRL.

> +
> + Â Â Â if (uncore->n_events == 1) {
> + Â Â Â Â Â Â Â nmi_core = topology_core_id(raw_smp_processor_id());
> + Â Â Â Â Â Â Â uncore->nmi_core = nmi_core;
> + Â Â Â Â Â Â Â uncore_pmu_enable_all(nmi_core);
> + Â Â Â }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/