Re: [PATCH V4 07/14] perf/x86/intel: Support hardware TopDown metrics
From: Peter Zijlstra
Date: Mon Sep 30 2019 - 09:36:32 EST
On Mon, Sep 16, 2019 at 06:41:21AM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
> +static int add_nr_metric_event(struct cpu_hw_events *cpuc,
> + struct perf_event *event,
> + int *max_count)
> +{
> + /* There are 4 TopDown metrics events. */
> + if (is_metric_event(event) && (++cpuc->n_metric_event > 4))
> + return -EINVAL;
> +
> + *max_count += cpuc->n_metric_event;
That's busted; it would increment with 1,2,3,4 for a total of 10.
> +
> + return 0;
> +}