lkml.org 
[lkml]   [2015]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 05/31] perf record: Load eBPF object into kernel
    Em Wed, Oct 14, 2015 at 12:41:16PM +0000, Wang Nan escreveu:
    > This patch utilizes bpf_object__load() provided by libbpf to load all
    > objects into kernel.

    So, testing this, using that other proggie, I get;

    # perf record --event /tmp/foo.o sleep 1
    libbpf: load bpf program failed: Invalid argument
    libbpf: -- BEGIN DUMP LOG ---
    libbpf:

    libbpf: -- END LOG --
    libbpf: failed to load program 'fork=_do_fork'
    libbpf: failed to load object '/tmp/foo.o'
    event syntax error: '/tmp/foo.o'
    \___ Invalid argument: Are you root and runing a CONFIG_BPF_SYSCALL kernel?

    (add -v to see detail)
    Run 'perf list' for a list of valid events

    Usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event> event selector. use 'perf list' to list available events

    But:

    [root@felicio ~]# grep -i bpf /proc/kallsyms | wc -l
    117
    [root@felicio ~]# grep -i sys_bpf /proc/kallsyms
    ffffffff811829d0 T SyS_bpf
    ffffffff811829d0 T sys_bpf
    [root@felicio ~]# uname -a
    Linux felicio.ghostprotocols.net 4.2.0 #1 SMP Mon Aug 31 12:25:38 BRT
    2015 x86_64 x86_64 x86_64 GNU/Linux
    [root@felicio ~]#


    I'll try updating it to torvalds/master...

    For reference, that foo.o eBPF proggie was built with:

    [acme@felicio linux]$ cat ~/bin/hello-ebpf
    # Taken from 'perf test LLVM'
    # Thu Oct 22 12:07:26 BRT 2015

    export KERNEL_INC_OPTIONS="-nostdinc -isystem
    /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include
    -I/home/acme/git/linux/arch/x86/include
    -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated
    -I/home/acme/git/linux/include -Iinclude
    -I/home/acme/git/linux/arch/x86/include/uapi
    -Iarch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi
    -Iinclude/generated/uapi -include
    /home/acme/git/linux/include/linux/kconfig.h"
    export WORKING_DIR=/lib/modules/4.2.0/build
    export CLANG_SOURCE=-
    export CLANG_OPTIONS=-xc

    OBJ=/tmp/foo.o
    rm -f $OBJ
    echo '__attribute__((section("fork=_do_fork"), used)) int fork(void
    *ctx) {return 0;} char _license[] __attribute__((section("license"),
    used)) = "GPL";int _version __attribute__((section("version"), used)) =
    0x40100;' | clang -D__KERNEL__ $CLANG_OPTIONS $KERNEL_INC_OPTIONS
    -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c
    "$CLANG_SOURCE" -target bpf -O2 -o /tmp/foo.o && file $OBJ

    - Arnaldo


    \
     
     \ /
      Last update: 2015-10-23 19:21    [W:2.357 / U:0.712 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site