mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: George Guo <guodongtai@kylinos.cn>
Cc: ast@kernel.org, bpf@vger.kernel.org, chenhuacai@kernel.org,
	kernel@xen0n.name, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
	masahiroy@kernel.org, michal.lkml@markovi.net,
	ndesaulniers@google.com, hengqi.chen@gmail.com,
	yangtiezhu@loongson.cn, tangyouling@loongson.cn
Subject: Re: [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail
Date: Tue, 28 Mar 2023 09:22:24 +0200	[thread overview]
Message-ID: <ddb2f552-252f-4533-469b-31044b4fc2d6@iogearbox.net> (raw)
In-Reply-To: <20230328071335.2664966-1-guodongtai@kylinos.cn>

On 3/28/23 9:13 AM, George Guo wrote:
> Here just skip the opcode(BPF_ST | BPF_NOSPEC) that has no couterpart to the loongarch.
> 
> To verify, use ltp testcase:
> 
> Without this patch:
> $ ./bpf_prog02
> ... ...
> bpf_common.c:123: TBROK: Failed verification: ??? (524)
> 
> Summary:
> passed   0
> failed   0
> broken   1
> skipped  0
> warnings 0
> 
> With this patch:
> $ ./bpf_prog02
> ... ...
> Summary:
> passed   0
> failed   0
> broken   0
> skipped  0
> warnings 0
> 
> Signed-off-by: George Guo <guodongtai@kylinos.cn>
> 
> ---
> Changelog:
> v2:
> 	- place it to build_insn
> 	- add printing for skipping bpf_jit the opcode
> ---
>   arch/loongarch/net/bpf_jit.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
> index 288003a9f0ca..d3c6b1c4ccbb 100644
> --- a/arch/loongarch/net/bpf_jit.c
> +++ b/arch/loongarch/net/bpf_jit.c
> @@ -1022,6 +1022,11 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
>   		emit_atomic(insn, ctx);
>   		break;
>   
> +	/* Speculation barrier */
> +	case BPF_ST | BPF_NOSPEC:
> +		pr_info_once("bpf_jit: skip speculation barrier opcode %0x2x\n", code);
> +		break;

Thanks that looks better. Question to LoongArch folks (Cc): There is no equivalent
to a speculation barrier here, correct? Either way, I think the pr_info_once() can
just be removed given there is little value for a users to have this in the kernel
log. I can take care of this while applying, that's fine.

>   	default:
>   		pr_err("bpf_jit: unknown opcode %02x\n", code);
>   		return -EINVAL;
> 


  reply	other threads:[~2023-03-28  7:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26  4:40 [PATCH] loongarch/bpf: Fix bpf load failed with CONFIG_BPF_JIT_ALWAYS_ON, caused by jit (BPF_ST | BPF_NOSPEC) code George Guo
2023-03-27  9:29 ` Daniel Borkmann
2023-03-28  7:13   ` [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail George Guo
2023-03-28  7:22     ` Daniel Borkmann [this message]
2023-03-28  7:52       ` WANG Xuerui
2023-03-28  8:37         ` Daniel Borkmann

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=ddb2f552-252f-4533-469b-31044b4fc2d6@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=guodongtai@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=tangyouling@loongson.cn \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®