[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMEtUuxhmxMcK88Mqw5ZGohhHtR=AtMDnpZOUpuZX_-ygWk1CQ@mail.gmail.com>
Date: Tue, 3 Dec 2013 17:21:37 -0800
From: Alexei Starovoitov <ast@...mgrid.com>
To: Jonathan Corbet <corbet@....net>
Cc: Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Jovi Zhangwei <jovi.zhangwei@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH tip 5/5] tracing filter examples in BPF
On Tue, Dec 3, 2013 at 4:35 PM, Jonathan Corbet <corbet@....net> wrote:
> On Mon, 2 Dec 2013 20:28:50 -0800
> Alexei Starovoitov <ast@...mgrid.com> wrote:
>
>> GCC-BPF backend is available on github
>> (since gcc plugin infrastructure doesn't allow for out-of-tree backends)
>
> Do you have a pointer to where this backend can be found? I've
> done a bit of digging around but seem to be unable to find it…
here it is:
https://github.com/iovisor/bpf_gcc/commit/9e7223f8f09c822ecc6e18309e89a574a23dbf63
It's quite small comparing to normal backend:
config.me | 3 +
config.sub | 12 +-
gcc/common/config/bpf/bpf-common.c | 39 ++
gcc/config.gcc | 18 +
gcc/config/bpf/bpf-modes.def | 22 +
gcc/config/bpf/bpf-protos.h | 60 ++
gcc/config/bpf/bpf.c | 1063 ++++++++++++++++++++++++++++++++++++
gcc/config/bpf/bpf.h | 746 +++++++++++++++++++++++++
gcc/config/bpf/bpf.md | 895 ++++++++++++++++++++++++++++++
gcc/config/bpf/linux.h | 67 +++
10 files changed, 2922 insertions(+), 3 deletions(-)
Instruction emission is in bpf.md in functions like:
(define_insn "adddi3"
[(set (match_operand:DI 0 "int_reg_operand" "=r, r")
(plus:DI (match_operand:DI 1 "int_reg_operand" "0, 0")
(match_operand:DI 2 "int_reg_or_const_operand" "r, K")))]
""
"@
BPF_INSN_ALU(BPF_ADD, %0, %2), // %0 += %2
BPF_INSN_ALU_IMM(BPF_ADD, %0, %2), // %0 += %2"
[(set_attr "type" "arith,arith") ])
So it takes C and emits BPF_* macros from include/linux/bpf.h
tools/bpf/trace/ examples were generated by it.
Eventually it will be changed to emit binary hex directly, but macros
are much easier to understand for now.
Thanks
Alexei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists