Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1172587

Re: [RFC PATCH v8 46/49] perf tools: Add prologue for BPF programs for fetching arguments

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From "Wangnan (F)" <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH v8 46/49] perf tools: Add prologue for BPF programs for fetching arguments
Date Fri, 26 Jun 2015 06:30:02 +0200
Message-ID <pFtr4-4R0-3@gated-at.bofh.it> (permalink)
References <pES8a-1w5-3@gated-at.bofh.it> <pES8a-1w5-9@gated-at.bofh.it>
X-Original-To <acme@kernel.org>, <ast@plumgrid.com>, <brendan.d.gregg@gmail.com>, <daniel@iogearbox.net>, <namhyung@kernel.org>, <masami.hiramatsu.pt@hitachi.com>, <paulus@samba.org>, <a.p.zijlstra@chello.nl>, <mingo@redhat.com>, <jolsa@kernel.org>, <dsahern@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding 7bit
X-Originating-IP [10.111.66.109]
X-Cfilter-Loop Reflected
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc <linux-kernel@vger.kernel.org>, <lizefan@huawei.com>, <hekuang@huawei.com>, <xiakaixu@huawei.com>, <pi3orama@163.com>
X-Original-Date Fri, 26 Jun 2015 12:23:43 +0800
X-Original-Message-ID <558CD3CF.9000706@huawei.com>
X-Original-References <1435149113-51142-1-git-send-email-wangnan0@huawei.com> <1435149113-51142-47-git-send-email-wangnan0@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1172587

Show key headers only | View raw



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 */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [RFC PATCH v8 46/49] perf tools: Add prologue for BPF programs  for fetching arguments "Wangnan (F)" <wangnan0@huawei.com> - 2015-06-26 06:30 +0200

csiph-web