[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171002194408.3o4xoefmlkqvhzoq@ast-mbp.dhcp.thefacebook.com>
Date: Mon, 2 Oct 2017 12:44:10 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: netdev@...r.kernel.org, jakub.kicinski@...ronome.com,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, mchan@...adcom.com,
John Fastabend <john.fastabend@...il.com>,
peter.waskiewicz.jr@...el.com,
Daniel Borkmann <borkmann@...earbox.net>,
Andy Gospodarek <andy@...yhouse.net>
Subject: Re: [net-next V2 PATCH 5/5] samples/bpf: add cpumap sample program
xdp_redirect_cpu
On Mon, Oct 02, 2017 at 02:07:23PM +0200, Jesper Dangaard Brouer wrote:
> On Fri, 29 Sep 2017 20:06:09 -0700
> Alexei Starovoitov <alexei.starovoitov@...il.com> wrote:
>
> > > +/*** Trace point code ***/
> > > +
> > > +/* Tracepoint format: /sys/kernel/debug/tracing/events/xdp/xdp_redirect/format
> > > + * Code in: kernel/include/trace/events/xdp.h
> > > + */
> > > +struct xdp_redirect_ctx {
> > > + unsigned short common_type; // offset:0; size:2; signed:0;
> > > + unsigned char common_flags; // offset:2; size:1; signed:0;
> > > + unsigned char common_preempt_count;// offset:3; size:1; signed:0;
> > > + int common_pid; // offset:4; size:4; signed:1;
> >
> > this part is not right. First 8 bytes are not accessible by bpf code.
> > Please use __u64 pad; or similar here.
>
> I've corrected this in V3.
>
> Can you explain why BPF cannot access these (first 8 bytes) struct members?
in the very first patch adding bpf to tracepoint we allowed the access,
but then people complained that common_* stuff is not abi and since it was
slow to populate anyway due to local_save_flags (which is never used by
scripts we had so far) and for pid there was a helper already, I was happy
to get rid of it and save these 8 bytes for future use. which ended up
being used by hidden(inaccessible) pt_regs pointer.
Layout description is in
commit 98b5c2c65c29 ("perf, bpf: allow bpf programs attach to tracepoints")
The work on dynamic bits of tracepoints is still tbd.
Powered by blists - more mailing lists