lkml.org 
[lkml]   [2016]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v2 25/26] perf bpf: Implement run_ubpf_program
Date
Fill up the run_ubpf_program slot by fetching the ubpf entry and call
__bpf_prog_run().

Signed-off-by: He Kuang <hekuang@huawei.com>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
tools/perf/util/ubpf-hooks.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/ubpf-hooks.c b/tools/perf/util/ubpf-hooks.c
index 6ffe344..da19fab 100644
--- a/tools/perf/util/ubpf-hooks.c
+++ b/tools/perf/util/ubpf-hooks.c
@@ -8,12 +8,25 @@
#include <asm/bug.h>
#include <ubpf.h>
#include "ubpf-hooks.h"
+#include "bpf-vm.h"
#include "debug.h"

-static int run_ubpf_program(struct bpf_program *prog __maybe_unused,
- void *mem __maybe_unused, size_t len __maybe_unused)
+static int
+run_ubpf_program(struct bpf_program *prog, void *mem, size_t len)
{
- return 0;
+ struct ubpf_entry *entry;
+ int ret;
+
+ entry = bpf_program__vm(prog);
+ if (!entry) {
+ WARN_ONCE(!entry, "Unable to fetch entry from UBPF program\n");
+ return -EINVAL;
+ }
+
+ ret = __bpf_prog_run(mem, entry->insns, len);
+ pr_debug("program %s returns %d\n",
+ bpf_program__title(prog, false), ret);
+ return ret;
}

static int
--
1.8.5.2
\
 
 \ /
  Last update: 2016-06-26 14:01    [W:0.205 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site