From: Will Deacon <will.deacon@arm.com>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 1/3] perf: disable sampled events if no PMU interrupt
Date: Mon, 19 May 2014 17:01:43 +0100 [thread overview]
Message-ID: <20140519160143.GL15130@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1405161708060.11099@vincent-weaver-1.umelst.maine.edu>
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);
>
> /*
>
next prev parent reply other threads:[~2014-05-19 16:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 21:07 [PATCH 0/3] perf: disable sampled events if no PMU interrupt Vince Weaver
2014-05-16 21:12 ` [PATCH 1/3] " Vince Weaver
2014-05-19 16:01 ` Will Deacon [this message]
2014-05-20 9:12 ` Peter Zijlstra
2014-05-20 13:19 ` Vince Weaver
2014-05-20 13:27 ` Peter Zijlstra
2014-06-05 14:38 ` [tip:perf/core] perf: Disable " tip-bot for Vince Weaver
2014-05-16 21:15 ` [PATCH 2/3] perf, ARM: use common PMU interrupt disabled code Vince Weaver
2014-05-19 15:57 ` Will Deacon
2014-05-20 9:12 ` Peter Zijlstra
2014-06-05 14:38 ` [tip:perf/core] perf/ARM: Use " tip-bot for Vince Weaver
2014-05-16 21:18 ` [PATCH 3/3] perf,x86: use " Vince Weaver
2014-06-05 14:38 ` [tip:perf/core] perf/x86: Use " tip-bot for Vince Weaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140519160143.GL15130@arm.com \
--to=will.deacon@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=vincent.weaver@maine.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox