From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org,
Ingo Molnar <mingo@kernel.org>,
dsahern@gmail.com, jolsa@redhat.com,
xiaoguangrong@linux.vnet.ibm.com, yangds.fnst@cn.fujitsu.com,
adrian.hunter@intel.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/7] perf trace pagefaults
Date: Fri, 20 Jun 2014 15:30:28 -0300 [thread overview]
Message-ID: <20140620183028.GK31524@kernel.org> (raw)
In-Reply-To: <20140620161859.GN15620@stfomichev-desktop.yandex.net>
Em Fri, Jun 20, 2014 at 08:18:59PM +0400, Stanislav Fomichev escreveu:
> > Hey, haven't you seen the vfs_getname probe? Idea is to hook on where
> > the relevant copy_from_user is done and insert that into the ring
> > buffer, as we already do for mapping fd -> pathname.
> I saw it but didn't actually try because it needs all the debugging
> stuff enabled and in place.
Touché, more on that below...
> > I.e. no need for actual tracepoints from day one, just wannabe
> > tracepoints using whatever probe inserting gizmo the kprobes_tracer used
> > by 'perf probe' now thinks its best to use.
> But we then need to predefine many probes for decoding to work in the form of
> func:offset, and then play catch-up with all the kernel changes.
> Or I miss something important here?
No you don't.
If we want to disturb the system in the least way possible, we need to
tag along the copying from userspace of those pointers, so that we get
them fresh and just stash it in our ring buffer and get out of the way
quickly.
> > For now try:
> >
> > perf probe 'vfs_getname=getname_flags:65 pathname=result->name:string'
> > trace
> >
> > And look at how it manages to decode fds.
> I will try, but does 65 still work after c4ad8f98bef77c7356aa6a9ad9188a6acc6b849d? :-)
Well, when I prototyped this[1] the idea is that in some areas, there is
not that much code flux that before commiting to any kind of new
interface, be it tracepoints or something else, we may well just use
'perf probe' to get what we need, and this was done in...
commit 75b757ca90469e990e6901f4a9497fe4161f7f5a
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Tue Sep 24 11:04:32 2013 -0300
Almost a year ago, and it still works, now lets see the cset you mention...
[acme@zoo linux]$ git describe c4ad8f98bef77c7356aa6a9ad9188a6acc6b849d
v3.14-rc1-14-gc4ad8f98bef7
[acme@zoo linux]$
[root@zoo ~]# uname -r
3.15.0-rc8+
Humm, what is the problem?
[root@zoo ~]# perf probe -V getname_flags:65
Available variables at getname_flags:65
@<getname_flags+227>
char* filename
int len
int* empty
long int max
struct filename* result
[root@zoo ~]#
[root@zoo ~]# perf probe 'vfs_getname=getname_flags:65 pathname=result->name:string'
Added new event:
probe:vfs_getname (on getname_flags:65 with pathname=result->name:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
[root@zoo ~]# perf record -e probe:vfs_getname -aR sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.133 MB perf.data (~49505 samples) ]
[root@zoo ~]# perf evlist
probe:vfs_getname
[root@zoo ~]# perf evlist -v
probe:vfs_getname: sample_freq=1, type: 2, config: 1317, size: 96, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, sample_id_all: 1, exclude_guest: 1
[root@zoo ~]# perf script
perf 11255 [003] 156054.623210: probe:vfs_getname: (ffffffff811c2e43) pathname="/home/acme/libexec/perf-core/sleep"
perf 11255 [003] 156054.624759: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/lib64/qt-3.3/bin/sleep"
perf 11255 [003] 156054.624782: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/lib64/ccache/sleep"
perf 11255 [003] 156054.624794: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/local/sbin/sleep"
perf 11255 [003] 156054.624809: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/local/bin/sleep"
perf 11255 [003] 156054.624818: probe:vfs_getname: (ffffffff811c2e43) pathname="/sbin/sleep"
perf 11255 [003] 156054.625017: probe:vfs_getname: (ffffffff811c2e43) pathname="/bin/sleep"
sleep 11255 [002] 156054.626093: probe:vfs_getname: (ffffffff811c2e43) pathname="/etc/ld.so.preload"
sleep 11255 [002] 156054.626114: probe:vfs_getname: (ffffffff811c2e43) pathname="/etc/ld.so.cache"
sleep 11255 [002] 156054.626159: probe:vfs_getname: (ffffffff811c2e43) pathname="/lib64/libc.so.6"
sleep 11255 [002] 156054.626751: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/lib/locale/locale-archive"
goa-daemon 2082 [003] 156054.955138: probe:vfs_getname: (ffffffff811c2e43) pathname="/etc/localtime"
goa-daemon 2082 [003] 156054.955573: probe:vfs_getname: (ffffffff811c2e43) pathname="/etc/localtime"
[root@zoo ~]#
Best possible way to do this? Guess not, but I'm looking from a tooling
perspective, i.e. about using what is available, not about adding requirements
to the kernel or toolchain, that we can do after we prototype in the best way
possible with existing facilities.
- Arnaldo
[1] And I feel like all of tools/perf/ is just that, reference implementations, but hopefully
done in a such a way that may well be useful as-is :-)
next prev parent reply other threads:[~2014-06-20 18:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 10:49 [PATCH v2 0/7] perf trace pagefaults Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 1/7] perf trace: add perf_event parameter to tracepoint_handler Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 2/7] perf trace: add support for pagefault tracing Stanislav Fomichev
2014-06-20 14:59 ` Arnaldo Carvalho de Melo
2014-06-20 15:49 ` Stanislav Fomichev
2014-06-20 16:11 ` Arnaldo Carvalho de Melo
2014-06-24 12:46 ` Stanislav Fomichev
2014-06-24 15:21 ` Arnaldo Carvalho de Melo
2014-06-20 10:49 ` [PATCH 3/7] perf trace: add pagefaults record and replay support Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 4/7] perf trace: add pagefault statistics Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 5/7] perf trace: add possibility to switch off syscall events Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 6/7] perf kvm: move perf_kvm__mmap_read into session utils Stanislav Fomichev
2014-06-20 14:44 ` Arnaldo Carvalho de Melo
2014-06-20 15:07 ` Stanislav Fomichev
2014-06-20 15:25 ` Arnaldo Carvalho de Melo
2014-06-23 14:06 ` David Ahern
2014-06-23 14:14 ` Stanislav Fomichev
2014-06-20 10:49 ` [PATCH 7/7] perf trace: add events cache Stanislav Fomichev
2014-06-20 13:21 ` [PATCH v2 0/7] perf trace pagefaults Arnaldo Carvalho de Melo
2014-06-20 15:03 ` Stanislav Fomichev
2014-06-20 15:24 ` Arnaldo Carvalho de Melo
2014-06-20 16:18 ` Stanislav Fomichev
2014-06-20 18:30 ` Arnaldo Carvalho de Melo [this message]
2014-06-23 11:41 ` Stanislav Fomichev
2014-06-24 14:15 ` Arnaldo Carvalho de Melo
2014-06-23 14:00 ` David Ahern
2014-06-24 7:17 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140620183028.GK31524@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=stfomichev@yandex-team.ru \
--cc=xiaoguangrong@linux.vnet.ibm.com \
--cc=yangds.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).