lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] perf: disable sampled events if no PMU interrupt
On Fri, May 16, 2014 at 10:12:12PM +0100, 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@maine.edu>
>
> 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;

Move this to the top of the struct, along with the other data fields?

Anyway, this looks really useful to me and I'd really like to use it for
ARM!

Acked-by: Will Deacon <will.deacon@arm.com>

Will


> +
> };
>
> /**
> + * struct pmu->capabilites flags
> + */
> +#define PERF_PMU_NO_INTERRUPT 1
> +
> +/**
> * enum perf_event_active_state - the states of a event
> */
> enum perf_event_active_state {
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index f83a71a..f5d8554 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7072,6 +7072,13 @@ SYSCALL_DEFINE5(perf_event_open,
> }
> }
>
> + if (is_sampling_event(event)) {
> + if (event->pmu->capabilities & PERF_PMU_NO_INTERRUPT) {
> + err = -ENOTSUPP;
> + goto err_alloc;
> + }
> + }
> +
> account_event(event);
>
> /*
>


\
 
 \ /
  Last update: 2014-05-19 18:41    [W:0.636 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site