linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs
@ 2012-06-22  3:50 Michael Ellerman
  2012-06-22  8:58 ` matt
  2012-06-22  9:01 ` matt
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2012-06-22  3:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: matt, amodra

If the kernel is big enough (eg. allyesconfig), the linker may need to
switch TOCs when calling from the BPF JIT code out to the external
helpers (skb_copy_bits() & bpf_internal_load_pointer_neg_helper()).

In order to do that we need to leave space after the bl for the linker
to insert a reload of our TOC pointer.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/net/bpf_jit_64.S |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index 55ba385..7d3a3b5 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset:
 	mr	r4, r_addr;					\
 	li	r6, SIZE;					\
 	bl	skb_copy_bits;					\
+	nop;							\
 	/* R3 = 0 on success */					\
 	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
 	ld	r0, 16(r1);					\
@@ -156,6 +157,7 @@ bpf_slow_path_byte_msh:
 	mr	r4, r_addr;					\
 	li	r5, SIZE;					\
 	bl	bpf_internal_load_pointer_neg_helper;		\
+	nop;							\
 	/* R3 != 0 on success */				\
 	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
 	ld	r0, 16(r1);					\
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs
  2012-06-22  3:50 [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs Michael Ellerman
@ 2012-06-22  8:58 ` matt
  2012-06-22  9:01 ` matt
  1 sibling, 0 replies; 3+ messages in thread
From: matt @ 2012-06-22  8:58 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, matt, amodra

On 2012-06-22 04:50, Michael Ellerman wrote:
> If the kernel is big enough (eg. allyesconfig), the linker may need 
> to
> switch TOCs when calling from the BPF JIT code out to the external
> helpers (skb_copy_bits() & bpf_internal_load_pointer_neg_helper()).
>
> In order to do that we need to leave space after the bl for the 
> linker
> to insert a reload of our TOC pointer.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Oops..!

Acked-by: Matt Evans <matt@ozlabs.org>


> ---
>  arch/powerpc/net/bpf_jit_64.S |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/net/bpf_jit_64.S 
> b/arch/powerpc/net/bpf_jit_64.S
> index 55ba385..7d3a3b5 100644
> --- a/arch/powerpc/net/bpf_jit_64.S
> +++ b/arch/powerpc/net/bpf_jit_64.S
> @@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset:
>  	mr	r4, r_addr;					\
>  	li	r6, SIZE;					\
>  	bl	skb_copy_bits;					\
> +	nop;							\
>  	/* R3 = 0 on success */					\
>  	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
>  	ld	r0, 16(r1);					\
> @@ -156,6 +157,7 @@ bpf_slow_path_byte_msh:
>  	mr	r4, r_addr;					\
>  	li	r5, SIZE;					\
>  	bl	bpf_internal_load_pointer_neg_helper;		\
> +	nop;							\
>  	/* R3 != 0 on success */				\
>  	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
>  	ld	r0, 16(r1);					\

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs
  2012-06-22  3:50 [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs Michael Ellerman
  2012-06-22  8:58 ` matt
@ 2012-06-22  9:01 ` matt
  1 sibling, 0 replies; 3+ messages in thread
From: matt @ 2012-06-22  9:01 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, amodra

Whee!  Let's try that again with MUA configured better...

On 2012-06-22 04:50, Michael Ellerman wrote:
> If the kernel is big enough (eg. allyesconfig), the linker may need 
> to
> switch TOCs when calling from the BPF JIT code out to the external
> helpers (skb_copy_bits() & bpf_internal_load_pointer_neg_helper()).
>
> In order to do that we need to leave space after the bl for the 
> linker
> to insert a reload of our TOC pointer.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Oops, x2, and

Acked-by: Matt Evans <matt@ozlabs.org>

:-)


> ---
>  arch/powerpc/net/bpf_jit_64.S |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/net/bpf_jit_64.S 
> b/arch/powerpc/net/bpf_jit_64.S
> index 55ba385..7d3a3b5 100644
> --- a/arch/powerpc/net/bpf_jit_64.S
> +++ b/arch/powerpc/net/bpf_jit_64.S
> @@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset:
>  	mr	r4, r_addr;					\
>  	li	r6, SIZE;					\
>  	bl	skb_copy_bits;					\
> +	nop;							\
>  	/* R3 = 0 on success */					\
>  	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
>  	ld	r0, 16(r1);					\
> @@ -156,6 +157,7 @@ bpf_slow_path_byte_msh:
>  	mr	r4, r_addr;					\
>  	li	r5, SIZE;					\
>  	bl	bpf_internal_load_pointer_neg_helper;		\
> +	nop;							\
>  	/* R3 != 0 on success */				\
>  	addi	r1, r1, BPF_PPC_SLOWPATH_FRAME;			\
>  	ld	r0, 16(r1);					\

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-22  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22  3:50 [PATCH] powerpc: Fix BPF_JIT code to link with multiple TOCs Michael Ellerman
2012-06-22  8:58 ` matt
2012-06-22  9:01 ` matt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).