Re: [RFC] x86,perf: Implement minimal P4 PMU driver v14

From: Cyrill Gorcunov
Date: Wed Mar 10 2010 - 23:13:16 EST


On 3/11/10, Lin Ming <ming.m.lin@xxxxxxxxx> wrote:
> On Thu, 2010-03-11 at 02:31 +0800, Cyrill Gorcunov wrote:
>> +static __initconst struct x86_pmu p4_pmu = {
>> + .name = "Netburst P4/Xeon",
>> + .handle_irq = p4_pmu_handle_irq,
>> + .disable_all = p4_pmu_disable_all,
>> + .enable_all = p4_pmu_enable_all,
>> + .enable = p4_pmu_enable_event,
>> + .disable = p4_pmu_disable_event,
>> + .eventsel = MSR_P4_BPU_CCCR0,
>> + .perfctr = MSR_P4_BPU_PERFCTR0,
>> + .event_map = p4_pmu_event_map,
>> + .raw_event = p4_pmu_raw_event,
>> + .max_events = ARRAY_SIZE(p4_event_map),
>> + /*
>> + * IF HT disabled we may need to use all
>> + * ARCH_P4_MAX_CCCR counters simulaneously
>> + * though leave it restricted at moment assuming
>> + * HT is on
>> + */
>> + .num_events = ARCH_P4_MAX_CCCR,
>> + .apic = 1,
>> + .event_bits = 40,
>> + .event_mask = (1ULL << 40) - 1,
>> + .max_period = (1ULL << 39) - 1,
>> + .hw_config = p4_hw_config,
>> + .schedule_events = p4_pmu_schedule_events,
>> +};
>
> commit ca03770(perf, x86: Add PEBS infrastructure) introduces a new
> function validate_event that calls x86_pmu.get_event_constraints.
>
> static int validate_event(struct perf_event *event)
> {
> ...
> c = x86_pmu.get_event_constraints(fake_cpuc, event);
> ...
> }
>
> So we need to add .get_event_constraints to p4_pmu.
>
> diff --git a/arch/x86/kernel/cpu/perf_event_p4.c
> b/arch/x86/kernel/cpu/perf_event_p4.c
> index 4eb79b1..99a2a7c 100644
> --- a/arch/x86/kernel/cpu/perf_event_p4.c
> +++ b/arch/x86/kernel/cpu/perf_event_p4.c
> @@ -586,6 +586,7 @@ static __initconst struct x86_pmu p4_pmu = {
> .max_period = (1ULL << 39) - 1,
> .hw_config = p4_hw_config,
> .schedule_events = p4_pmu_schedule_events,
> + .get_event_constraints = x86_get_event_constraints,
> };
>
> static __init int p4_pmu_init(void)
>
> ---
> Lin Ming
>
>
>
Thanks, Ming! This snippet somehow escaped me. Will update.
--
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/