[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170613151613.GA16085@naverao1-tp.localdomain>
Date: Tue, 13 Jun 2017 20:46:13 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 1/2] kernel/events: Add option to notify through
signals on wakeup
Hi Jiri,
On 2017/06/13 04:45PM, Jiri Olsa wrote:
> 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?
Yes, I suspect so (though I'm open to changing the name ;)
I haven't handled POLL_HUP properly in this patch, including
IOC_REFRESH. I will look into that next.
I wanted to know if the overall approach is fine -- between RFC v1 vs.
this version.
Thanks for the review!
- Naveen
Powered by blists - more mailing lists