lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Apr 2013 13:59:21 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Anton Arapov <anton@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	"yrl.pp-manager.tt@...achi.com" <yrl.pp-manager.tt@...achi.com>
Subject: Re: [PATCH 0/1] uprobes/tracing: Don't pass addr=ip to
	perf_trace_buf_submit()

On 04/11, Masami Hiramatsu wrote:
>
> (2013/04/10 23:58), Oleg Nesterov wrote:
>
> > And... Cough, another question ;) To simplify, lets discuss kprobe_perf_func()
> > only. Suppose that a task hits the kprobe but this task/cpu doesn't have
> > a counter. Can't we avoid perf_trace_buf_prepare/submit in this case?
> > IOW, what do you think about the change below?
>
> Hmm, I'm not so sure how frequently this happens.

Suppose that you do, say, "perf record -e probe:some_func workload". Only
"workload" will have the active counter, any other task which hits the
probed some_func() will do perf_trace_buf_prepare/perf_trace_buf_submit
just to realize that nobody wants perf_swevent_event().

Simple test-case:

	#include <unistd.h>

	int main(void)
	{
		int n;

		for (n = 0; n < 1000 * 1000; ++n)
			getppid();

		return 0;
	}

Without kprobe:

	# time ./ppid

	real    0m0.663s
	user    0m0.163s
	sys     0m0.500s

Activate the probe:

	# perf probe sys_getppid

	# perf record -e probe:sys_getppid sleep 1000 &
	[1] 546

Test it again 3 times:

	# time ./ppid

Before the patch:

	real    0m9.727s
	user    0m0.177s
	sys     0m9.547s

	real    0m9.752s
	user    0m0.180s
	sys     0m9.573s

	real    0m9.761s
	user    0m0.187s
	sys     0m9.573s

After the patch:

	real    0m9.605s
	user	0m0.163s
	sys	0m9.437s

	real	0m9.592s
	user	0m0.167s
	sys	0m9.423s

	real	0m9.613s
	user	0m0.183s
	sys	0m9.427s

So the difference looks measurable but small, and I did the testing
under qemu so I do not really know if we can trust the numbers.

> And, is this right way to
> handle that case?

If only I was sure ;) I am asking.

And, to clarify, it is not that I think this change can really
improve the perfomance. Just I am trying to understand what I have
missed.

> If so, we can do same thing also on trace_events.
> (perf_trace_##call in include/trace/ftrace.h)

Yes, yes, this is not kprobe-specific. It seems that more users of
perf_trace_buf_submit() could be changed the same way.

Thanks,

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