[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5594B50A.3010705@plumgrid.com>
Date: Wed, 01 Jul 2015 20:50:34 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: He Kuang <hekuang@...wei.com>, rostedt@...dmis.org,
masami.hiramatsu.pt@...achi.com, mingo@...hat.com, acme@...hat.com,
a.p.zijlstra@...llo.nl, jolsa@...nel.org, namhyung@...nel.org
CC: wangnan0@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/5] bpf: Put perf_events check ahead of bpf prog
On 6/30/15 7:57 PM, He Kuang wrote:
> When we add a kprobe point and record events by perf, the execution path
> of all threads on each cpu will enter this point, but perf may only
> record events on a particular thread or cpu at this kprobe point, a
> check on call->perf_events list filters out the threads which perf is
> not recording.
I think there is a better way to do that. You're adding artificial
per_cpu filtering whereas you really need per_pid filtering.
The patch kinda worked, but looks more by accident.
The accurate way to do per_pid filtering is to automatically add
'if ((u32)bpf_get_current_pid_tgid() != expected_pid) return 0;'
as the first statement of the program.
You already have nice infra to add prologue to the program.
So I think adding above 'if' on user space side of perf is
a preferred way to achieve that.
Also such per_pid filtering should be smart.
The command 'perf record -a -e my_prog.o -- sleep 10' should
collect all things that my_prog was attached to and not only
things that happened as part of sleep.
--
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