From: Jiong Wang <jiong.wang@netronome•com>
To: Sandipan Das <sandipan@linux•ibm.com>
Cc: Jiong Wang <jiong.wang@netronome•com>,
daniel@iogearbox•net, ast@kernel•org, netdev@vger•kernel.org,
oss-drivers@netronome•com,
"Naveen N . Rao" <naveen.n.rao@linux•ibm.com>
Subject: Re: [PATCH bpf-next 2/7] ppc: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_*
Date: Wed, 05 Dec 2018 11:28:32 +0000 [thread overview]
Message-ID: <87bm60gqlb.fsf@netronome.com> (raw)
In-Reply-To: <7664a4d2-ed4e-4e60-2d1d-3b113d05972b@linux.ibm.com>
Sandipan Das writes:
> Hi Jiong,
>
> On 05/12/18 2:25 AM, Jiong Wang wrote:
>> This patch implements code-gen for BPF_ALU | BPF_ARSH | BPF_*.
>>
>> 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>
>> ---
> [...]
>> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
>> index 17482f5..c685b4f 100644
>> --- a/arch/powerpc/net/bpf_jit_comp64.c
>> +++ b/arch/powerpc/net/bpf_jit_comp64.c
>> @@ -529,9 +529,15 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
>> if (imm != 0)
>> PPC_SRDI(dst_reg, dst_reg, imm);
>> break;
>> + case BPF_ALU | BPF_ARSH | BPF_X: /* (s32) dst >>= src */
>> + PPC_SRAW(dst_reg, dst_reg, src_reg);
>> + break;
>
> On ppc64, the sraw and srawi instructions also use sign extension. So, you will have
> to ensure that upper 32 bits are cleared. We already have a label in our JIT code
> called bpf_alu32_trunc that takes care of this. Replacing the break statement with
> a goto bpf_alu32_trunc will fix this.
(resend the reply, got a delivery failure notification from
netdev@vger•kernel.org)
Indeed. Doubled checked the ISA doc,"Bit 32 of RS is replicated to fill
RA0:31.".
Will fix both places in v2.
Thanks
Regards,
Jiong
>
>> case BPF_ALU64 | BPF_ARSH | BPF_X: /* (s64) dst >>= src */
>> PPC_SRAD(dst_reg, dst_reg, src_reg);
>> break;
>> + case BPF_ALU | BPF_ARSH | BPF_K: /* (s32) dst >>= imm */
>> + PPC_SRAWI(dst_reg, dst_reg, imm);
>> + break;
>
> Same here.
>
>> case BPF_ALU64 | BPF_ARSH | BPF_K: /* (s64) dst >>= imm */
>> if (imm != 0)
>> PPC_SRADI(dst_reg, dst_reg, imm);
>>
>
> With Regards,
> Sandipan
next prev parent reply other threads:[~2018-12-05 11:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 20:55 [PATCH bpf-next 0/7] bpf: support BPF_ALU | BPF_ARSH Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 1/7] mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X Jiong Wang
2018-12-05 0:02 ` Paul Burton
2018-12-05 11:07 ` Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 2/7] ppc: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_* Jiong Wang
2018-12-05 6:37 ` Sandipan Das
2018-12-05 11:28 ` Jiong Wang [this message]
2018-12-05 19:39 ` David Miller
2018-12-04 20:55 ` [PATCH bpf-next 3/7] s390: " Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 4/7] nfp: " Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 5/7] bpf: interpreter support BPF_ALU | BPF_ARSH Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 6/7] bpf: verifier remove the rejection on " Jiong Wang
2018-12-04 20:55 ` [PATCH bpf-next 7/7] selftests: bpf: update testcases for " 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=87bm60gqlb.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