netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: filter: fix typo in sparc BPF JIT
@ 2014-06-06  5:47 Alexei Starovoitov
  2014-06-06  7:47 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2014-06-06  5:47 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

fix typo in sparc codegen for SKF_AD_IFINDEX and SKF_AD_HATYPE
classic BPF extensions

Fixes: 2809a2087cc4 ("net: filter: Just In Time compiler for sparc")
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
tested with qemu-sparc64
the patch doesn't apply cleanly to net-next, but logic is the same.

 arch/sparc/net/bpf_jit_comp.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index a82c6b2..b19a0c2 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -83,9 +83,9 @@ static void bpf_flush_icache(void *start_, void *end_)
 #define BNE		(F2(0, 2) | CONDNE)
 
 #ifdef CONFIG_SPARC64
-#define BNE_PTR		(F2(0, 1) | CONDNE | (2 << 20))
+#define BE_PTR		(F2(0, 1) | CONDE | (2 << 20))
 #else
-#define BNE_PTR		BNE
+#define BE_PTR		BNE
 #endif
 
 #define SETHI(K, REG)	\
@@ -600,7 +600,7 @@ void bpf_jit_compile(struct sk_filter *fp)
 			case BPF_S_ANC_IFINDEX:
 				emit_skb_loadptr(dev, r_A);
 				emit_cmpi(r_A, 0);
-				emit_branch(BNE_PTR, cleanup_addr + 4);
+				emit_branch(BE_PTR, cleanup_addr + 4);
 				emit_nop();
 				emit_load32(r_A, struct net_device, ifindex, r_A);
 				break;
@@ -613,7 +613,7 @@ void bpf_jit_compile(struct sk_filter *fp)
 			case BPF_S_ANC_HATYPE:
 				emit_skb_loadptr(dev, r_A);
 				emit_cmpi(r_A, 0);
-				emit_branch(BNE_PTR, cleanup_addr + 4);
+				emit_branch(BE_PTR, cleanup_addr + 4);
 				emit_nop();
 				emit_load16(r_A, struct net_device, type, r_A);
 				break;
-- 
1.7.9.5

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

* Re: [PATCH net] net: filter: fix typo in sparc BPF JIT
  2014-06-06  5:47 [PATCH net] net: filter: fix typo in sparc BPF JIT Alexei Starovoitov
@ 2014-06-06  7:47 ` David Miller
  2014-06-06  8:36 ` David Laight
  2014-06-06 14:11 ` Sergei Shtylyov
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-06-06  7:47 UTC (permalink / raw)
  To: ast; +Cc: netdev

From: Alexei Starovoitov <ast@plumgrid.com>
Date: Thu,  5 Jun 2014 22:47:44 -0700

> fix typo in sparc codegen for SKF_AD_IFINDEX and SKF_AD_HATYPE
> classic BPF extensions
> 
> Fixes: 2809a2087cc4 ("net: filter: Just In Time compiler for sparc")
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
> ---
> tested with qemu-sparc64
> the patch doesn't apply cleanly to net-next, but logic is the same.

Applied to net and queued up for -stable, thanks Alexey.

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

* RE: [PATCH net] net: filter: fix typo in sparc BPF JIT
  2014-06-06  5:47 [PATCH net] net: filter: fix typo in sparc BPF JIT Alexei Starovoitov
  2014-06-06  7:47 ` David Miller
@ 2014-06-06  8:36 ` David Laight
  2014-06-06 15:27   ` Alexei Starovoitov
  2014-06-06 14:11 ` Sergei Shtylyov
  2 siblings, 1 reply; 5+ messages in thread
From: David Laight @ 2014-06-06  8:36 UTC (permalink / raw)
  To: 'Alexei Starovoitov', David S. Miller; +Cc: netdev@vger.kernel.org

From: Alexei Starovoitov
> fix typo in sparc codegen for SKF_AD_IFINDEX and SKF_AD_HATYPE
> classic BPF extensions
...
> --- a/arch/sparc/net/bpf_jit_comp.c
> +++ b/arch/sparc/net/bpf_jit_comp.c
> @@ -83,9 +83,9 @@ static void bpf_flush_icache(void *start_, void *end_)
>  #define BNE		(F2(0, 2) | CONDNE)
> 
>  #ifdef CONFIG_SPARC64
> -#define BNE_PTR		(F2(0, 1) | CONDNE | (2 << 20))
> +#define BE_PTR		(F2(0, 1) | CONDE | (2 << 20))
>  #else
> -#define BNE_PTR		BNE
> +#define BE_PTR		BNE
>  #endif

That doesn't look right.
AFAICT you've had to invert the branch in the code (below) so need
the alternate define - I presume this is the only place they are used.
But the second is only partially inverted.

I presume you only tested sparc64?

	David
 
>  #define SETHI(K, REG)	\
> @@ -600,7 +600,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>  			case BPF_S_ANC_IFINDEX:
>  				emit_skb_loadptr(dev, r_A);
>  				emit_cmpi(r_A, 0);
> -				emit_branch(BNE_PTR, cleanup_addr + 4);
> +				emit_branch(BE_PTR, cleanup_addr + 4);
>  				emit_nop();
>  				emit_load32(r_A, struct net_device, ifindex, r_A);
>  				break;
> @@ -613,7 +613,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>  			case BPF_S_ANC_HATYPE:
>  				emit_skb_loadptr(dev, r_A);
>  				emit_cmpi(r_A, 0);
> -				emit_branch(BNE_PTR, cleanup_addr + 4);
> +				emit_branch(BE_PTR, cleanup_addr + 4);
>  				emit_nop();
>  				emit_load16(r_A, struct net_device, type, r_A);
>  				break;
> --
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH net] net: filter: fix typo in sparc BPF JIT
  2014-06-06  5:47 [PATCH net] net: filter: fix typo in sparc BPF JIT Alexei Starovoitov
  2014-06-06  7:47 ` David Miller
  2014-06-06  8:36 ` David Laight
@ 2014-06-06 14:11 ` Sergei Shtylyov
  2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2014-06-06 14:11 UTC (permalink / raw)
  To: Alexei Starovoitov, David S. Miller; +Cc: netdev

