From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754604AbbCaNds (ORCPT ); Tue, 31 Mar 2015 09:33:48 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:55406 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754541AbbCaNdp (ORCPT ); Tue, 31 Mar 2015 09:33:45 -0400 Date: Tue, 31 Mar 2015 10:33:48 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: Jiri Olsa , Ingo Molnar , Namhyung Kim , Peter Zijlstra , David Ahern , linux-kernel@vger.kernel.org, Martin Cermak Subject: Re: [RFC] perf probe: -x option position issue Message-ID: <20150331133348.GF9438@kernel.org> References: <20150330174655.GA27546@krava.redhat.com> <20150330194849.GH32560@kernel.org> <551A5502.4070905@hitachi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <551A5502.4070905@hitachi.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Mar 31, 2015 at 05:04:18PM +0900, Masami Hiramatsu escreveu: > (2015/03/31 4:48), Arnaldo Carvalho de Melo wrote: > > No, I can't, I'd say we should support that, i.e. inserting multiple > > probes per command line, for different DSOs, etc. I.e. the above would > > be equivalent to these two calls: > > [root@ssdandy acme]# perf probe -a icmp_rcv > > Added new event: > > probe:icmp_rcv (on icmp_rcv) > > You can now use it in all perf tools, such as: > > perf record -e probe:icmp_rcv -aR sleep 1 > > [root@ssdandy acme]# perf probe -x ./ex -a main > > Added new event: > > probe_ex:main (on main in /home/acme/ex) > > You can now use it in all perf tools, such as: > > perf record -e probe_ex:main -aR sleep 1 > > [root@ssdandy acme]# > OK, finally we should support that. > > But it isn't like that, so, yes, what you report is a bug, both for your > > expectation (that I think is that it should put a uprobes with both your > > examples) and for mine (that it would add the first to the kernel, and > > the second to the selected DSO via -x). > Yes, both are bugs. I'll fix that. > BTW, let me check that the below behaviors are OK for you. > perf probe -x BIN -a XXX > -> setup XXX on BIN Ok > perf probe -a XXX -x BIN > -> setup XXX on BIN > perf probe -a XXX -x BIN -a YYY > -> setup XXX on kernel and YYY on BIN The two above are inconsistent, I think, first one, for me, doesn't make sense, i.e. it says: Add XXX to the selected DSO, which, as none was specified at that point, should be the kernel, right? I.e. if we do: > perf probe -a XXX Without that extra -x that is coming _after_ the command to add a probe to XXX (-a XXX), what is that the tool should do (does from day 1, when 'probe' was first introduced in tools/perf/): Add a probe to XXX _in the kernel_, i.e. not specifying a DSO means: its for the kernel. So, for me: > perf probe -a XXX -x BIN > -> setup XXX on BIN Is invalid (or inocuous if what one wants is to add a probe for XXX on the BIN dso), because it doesn't make sense _if you want to support adding multiple probes for different DSOs on the same command line_, because it would mean: Add a probe to XXX _in the kernel_, then select BIN as the DSO for which probes will be then specified, but in this example, none are specified after that "-x BIN", so, I think that: perf probe -a XXX -x BIN and: perf probe -a XXX Mean the same thing, i.e. add a probe for XXX in the kernel. > perf probe -x BIN -a XXX -x BIN2 -a YYY > -> setup XXX on BIN and YYY on BIN2 Ok. Also, more generically, I think that: perf probe -a AAA -a BBB -a CCC -a DDD -x /lib64/libc-2.17.so -a malloc -a free \ -x /usr/lib64/libthread_db-1.0.so -a td_lookup -a td_thr_event_enable Should add kprobes for AAA, BBB, CCC and DDD in the kernel, uprobes for malloc and free on libc and uprobes for td_lookup and td_thr_event_enable on libthread_db. Making it even more compact would be a bonus: perf probe -a AAA,BBB,CCC,DDD -x /lib64/libc-2.17.so -a malloc,free \ -x /usr/lib64/libthread_db-1.0.so -a td_lookup,td_thr_event_enable :-) - Arnaldo