[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181205175638.GD3836@krava>
Date: Wed, 5 Dec 2018 18:56:38 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Luis Claudio R. Goncalves" <lclaudio@...g.org>, ldv@...linux.org,
esyr@...hat.com, Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints
On Wed, Dec 05, 2018 at 12:35:03PM -0500, Steven Rostedt wrote:
> On Wed, 5 Dec 2018 17:05:02 +0100
> Jiri Olsa <jolsa@...nel.org> wrote:
>
> > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > index 3b2490b81918..e55cf9169a03 100644
> > --- a/arch/x86/entry/common.c
> > +++ b/arch/x86/entry/common.c
> > @@ -60,6 +60,32 @@ static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
> > }
> > }
> >
> > +static void trace_block_syscall(struct pt_regs *regs, bool enter)
> > +{
> > + current->perf_blocked = true;
> > +
> > + do {
> > + schedule_timeout(100 * HZ);
> > + current->perf_blocked_cnt = 0;
> > +
> > + if (enter) {
> > + /* perf syscalls:* enter */
> > + perf_trace_syscall_enter(regs);
> > +
> > + /* perf raw_syscalls:* enter */
> > + perf_trace_sys_enter(&event_sys_enter, regs, regs->orig_ax);
> > + } else {
> > + /* perf syscalls:* enter */
> > + perf_trace_syscall_exit(regs);
> > +
> > + /* perf raw_syscalls:* enter */
> > + perf_trace_sys_exit(&event_sys_exit, regs, regs->ax);
> > + }
> > + } while (current->perf_blocked_cnt);
>
> I was thinking, if the process reading the perf buffer dies, how do we
> tell this task to continue on?
when the tracer process dies, its event will get uninstalled from the
trace_event_call::perf_events list, so the next iteration of above loop
won't get any blocked event and it will leave (assuming there's just
single event)
jirka
Powered by blists - more mailing lists