Hello.

On 06/06/2014 09:47 AM, Alexei Starovoitov wrote:

> fix typo in sparc codegen for SKF_AD_IFINDEX and SKF_AD_HATYPE
> classic BPF extensions

> Fixes: 2809a2087cc4 ("net: filter: Just In Time compiler for sparc")
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
> ---
> tested with qemu-sparc64
> the patch doesn't apply cleanly to net-next, but logic is the same.

>   arch/sparc/net/bpf_jit_comp.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

> diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
> index a82c6b2..b19a0c2 100644
> --- a/arch/sparc/net/bpf_jit_comp.c
> +++ b/arch/sparc/net/bpf_jit_comp.c
> @@ -83,9 +83,9 @@ static void bpf_flush_icache(void *start_, void *end_)
>   #define BNE		(F2(0, 2) | CONDNE)
>
>   #ifdef CONFIG_SPARC64
> -#define BNE_PTR		(F2(0, 1) | CONDNE | (2 << 20))
> +#define BE_PTR		(F2(0, 1) | CONDE | (2 << 20))
>   #else
> -#define BNE_PTR		BNE
> +#define BE_PTR		BNE

    BNE, not BE?

WBR, Sergei

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

* Re: [PATCH net] net: filter: fix typo in sparc BPF JIT
  2014-06-06  8:36 ` David Laight
@ 2014-06-06 15:27   ` Alexei Starovoitov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2014-06-06 15:27 UTC (permalink / raw)
  To: David Laight; +Cc: David S. Miller, netdev@vger.kernel.org

On Fri, Jun 6, 2014 at 1:36 AM, David Laight <David.Laight@aculab.com> wrote:
> From: Alexei Starovoitov
>> fix typo in sparc codegen for SKF_AD_IFINDEX and SKF_AD_HATYPE
>> classic BPF extensions
> ...
>> --- a/arch/sparc/net/bpf_jit_comp.c
>> +++ b/arch/sparc/net/bpf_jit_comp.c
>> @@ -83,9 +83,9 @@ static void bpf_flush_icache(void *start_, void *end_)
>>  #define BNE          (F2(0, 2) | CONDNE)
>>
>>  #ifdef CONFIG_SPARC64
>> -#define BNE_PTR              (F2(0, 1) | CONDNE | (2 << 20))
>> +#define BE_PTR               (F2(0, 1) | CONDE | (2 << 20))
>>  #else
>> -#define BNE_PTR              BNE
>> +#define BE_PTR               BNE
>>  #endif
>
> That doesn't look right.
> AFAICT you've had to invert the branch in the code (below) so need
> the alternate define - I presume this is the only place they are used.
> But the second is only partially inverted.

Ohh. yes. sorry. It's a copy paste error from net-next into net :((
I fixed it carefully in net-next first, then tried to git am, had to
do it manually, built/ran sparc64 only.

> I presume you only tested sparc64?

yes. I don't have it setup yet.

>         David
>
>>  #define SETHI(K, REG)        \
>> @@ -600,7 +600,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>>                       case BPF_S_ANC_IFINDEX:
>>                               emit_skb_loadptr(dev, r_A);
>>                               emit_cmpi(r_A, 0);
>> -                             emit_branch(BNE_PTR, cleanup_addr + 4);
>> +                             emit_branch(BE_PTR, cleanup_addr + 4);
>>                               emit_nop();
>>                               emit_load32(r_A, struct net_device, ifindex, r_A);
>>                               break;
>> @@ -613,7 +613,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>>                       case BPF_S_ANC_HATYPE:
>>                               emit_skb_loadptr(dev, r_A);
>>                               emit_cmpi(r_A, 0);
>> -                             emit_branch(BNE_PTR, cleanup_addr + 4);
>> +                             emit_branch(BE_PTR, cleanup_addr + 4);
>>                               emit_nop();
>>                               emit_load16(r_A, struct net_device, type, r_A);
>>                               break;
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

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

end of thread, other threads:[~2014-06-06 15:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06  5:47 [PATCH net] net: filter: fix typo in sparc BPF JIT Alexei Starovoitov
2014-06-06  7:47 ` David Miller
2014-06-06  8:36 ` David Laight
2014-06-06 15:27   ` Alexei Starovoitov
2014-06-06 14:11 ` Sergei Shtylyov

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).