* [PATCH] mips: bpf: Fix broken BPF_MOD
@ 2014-12-01 9:57 Denis Kirjanov
2014-12-01 10:13 ` Markos Chandras
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Denis Kirjanov @ 2014-12-01 9:57 UTC (permalink / raw)
To: netdev; +Cc: markos.chandras, Denis Kirjanov
Remove optimize_div() from BPF_MOD | BPF_K case
since we don't know the dividend and fix the
emit_mod() by reading the mod operation result from HI register
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/mips/net/bpf_jit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 9b55143..9fd6834 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned int src,
u32 *p = &ctx->target[ctx->idx];
uasm_i_divu(&p, dst, src);
p = &ctx->target[ctx->idx + 1];
- uasm_i_mflo(&p, dst);
+ uasm_i_mfhi(&p, dst);
}
ctx->idx += 2; /* 2 insts */
}
@@ -971,7 +971,7 @@ load_ind:
break;
case BPF_ALU | BPF_MOD | BPF_K:
/* A %= k */
- if (k == 1 || optimize_div(&k)) {
+ if (k == 1) {
ctx->flags |= SEEN_A;
emit_jit_reg_move(r_A, r_zero, ctx);
} else {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
2014-12-01 9:57 [PATCH] mips: bpf: Fix broken BPF_MOD Denis Kirjanov
@ 2014-12-01 10:13 ` Markos Chandras
2014-12-01 10:37 ` Denis Kirjanov
2014-12-01 13:50 ` Sergei Shtylyov
2014-12-09 1:23 ` David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Markos Chandras @ 2014-12-01 10:13 UTC (permalink / raw)
To: Denis Kirjanov, netdev
On 12/01/2014 09:57 AM, Denis Kirjanov wrote:
> Remove optimize_div() from BPF_MOD | BPF_K case
> since we don't know the dividend and fix the
> emit_mod() by reading the mod operation result from HI register
>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
> arch/mips/net/bpf_jit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> index 9b55143..9fd6834 100644
> --- a/arch/mips/net/bpf_jit.c
> +++ b/arch/mips/net/bpf_jit.c
> @@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned int src,
> u32 *p = &ctx->target[ctx->idx];
> uasm_i_divu(&p, dst, src);
> p = &ctx->target[ctx->idx + 1];
> - uasm_i_mflo(&p, dst);
> + uasm_i_mfhi(&p, dst);
That looks correct.
> }
> ctx->idx += 2; /* 2 insts */
> }
> @@ -971,7 +971,7 @@ load_ind:
> break;
> case BPF_ALU | BPF_MOD | BPF_K:
> /* A %= k */
> - if (k == 1 || optimize_div(&k)) {
> + if (k == 1) {
> ctx->flags |= SEEN_A;
> emit_jit_reg_move(r_A, r_zero, ctx);
> } else {
>
That looks correct too. Thanks for fixing these.
Can you also CC stable for inclusion in >=3.16?
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
--
markos
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
2014-12-01 10:13 ` Markos Chandras
@ 2014-12-01 10:37 ` Denis Kirjanov
0 siblings, 0 replies; 6+ messages in thread
From: Denis Kirjanov @ 2014-12-01 10:37 UTC (permalink / raw)
To: Network Development; +Cc: stable, Markos Chandras
On 12/1/14, Markos Chandras <Markos.Chandras@imgtec.com> wrote:
> On 12/01/2014 09:57 AM, Denis Kirjanov wrote:
>> Remove optimize_div() from BPF_MOD | BPF_K case
>> since we don't know the dividend and fix the
>> emit_mod() by reading the mod operation result from HI register
>>
>> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
>> ---
>> arch/mips/net/bpf_jit.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
>> index 9b55143..9fd6834 100644
>> --- a/arch/mips/net/bpf_jit.c
>> +++ b/arch/mips/net/bpf_jit.c
>> @@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned
>> int src,
>> u32 *p = &ctx->target[ctx->idx];
>> uasm_i_divu(&p, dst, src);
>> p = &ctx->target[ctx->idx + 1];
>> - uasm_i_mflo(&p, dst);
>> + uasm_i_mfhi(&p, dst);
>
> That looks correct.
>
>> }
>> ctx->idx += 2; /* 2 insts */
>> }
>> @@ -971,7 +971,7 @@ load_ind:
>> break;
>> case BPF_ALU | BPF_MOD | BPF_K:
>> /* A %= k */
>> - if (k == 1 || optimize_div(&k)) {
>> + if (k == 1) {
>> ctx->flags |= SEEN_A;
>> emit_jit_reg_move(r_A, r_zero, ctx);
>> } else {
>>
>
> That looks correct too. Thanks for fixing these.
>
> Can you also CC stable for inclusion in >=3.16?
>
> Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: stable@vger.kernel.org
> --
> markos
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
2014-12-01 9:57 [PATCH] mips: bpf: Fix broken BPF_MOD Denis Kirjanov
2014-12-01 10:13 ` Markos Chandras
@ 2014-12-01 13:50 ` Sergei Shtylyov
2014-12-01 13:55 ` Denis Kirjanov
2014-12-09 1:23 ` David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2014-12-01 13:50 UTC (permalink / raw)
To: Denis Kirjanov, netdev; +Cc: markos.chandras
Hello.
On 12/1/2014 12:57 PM, Denis Kirjanov wrote:
You should CC the 'linux-mips' ML.
> Remove optimize_div() from BPF_MOD | BPF_K case
> since we don't know the dividend and fix the
> emit_mod() by reading the mod operation result from HI register
Isn't this 2 unrelated fixes? They should be in 2 patches, not a single
one in that case.
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
> arch/mips/net/bpf_jit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
2014-12-01 13:50 ` Sergei Shtylyov
@ 2014-12-01 13:55 ` Denis Kirjanov
0 siblings, 0 replies; 6+ messages in thread
From: Denis Kirjanov @ 2014-12-01 13:55 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: netdev, markos.chandras
On 12/1/14, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 12/1/2014 12:57 PM, Denis Kirjanov wrote:
>
> You should CC the 'linux-mips' ML.
>
>> Remove optimize_div() from BPF_MOD | BPF_K case
>> since we don't know the dividend and fix the
>> emit_mod() by reading the mod operation result from HI register
>
> Isn't this 2 unrelated fixes? They should be in 2 patches, not a single
>
> one in that case.
>
They do fix the BPD_MOD _single_ case. I don't think that it's a good
reason here to split the fin in 2 patches
>> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
>> ---
>> arch/mips/net/bpf_jit.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> WBR, Sergei
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mips: bpf: Fix broken BPF_MOD
2014-12-01 9:57 [PATCH] mips: bpf: Fix broken BPF_MOD Denis Kirjanov
2014-12-01 10:13 ` Markos Chandras
2014-12-01 13:50 ` Sergei Shtylyov
@ 2014-12-09 1:23 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-12-09 1:23 UTC (permalink / raw)
To: kda; +Cc: netdev, markos.chandras
From: Denis Kirjanov <kda@linux-powerpc.org>
Date: Mon, 1 Dec 2014 12:57:02 +0300
> Remove optimize_div() from BPF_MOD | BPF_K case
> since we don't know the dividend and fix the
> emit_mod() by reading the mod operation result from HI register
>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Applied and queue up for -stable, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-09 1:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 9:57 [PATCH] mips: bpf: Fix broken BPF_MOD Denis Kirjanov
2014-12-01 10:13 ` Markos Chandras
2014-12-01 10:37 ` Denis Kirjanov
2014-12-01 13:50 ` Sergei Shtylyov
2014-12-01 13:55 ` Denis Kirjanov
2014-12-09 1:23 ` David Miller
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).