BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH bpf-next] bpf: Minor improvements for bpf_cmp.
Date: Fri, 12 Jan 2024 17:24:18 -0800	[thread overview]
Message-ID: <fcfa92e1-ac0e-4347-8021-99ad5c8d918c@linux.dev> (raw)
In-Reply-To: <20240112220134.71209-1-alexei.starovoitov@gmail.com>


On 1/12/24 2:01 PM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> Few minor improvements for bpf_cmp() macro:
> . reduce number of args in __bpf_cmp()
> . rename NOFLIP to UNLIKELY
> . add a comment about 64-bit truncation in "i" constraint
> . use "ri" constraint for sizeof(rhs) <= 4
> . improve error message for bpf_cmp_likely()
>
> Before:
> progs/iters_task_vma.c:31:7: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
>     31 |                 if (bpf_cmp_likely(seen, <==, 1000))
>        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../bpf/bpf_experimental.h:325:3: note: expanded from macro 'bpf_cmp_likely'
>    325 |                 ret;
>        |                 ^~~
> progs/iters_task_vma.c:31:7: note: variable 'ret' is declared here
> ../bpf/bpf_experimental.h:310:3: note: expanded from macro 'bpf_cmp_likely'
>    310 |                 bool ret;
>        |                 ^
>
> After:
> progs/iters_task_vma.c:31:7: error: invalid operand for instruction
>     31 |                 if (bpf_cmp_likely(seen, <==, 1000))
>        |                     ^
> ../bpf/bpf_experimental.h:324:17: note: expanded from macro 'bpf_cmp_likely'
>    324 |                         asm volatile("r0 " #OP " invalid compare");
>        |                                      ^
> <inline asm>:1:5: note: instantiated into assembly here
>      1 |         r0 <== invalid compare
>        |            ^
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Acked-by: Yonghong Song <yonghong.song@linux.dev>


  reply	other threads:[~2024-01-13  1:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 22:01 [PATCH bpf-next] bpf: Minor improvements for bpf_cmp Alexei Starovoitov
2024-01-13  1:24 ` Yonghong Song [this message]
2024-01-15 17:10 ` patchwork-bot+netdevbpf

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=fcfa92e1-ac0e-4347-8021-99ad5c8d918c@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    /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