Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-13 Thread Jiri Olsa
On Thu, Dec 13, 2018 at 11:01:49AM +0100, Peter Zijlstra wrote: > On Wed, Dec 12, 2018 at 08:26:39PM -0500, Steven Rostedt wrote: > > On Thu, 13 Dec 2018 03:39:38 +0300 > > "Dmitry V. Levin" wrote: > > > > > btw, I didn't ask for the implementation to be ugly. > > > You don't have to introduce po

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-13 Thread Peter Zijlstra
On Thu, Dec 13, 2018 at 11:01:49AM +0100, Peter Zijlstra wrote: > - the wakeups side is icky; the best I can come up with is making the >data page R/O and single stepping on write fault, but that isn't >multi-threading safe. We can emulate the instruction, that would actually work and be

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-13 Thread Peter Zijlstra
On Thu, Dec 13, 2018 at 11:01:49AM +0100, Peter Zijlstra wrote: > One, very big maybe, would be to add a new tracepoint type that includes > a might_sleep() and we very carefully undo all the preempt_disable and > go sleep where we should. That also gives the tracepoint crud the > information it ne

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-13 Thread Peter Zijlstra
On Wed, Dec 12, 2018 at 08:26:39PM -0500, Steven Rostedt wrote: > On Thu, 13 Dec 2018 03:39:38 +0300 > "Dmitry V. Levin" wrote: > > > btw, I didn't ask for the implementation to be ugly. > > You don't have to introduce polling into the kernel if you don't want to, > > userspace is perfectly capab

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-12 Thread Dmitry V. Levin
On Wed, Dec 12, 2018 at 08:26:39PM -0500, Steven Rostedt wrote: > On Thu, 13 Dec 2018 03:39:38 +0300, wrote: > > > btw, I didn't ask for the implementation to be ugly. > > You don't have to introduce polling into the kernel if you don't want to, > > userspace is perfectly capable of invoking wait4

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-12 Thread Steven Rostedt
On Thu, 13 Dec 2018 03:39:38 +0300 "Dmitry V. Levin" wrote: > btw, I didn't ask for the implementation to be ugly. > You don't have to introduce polling into the kernel if you don't want to, > userspace is perfectly capable of invoking wait4(2) in a loop. > Just block the tracee, notify the trace

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-12 Thread Dmitry V. Levin
Hi Peter, On Mon, Dec 10, 2018 at 11:18:18AM +0100, Peter Zijlstra wrote: > On Sat, Dec 08, 2018 at 12:38:05PM -0500, Steven Rostedt wrote: > > On Sat, 8 Dec 2018 11:44:23 +0100, Peter Zijlstra wrote: > > > > > Why do we care about lost events? Because strace records *all* events, > > > > as that

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-10 Thread Peter Zijlstra
On Sat, Dec 08, 2018 at 12:38:05PM -0500, Steven Rostedt wrote: > On Sat, 8 Dec 2018 11:44:23 +0100 > Peter Zijlstra wrote: > > > Why do we care about lost events? Because strace records *all* events, > > > as that's what it does and that's what it always has done. It would be > > > a break in fu

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-08 Thread Steven Rostedt
On Sat, 8 Dec 2018 11:44:23 +0100 Peter Zijlstra wrote: > It's a tool I haven't used in years, given we have so many better tools > around these days. So because you don't use it, it's useless? As you don't care about lost events I can see why you may think there are better tools out there. But

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-08 Thread Steven Rostedt
On Sat, 8 Dec 2018 11:41:21 +0100 Peter Zijlstra wrote: > > [root@seventh bpf]# trace -e augmented_raw_syscalls.c --filter-pids > > 2279,1643 > > > > 19766.027 ( 0.003 ms): gcc/27524 openat(dfd: CWD, filename: > > /lib64/libz.so.1, flags: CLOEXEC ) = 5 > > 19766.035 ( 0.001 ms): g

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-08 Thread Peter Zijlstra
On Fri, Dec 07, 2018 at 03:14:33PM -0500, Steven Rostedt wrote: > On Fri, 7 Dec 2018 16:11:05 +0100 > Peter Zijlstra wrote: > > > On Fri, Dec 07, 2018 at 08:41:18AM -0500, Steven Rostedt wrote: > > > On Fri, 7 Dec 2018 09:58:39 +0100 > > > Peter Zijlstra wrote: > > > > > > > These patches giv

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-08 Thread Peter Zijlstra
On Fri, Dec 07, 2018 at 12:49:21PM -0300, Arnaldo Carvalho de Melo wrote: > Em Fri, Dec 07, 2018 at 04:11:05PM +0100, Peter Zijlstra escreveu: > > On Fri, Dec 07, 2018 at 08:41:18AM -0500, Steven Rostedt wrote: > > > On Fri, 7 Dec 2018 09:58:39 +0100 Peter Zijlstra > > > wrote: > > > > > These p

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Steven Rostedt
On Fri, 7 Dec 2018 16:11:05 +0100 Peter Zijlstra wrote: > On Fri, Dec 07, 2018 at 08:41:18AM -0500, Steven Rostedt wrote: > > On Fri, 7 Dec 2018 09:58:39 +0100 > > Peter Zijlstra wrote: > > > > > These patches give no justification *what*so*ever* for why we're doing > > > ugly arse things lik

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Arnaldo Carvalho de Melo
Em Fri, Dec 07, 2018 at 04:11:05PM +0100, Peter Zijlstra escreveu: > On Fri, Dec 07, 2018 at 08:41:18AM -0500, Steven Rostedt wrote: > > On Fri, 7 Dec 2018 09:58:39 +0100 Peter Zijlstra > > wrote: > > > These patches give no justification *what*so*ever* for why we're doing > > > ugly arse things

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Peter Zijlstra
On Fri, Dec 07, 2018 at 08:41:18AM -0500, Steven Rostedt wrote: > On Fri, 7 Dec 2018 09:58:39 +0100 > Peter Zijlstra wrote: > > > These patches give no justification *what*so*ever* for why we're doing > > ugly arse things like this. And why does this, whatever this is, need to > > be done in perf

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Steven Rostedt
On Fri, 7 Dec 2018 09:58:39 +0100 Peter Zijlstra wrote: > These patches give no justification *what*so*ever* for why we're doing > ugly arse things like this. And why does this, whatever this is, need to > be done in perf? > > IOW, what problem are we solving ? I guess the cover letter should h

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Peter Zijlstra
On Thu, Dec 06, 2018 at 01:19:46PM -0500, Steven Rostedt wrote: > On Thu, 6 Dec 2018 09:34:00 +0100 > Peter Zijlstra wrote: > > > > > > > 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. > >

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-07 Thread Jiri Olsa
On Thu, Dec 06, 2018 at 01:19:46PM -0500, Steven Rostedt wrote: > On Thu, 6 Dec 2018 09:34:00 +0100 > Peter Zijlstra wrote: > > > > > > > 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. > >

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Steven Rostedt
On Thu, 6 Dec 2018 09:34:00 +0100 Peter Zijlstra wrote: > > > > 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 > tracepoi

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Jiri Olsa
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_bl

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Peter Zijlstra
On Thu, Dec 06, 2018 at 09:24:55AM +0100, Jiri Olsa 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

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Jiri Olsa
On Thu, Dec 06, 2018 at 09:09:10AM +0100, Peter Zijlstra wrote: > On Wed, Dec 05, 2018 at 05:05:02PM +0100, Jiri Olsa wrote: > > Adding support to specify 'block' bool in struct perf_event_attr > > NAK for having _Bool in structures. oops, will change.. if there's ever another version ;-) jirka

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Jiri Olsa
On Thu, Dec 06, 2018 at 09:17:07AM +0100, Peter Zijlstra wrote: > On Wed, Dec 05, 2018 at 05:05:02PM +0100, Jiri Olsa wrote: > > @@ -10461,6 +10484,19 @@ SYSCALL_DEFINE5(perf_event_open, > > return -EINVAL; > > } > > > > + if (attr.block) { > > + /* > > +

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Peter Zijlstra
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 *

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Jiri Olsa
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 *

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Peter Zijlstra
On Wed, Dec 05, 2018 at 05:05:02PM +0100, Jiri Olsa wrote: > @@ -10461,6 +10484,19 @@ SYSCALL_DEFINE5(perf_event_open, > return -EINVAL; > } > > + if (attr.block) { > + /* > + * Allow only syscall tracepoints, check for syscall class > +

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Peter Zijlstra
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; > + > +

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-06 Thread Peter Zijlstra
On Wed, Dec 05, 2018 at 05:05:02PM +0100, Jiri Olsa wrote: > Adding support to specify 'block' bool in struct perf_event_attr NAK for having _Bool in structures.

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-05 Thread Jiri Olsa
On Wed, Dec 05, 2018 at 12:35:03PM -0500, Steven Rostedt wrote: > On Wed, 5 Dec 2018 17:05:02 +0100 > Jiri Olsa 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/commo

Re: [PATCH 1/8] perf: Allow to block process in syscall tracepoints

2018-12-05 Thread Steven Rostedt
On Wed, 5 Dec 2018 17:05:02 +0100 Jiri Olsa 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 *re