From mboxrd@z Thu Jan 1 00:00:00 1970 From: Francis Moreau Subject: Re: how to get a kernel callgraph starting from a syscall Date: Sat, 23 Apr 2011 11:01:27 +0200 Message-ID: References: <4DB04BF3.8080206@gmail.com> <4DB08A5B.3060706@gmail.com> <4DB0D00F.3040706@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-px0-f179.google.com ([209.85.212.179]:61737 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752730Ab1DWJB2 convert rfc822-to-8bit (ORCPT ); Sat, 23 Apr 2011 05:01:28 -0400 Received: by pxi2 with SMTP id 2so893911pxi.10 for ; Sat, 23 Apr 2011 02:01:27 -0700 (PDT) In-Reply-To: Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: Stefan Hajnoczi Cc: David Ahern , linux-perf-users@vger.kernel.org On Sat, Apr 23, 2011 at 10:40 AM, Stefan Hajnoczi = wrote: > On Fri, Apr 22, 2011 at 12:46 PM, Francis Moreau wrote: >> On Fri, Apr 22, 2011 at 7:29 AM, Francis Moreau wrote: >>> On Fri, Apr 22, 2011 at 2:47 AM, David Ahern wr= ote: >>>> On 04/21/11 14:07, Francis Moreau wrote: >>>>> On Thu, Apr 21, 2011 at 9:49 PM, David Ahern = wrote: >>>>>> >>>>>> You want the individual samples? if so, perf script dumps them a= nd you >>>>>> can see the callchain for each sys_read. >>>>>> >>>>> >>>>> hmm, I don't see what you mean by individual samples. >>>>> >>>>> I don't think sampling can help in my case (tracing the callchain= of >>>>> one syscall). >>>>> >>>>> Could you give me an example of what you have in mind ? >>>>> >>>>> Thanks >>>> >>>> I think I get it now. 'perf record' for syscall event stops at sys= _read >>>> as that is the point the event is generated. You want where the ke= rnel >>>> goes starting with sys_read. In that case you are limited to the >>>> pre-existing tracepoints (see 'perf list -e tracepoints') to trigg= er an >>>> event and back trace, or if the read causes the processes to block= you >>>> can you use the context-switch event or sched_switch trace point. >>>> >>>> You could also insert probe points using perf probe. Lin Ming post= ed an >>>> example of this a couple of weeks ago: >>>> # ./perf probe -k ~/vmlinux -s ~/linux-2.6/ =A0find_get_page >>>> # ./perf record -e probe:find_get_page -f -g -a >>>> >>> >>> Thanks for you answer. >>> >>> I think I'll use probe. >> >> >> Thinking more about it, I think that both solution (probe or >> tracepoint) are not adapted. >> >> Because I'm interested in discovering the path taken by the kernel >> from a given syscall, therefore I don't know this path. However both >> solution imply that the path is known since you need to insert some >> 'probes' in this path to see it... > > You can use "Dynamic ftrace with the function graph tracer" > (set_graph_function): > http://git.kernel.org/?p=3Dlinux/kernel/git/torvalds/linux-2.6.git;a=3D= blob;f=3DDocumentation/trace/ftrace.txt;hb=3DHEAD#l1664 > > I don't know of way to do this using perf(1). I don't know either but since perf interface is more convenient than sysfs one, I was wondering if that was possible with perf. Thanks --=20 =46rancis