From: Ingo Molnar <mingo@kernel.org>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
eranian@google.com, Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [patch] inherited events not signalling parent on overflow
Date: Fri, 29 May 2015 08:36:50 +0200 [thread overview]
Message-ID: <20150529063650.GA22568@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1505281453220.31735@vincent-weaver-1.umelst.maine.edu>
* Vince Weaver <vincent.weaver@maine.edu> wrote:
> We're trying to get self-monitoring multi-threaded sampling working in PAPI.
> Fun times.
>
> Is this even possible?
>
> Ideally in your parent thread you could perf_event_open() with inherit set.
> Then your program (say an OpenMP program) would do its thing and all of the
> samples would get written back to the parent thread's mmap() buffer.
>
> But this won't work as mmap'ing an inherited event is explicitly disasllowed in
> events.c due to "performance reasons".
>
> Which is believable, it's just there's not really a good alternative that
> doesn't involve having to somehow manually instrument every single possible
> thread.
>
> on a related note, I turned up the following issue when working on this issue.
> I don't know if this is the proper fix but it makes my simple test case behave
> as expected.
>
> If we inherit events, we inherit the signal state but not the fasync state, so
> overflows in inherited children will never trigger the signal handler.
>
> Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 1a3bf48..7df4cf5 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -8626,6 +8630,8 @@ inherit_event(struct perf_event *parent_event,
> child_event->overflow_handler_context
> = parent_event->overflow_handler_context;
>
> + child_event->fasync = parent_event->fasync;
> +
> /*
> * Precalculate sample_data sizes
> */
Btw., if we do this (sensible looking) ABI fix, could we make it a new attr bit,
so that PAPI can essentially query the kernel whether this gets propagated
properly?
That way old kernels 'intentionally' don't inherit the fasync handler and tooling
can deterministically make use of this 'feature' on new kernels.
Thanks,
Ingo
next prev parent reply other threads:[~2015-05-29 6:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 19:06 [patch] inherited events not signalling parent on overflow Vince Weaver
2015-05-28 19:15 ` Peter Zijlstra
2015-05-29 16:45 ` Vince Weaver
2015-05-29 6:36 ` Ingo Molnar [this message]
2015-06-11 4:30 ` Vince Weaver
2015-06-11 8:32 ` Peter Zijlstra
2015-07-31 4:42 ` Vince Weaver
2015-07-31 9:26 ` Peter Zijlstra
2015-08-04 8:51 ` [tip:perf/urgent] perf: Fix fasync handling on inherited events tip-bot for Peter Zijlstra
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=20150529063650.GA22568@gmail.com \
--to=mingo@kernel.org \
--cc=acme@kernel.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--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