From: Markos Chandras <Markos.Chandras@imgtec•com>
To: Denis Kirjanov <kda@linux-powerpc•org>, <netdev@vger•kernel.org>
Subject: Re: [PATCH] mips: bpf: Fix broken BPF_MOD
Date: Mon, 1 Dec 2014 10:13:03 +0000 [thread overview]
Message-ID: <547C3F2F.3070708@imgtec.com> (raw)
In-Reply-To: <1417427822-12729-1-git-send-email-kda@linux-powerpc.org>
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
next prev parent reply other threads:[~2014-12-01 10:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 9:57 [PATCH] mips: bpf: Fix broken BPF_MOD Denis Kirjanov
2014-12-01 10:13 ` Markos Chandras [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=547C3F2F.3070708@imgtec.com \
--to=markos.chandras@imgtec$(echo .)com \
--cc=kda@linux-powerpc$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox