[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181206103149.GD27838@krava>
Date: Thu, 6 Dec 2018 11:31:49 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
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 Thu, Dec 06, 2018 at 09:34:00AM +0100, Peter Zijlstra wrote:
> On Thu, Dec 06, 2018 at 09:10:28AM +0100, Peter Zijlstra wrote:
> > On Wed, Dec 05, 2018 at 05:05:02PM +0100, Jiri Olsa wrote:
> > > +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);
> > > +
> > > + current->perf_blocked = false;
> > > +}
> >
> > I don't understand this.. why are we using schedule_timeout() and all
> > that?
>
> Urgh.. in fact, the more I look at this the more I hate it.
>
> We want to block in __perf_output_begin(), but we cannot because both
> tracepoints and perf will have preemptability disabled down there.
>
> So what we do is fail the event, fake the lost count and go all the way
> up that callstack, detect the failure and then poll-wait and retry.
right
>
> And only do this for a few special events... *yuck*
yes ;-)
jirka
Powered by blists - more mailing lists