public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jiong Wang <jiong.wang@netronome•com>
To: Sandipan Das <sandipan@linux•ibm.com>
Cc: Jiong Wang <jiong.wang@netronome•com>,
	ast@kernel•org, daniel@iogearbox•net, netdev@vger•kernel.org,
	oss-drivers@netronome•com,
	"Naveen N . Rao" <naveen.n.rao@linux•ibm.com>
Subject: Re: [PATCH bpf-next v2 13/16] ppc: bpf: implement jitting of JMP32
Date: Thu, 24 Jan 2019 09:53:02 +0000	[thread overview]
Message-ID: <87bm46z8jl.fsf@netronome.com> (raw)
In-Reply-To: <b02b3ee0-21f0-3e9f-7d38-ca8e660fa6cf@linux.ibm.com>


Sandipan Das writes:

> Hi Jiong,
>
> On 21/01/19 6:45 PM, Jiong Wang wrote:
>> This patch implements code-gen for new JMP32 instructions on ppc.
>> 
>> For JMP32 | JSET, instruction encoding for PPC_RLWINM_DOT is added to check
>> the result of ANDing low 32-bit of operands.
>> 
>> Cc: Naveen N. Rao <naveen.n.rao@linux•ibm.com>
>> Cc: Sandipan Das <sandipan@linux•ibm.com>
>> Signed-off-by: Jiong Wang <jiong.wang@netronome•com>
>> ---
>>  arch/powerpc/include/asm/ppc-opcode.h |  1 +
>>  arch/powerpc/net/bpf_jit.h            |  4 ++
>>  arch/powerpc/net/bpf_jit_comp64.c     | 98 ++++++++++++++++++++++++++++++-----
>>  3 files changed, 89 insertions(+), 14 deletions(-)
>> [...]
>
> I ran the verifier selftests on a ppc64 test system and found that the jmp32 tests
> were failing because the instructions were not being decoded by the JIT compiler.
> The codegen logic looks good to me and the tests passed after I fixed the decoding
> logic. Here are the changes that I had to make:

Ah, I missed the outer layer decoding logic.

Thanks for the review, test and fix. Will integrate the following in v3.

Regards,
Jiong

>
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
> index 2e40c2b251ba..15bba765fa79 100644
> --- a/arch/powerpc/net/bpf_jit_comp64.c
> +++ b/arch/powerpc/net/bpf_jit_comp64.c
> @@ -768,36 +768,58 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
>                 case BPF_JMP | BPF_JGT | BPF_X:
>                 case BPF_JMP | BPF_JSGT | BPF_K:
>                 case BPF_JMP | BPF_JSGT | BPF_X:
> +               case BPF_JMP32 | BPF_JGT | BPF_K:
> +               case BPF_JMP32 | BPF_JGT | BPF_X:
> +               case BPF_JMP32 | BPF_JSGT | BPF_K:
> +               case BPF_JMP32 | BPF_JSGT | BPF_X:
>                         true_cond = COND_GT;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JLT | BPF_K:
>                 case BPF_JMP | BPF_JLT | BPF_X:
>                 case BPF_JMP | BPF_JSLT | BPF_K:
>                 case BPF_JMP | BPF_JSLT | BPF_X:
> +               case BPF_JMP32 | BPF_JLT | BPF_K:
> +               case BPF_JMP32 | BPF_JLT | BPF_X:
> +               case BPF_JMP32 | BPF_JSLT | BPF_K:
> +               case BPF_JMP32 | BPF_JSLT | BPF_X:
>                         true_cond = COND_LT;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JGE | BPF_K:
>                 case BPF_JMP | BPF_JGE | BPF_X:
>                 case BPF_JMP | BPF_JSGE | BPF_K:
>                 case BPF_JMP | BPF_JSGE | BPF_X:
> +               case BPF_JMP32 | BPF_JGE | BPF_K:
> +               case BPF_JMP32 | BPF_JGE | BPF_X:
> +               case BPF_JMP32 | BPF_JSGE | BPF_K:
> +               case BPF_JMP32 | BPF_JSGE | BPF_X:
>                         true_cond = COND_GE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JLE | BPF_K:
>                 case BPF_JMP | BPF_JLE | BPF_X:
>                 case BPF_JMP | BPF_JSLE | BPF_K:
>                 case BPF_JMP | BPF_JSLE | BPF_X:
> +               case BPF_JMP32 | BPF_JLE | BPF_K:
> +               case BPF_JMP32 | BPF_JLE | BPF_X:
> +               case BPF_JMP32 | BPF_JSLE | BPF_K:
> +               case BPF_JMP32 | BPF_JSLE | BPF_X:
>                         true_cond = COND_LE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JEQ | BPF_K:
>                 case BPF_JMP | BPF_JEQ | BPF_X:
> +               case BPF_JMP32 | BPF_JEQ | BPF_K:
> +               case BPF_JMP32 | BPF_JEQ | BPF_X:
>                         true_cond = COND_EQ;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JNE | BPF_K:
>                 case BPF_JMP | BPF_JNE | BPF_X:
> +               case BPF_JMP32 | BPF_JNE | BPF_K:
> +               case BPF_JMP32 | BPF_JNE | BPF_X:
>                         true_cond = COND_NE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JSET | BPF_K:
>                 case BPF_JMP | BPF_JSET | BPF_X:
> +               case BPF_JMP32 | BPF_JSET | BPF_K:
> +               case BPF_JMP32 | BPF_JSET | BPF_X:
>                         true_cond = COND_NE;
>                         /* Fall through */


  reply	other threads:[~2019-01-24  9:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 13:15 [PATCH bpf-next v2 00/16] bpf: propose new jmp32 instructions Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 01/16] bpf: allocate 0x06 to new eBPF instruction class JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 02/16] bpf: refactor verifier min/max code for condition jump Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 03/16] bpf: verifier support JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 04/16] bpf: disassembler " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 05/16] tools: bpftool: teach cfg code about JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 06/16] bpf: interpreter support for JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 07/16] bpf: JIT blinds support JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 08/16] bpf: functional and min/max reasoning unit tests for JMP32 Jiong Wang
2019-01-23 14:29   ` Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 09/16] x86_64: bpf: implement jitting of JMP32 Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 10/16] x32: " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 11/16] arm64: " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 12/16] arm: " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 13/16] ppc: " Jiong Wang
2019-01-24  4:58   ` Sandipan Das
2019-01-24  9:53     ` Jiong Wang [this message]
2019-01-21 13:15 ` [PATCH bpf-next v2 14/16] s390: " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 15/16] nfp: " Jiong Wang
2019-01-21 13:15 ` [PATCH bpf-next v2 16/16] selftests: bpf: makefile support sub-register code-gen test mode Jiong Wang

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=87bm46z8jl.fsf@netronome.com \
    --to=jiong.wang@netronome$(echo .)com \
    --cc=ast@kernel$(echo .)org \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=naveen.n.rao@linux$(echo .)ibm.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=oss-drivers@netronome$(echo .)com \
    --cc=sandipan@linux$(echo .)ibm.com \
    /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