[lkml]   [2020]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v6 2/4] perf: support build BPF skeletons with perf

> On Dec 29, 2020, at 3:48 AM, Arnaldo Carvalho de Melo <> wrote:
> Em Tue, Dec 29, 2020 at 04:01:41PM +0900, Namhyung Kim escreveu:
>> On Tue, Dec 29, 2020 at 2:41 AM Song Liu <> wrote:
>>> BPF programs are useful in perf to profile BPF programs. BPF skeleton is
>> I'm having difficulties understanding the first sentence - looks like a
>> recursion. :) So do you want to use two (or more) BPF programs?
> Yeah, we use perf to perf perf, so we need to use bpf with perf to perf
> bpf :-)
> Look at tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c, the BPF
> skeleton used to create the in-kernel scaffold to profile BPF programs.
> It uses two BPF programs (fentry/XXX and fexit/XXX) and some a
> PERF_EVENT_ARRAY map and an array to diff counters read at exit from
> counters read at exit of the profiled BPF programs and then accumulate
> those diffs in another PERCPU_ARRAY.
> This all ends up composing a "BPF PMU" that is what the userspace perf
> tooling will read (from "accum_readings" BPF map) and 'perf stat' will
> consume as if reading from an "old style perf counter" :-)
> Song, did I get it right? :-)

Thanks Arnaldo! I don't think anyone can explain it better. :-)



 \ /
  Last update: 2020-12-29 18:17    [W:0.086 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site