Re: [PATCH 1/3] perf: disable sampled events if no PMU interrupt

From: Peter Zijlstra
Date: Tue May 20 2014 - 05:12:33 EST


On Fri, May 16, 2014 at 05:12:12PM -0400, Vince Weaver wrote:
>
> Add common code to generate ENOTSUPP at event creation time if an
> architecture attempts to create a sampled event and PERF_PMU_NO_INTERRUPT
> is set.
>
> This adds a new pmu->capabilities flag.
> Initially we only support PERF_PMU_NO_INTERRUPT (to indicate a PMU
> has no support for generating hardware interrupts) but there are
> other capabilities that can be added later.
>
> Signed-off-by: Vince Weaver <vincent.weaver@xxxxxxxxx>
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 3356abc..2164763 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -251,9 +251,20 @@ struct pmu {
> * flush branch stack on context-switches (needed in cpu-wide mode)
> */
> void (*flush_branch_stack) (void);
> +
> + /*
> + * various common per-pmu feature flags
> + */
> + int capabilities;

As suggested by Will, I've put it in a 4 byte hole earlier in the
structure.

> };
>
> /**
> + * struct pmu->capabilites flags

Due to braindamage from years of C++ coding, many other comments refer
to members using the C++ :: notation, so I've changed that to be
consistent and read: pmu::capabilities.

> + */
> +#define PERF_PMU_NO_INTERRUPT 1

Are you ok with me making that:

#define PERF_PMU_CAP_NO_INTERRUPT 0x01


--
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/