lkml.org 
[lkml]   [2015]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 09/16] perf tools: Enable indices setting syntax for BPF maps
Em Fri, Dec 11, 2015 at 09:11:45AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Dec 08, 2015 at 02:25:37AM +0000, Wang Nan escreveu:
> > This patch introduce a new syntax to perf event parser:
> >
> > # perf record -e bpf_file.c/maps.mymap.value[0,3...5,7]=1234/ ...
>
> Is the above example valid? Wouldn't this be "maps:mymap.value" ?
>
> >
> > By utilizing the basic facilities in bpf-loader.c which allow setting
> > different slots in a BPF map separately, the newly introduced syntax
> > allows perf to control specific elements in a BPF map.
> >
> > Test result:
> >
> > # cat ./test_bpf_map_3.c
> > /************************ BEGIN **************************/
> > #define SEC(NAME) __attribute__((section(NAME), used))
> > enum bpf_map_type {
> > BPF_MAP_TYPE_ARRAY = 2,
> > };
> > struct bpf_map_def {
> > unsigned int type;
> > unsigned int key_size;
> > unsigned int value_size;
> > unsigned int max_entries;
> > };
> > static void *(*map_lookup_elem)(struct bpf_map_def *, void *) =
> > (void *)1;
> > static int (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
> > (void *)6;
>
> Can you explain the above a bit more? What are the magic 1 and 6 values?

So, from another patch:

static u64 (*bpf_ktime_get_ns)(void) =
(void *)5;
static int (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
(void *)6;
static int (*bpf_get_smp_processor_id)(void) =
(void *)8;
static int (*bpf_perf_event_output)(void *, struct bpf_map_def *, int,
void *, unsigned long) =
(void *)23;

Where can I get this magical mistery table? Could this be hidden away in
some .h file automagically included in bpf scriptlets so that n00bies
like me don't have to be wtf'ing?

- Arnaldo


\
 
 \ /
  Last update: 2015-12-11 13:41    [W:0.060 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site