mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 1/2] kernel/events: Add option to notify through signals on wakeup
Date: Tue, 13 Jun 2017 16:45:07 +0200	[thread overview]
Message-ID: <20170613144507.GB10107@krava> (raw)
In-Reply-To: <374b82f688b09c8b8160652089ff312a302830a0.1497353130.git.naveen.n.rao@linux.vnet.ibm.com>

On Tue, Jun 13, 2017 at 05:03:42PM +0530, Naveen N. Rao wrote:

SNIP

> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index b1c0b187acfe..e5810b1d74a4 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -345,7 +345,8 @@ struct perf_event_attr {
>  				context_switch :  1, /* context switch data */
>  				write_backward :  1, /* Write ring buffer from end to beginning */
>  				namespaces     :  1, /* include namespaces data */
> -				__reserved_1   : 35;
> +				signal_on_wakeup : 1, /* send signal on wakeup */
> +				__reserved_1   : 34;
>  
>  	union {
>  		__u32		wakeup_events;	  /* wakeup every n events */
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 6c4e523dc1e2..73ad30e124e5 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7362,12 +7362,14 @@ static int __perf_event_overflow(struct perf_event *event,
>  	 * events
>  	 */
>  
> -	event->pending_kill = POLL_IN;
> -	if (events && atomic_dec_and_test(&event->event_limit)) {
> -		ret = 1;
> -		event->pending_kill = POLL_HUP;
> +	if (!event->attr.signal_on_wakeup) {
> +		event->pending_kill = POLL_IN;
> +		if (events && atomic_dec_and_test(&event->event_limit)) {
> +			ret = 1;
> +			event->pending_kill = POLL_HUP;
>  
> -		perf_event_disable_inatomic(event);
> +			perf_event_disable_inatomic(event);
> +		}
>  	}
>  
>  	READ_ONCE(event->overflow_handler)(event, data, regs);
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 2831480c63a2..4e7c728569a8 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -21,6 +21,9 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
>  {
>  	atomic_set(&handle->rb->poll, POLLIN);
>  
> +	if (handle->event->attr.signal_on_wakeup)
> +		handle->event->pending_kill = POLL_IN;
> +

since it's signal_on_wakeup, should we also send POLL_HUP for
perf_event_wakeup calls from perf_event_exit_event?

jirka

  reply	other threads:[~2017-06-13 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 11:33 [RFC PATCH v2 0/2] Notifications for perf sideband events Naveen N. Rao
2017-06-13 11:33 ` [RFC PATCH v2 1/2] kernel/events: Add option to notify through signals on wakeup Naveen N. Rao
2017-06-13 14:45   ` Jiri Olsa [this message]
2017-06-13 15:16     ` Naveen N. Rao
2017-06-13 11:33 ` [RFC PATCH v2 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events Naveen N. Rao

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=20170613144507.GB10107@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /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

Powered by JetHome