[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55A46928.9090708@plumgrid.com>
Date: Mon, 13 Jul 2015 18:43:04 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: pi3orama <pi3orama@....com>, Namhyung Kim <namhyung@...nel.org>
CC: He Kuang <hekuang@...wei.com>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"masami.hiramatsu.pt@...achi.com" <masami.hiramatsu.pt@...achi.com>,
"acme@...nel.org" <acme@...nel.org>,
"a.p.zijlstra@...llo.nl" <a.p.zijlstra@...llo.nl>,
"mingo@...hat.com" <mingo@...hat.com>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"wangnan0@...wei.com" <wangnan0@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data
to perf event
On 7/13/15 7:29 AM, pi3orama wrote:
>>>> I was thinking about providing custom event formats for each bpf
>>>> >>>program (if needed). The event format definitions might be in a
>>>> >>>specific directory or a bpf object itself. Then perf can read those
>>>> >>>formats and print the output data according to the formats. Maybe we
>>>> >>>need to add some dynamic event id to match format and data.
>>> >>
>>> >>I think we can do it in perf side. Let BPF programs themselves
>>> >>encode format information into the array and make perf read and
>>> >>decode them. In kernel side simply support raw data should be
>>> >>enough, so we can make kernel code as simple as possible.
>> >
>> >Yes, of course, I also meant that doing those work all in perf side. :)
sounds like a great idea. +1
> I have an idea on it:
>
> struct x{
> int a;
> int b;
> };
> struct x __x;
>
> SEC(...)
> int func(void *ctx)
> {
> struct x myx;
> ...
> myx.a = 1;
> myx.b = 2;
> OUTPUT(&myx, &__x);
> ...
> }
>
> In the above program, the '&' operator will emit a relocation,
relocation once emitted will be painful to remove from compiled code.
Why not to use dwarf info from the struct passed into
bpf_output_trace_data()? No extra macros would be needed from users.
I'm not sure llvm generates proper dwarf along with bpf code (I didn't
test that part. If there are any issues they should be fixable. If you
can prepapre a patch for llvm that would be even better :)
--
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