Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1368504

Re: [PATCH 4/4] samples/bpf: Enable powerpc support

From Alexei Starovoitov <ast@fb.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] samples/bpf: Enable powerpc support
Date 2016-03-31 20:00 +0200
Message-ID <riP2W-ac-3@gated-at.bofh.it> (permalink)
References <riIXw-4as-11@gated-at.bofh.it> <riIXx-4as-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 3/31/16 4:25 AM, Naveen N. Rao wrote:
> Add the necessary definitions for building bpf samples on ppc.
>
> Since ppc doesn't store function return address on the stack, modify how
> PT_REGS_RET() and PT_REGS_FP() work.
>
> Also, introduce PT_REGS_IP() to access the instruction pointer. I have
> fixed this to work with x86_64 and arm64, but not s390.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
...
> +
> +#ifdef __powerpc__
> +#define BPF_KPROBE_READ_RET_IP(ip, ctx)		{ (ip) = (ctx)->link; }
> +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx)	BPF_KPROBE_READ_RET_IP(ip, ctx)
> +#else
> +#define BPF_KPROBE_READ_RET_IP(ip, ctx)						\
> +		bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx))
> +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx)					\
> +		bpf_probe_read(&(ip), sizeof(ip),				\
> +				(void *)(PT_REGS_FP(ctx) + sizeof(ip)))

makes sense, but please use ({ }) gcc extension instead of {} and
open call to make sure that macro body is scoped.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] samples/bpf: Enable powerpc support "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-03-31 13:30 +0200
  Re: [PATCH 4/4] samples/bpf: Enable powerpc support Alexei Starovoitov <ast@fb.com> - 2016-03-31 20:00 +0200
    Re: [PATCH 4/4] samples/bpf: Enable powerpc support "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 16:50 +0200
      Re: [PATCH 4/4] samples/bpf: Enable powerpc support Alexei Starovoitov <ast@fb.com> - 2016-04-01 20:00 +0200

csiph-web