lkml.org 
[lkml]   [2015]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH v8 46/49] perf tools: Add prologue for BPF programs for fetching arguments


    On 2015/6/24 20:31, Wang Nan wrote:

    [SNIP]

    > diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h
    > new file mode 100644
    > index 0000000..3f77606
    > --- /dev/null
    > +++ b/tools/perf/util/bpf-prologue.h
    > @@ -0,0 +1,19 @@
    > +/*
    > + * Copyright (C) 2015, He Kuang <hekuang@huawei.com>
    > + * Copyright (C) 2015, Huawei Inc.
    > + */
    > +#ifndef __BPF_PROLOGUE_H
    > +#define __BPF_PROLOGUE_H
    > +
    > +#include <linux/filter.h>
    > +#include "probe-event.h"
    > +
    > +#define BPF_PROLOGUE_MAX_ARGS 3
    > +#define BPF_PROLOGUE_START_ARG_REG BPF_REG_3
    > +#define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2
    > +
    > +int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
    > + struct bpf_insn *new_prog, size_t *new_cnt,
    > + size_t cnt_space);
    > +

    Here is a problem: if CONFIG_BPF_PROLOGUE is not set, a missing symbol
    problem will be triggered.

    I have updated this part in my patchset:

    +/*
    + * Copyright (C) 2015, He Kuang <hekuang@huawei.com>
    + * Copyright (C) 2015, Huawei Inc.
    + */
    +#ifndef __BPF_PROLOGUE_H
    +#define __BPF_PROLOGUE_H
    +
    +#include <linux/compiler.h>
    +#include <linux/filter.h>
    +#include "probe-event.h"
    +
    +#define BPF_PROLOGUE_MAX_ARGS 3
    +#define BPF_PROLOGUE_START_ARG_REG BPF_REG_3
    +#define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2
    +
    +#ifdef HAVE_BPF_PROLOGUE
    +int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
    + struct bpf_insn *new_prog, size_t *new_cnt,
    + size_t cnt_space);
    +#else
    +static inline int
    +bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
    + int nargs __maybe_unused,
    + struct bpf_insn *new_prog __maybe_unused,
    + size_t *new_cnt,
    + size_t cnt_space __maybe_unused)
    +{
    + if (!new_cnt)
    + return -EINVAL;
    + *new_cnt = 0;
    + return 0;
    +}
    +#endif
    +#endif /* __BPF_PROLOGUE_H */

    > +#endif /* __BPF_PROLOGUE_H */




    \
     
     \ /
      Last update: 2015-06-26 06:41    [W:4.115 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site