public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Barret Rhoden <brho@google.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	mattbobrowski@google.com, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements
Date: Thu, 4 Jan 2024 16:32:39 -0500	[thread overview]
Message-ID: <d6bd59f0-ba79-4e76-9fb7-aa07f86e4043@google.com> (raw)
In-Reply-To: <CAEf4BzauYF4DoQLV6AGfFcq3VgP2yi_Pd6pg2vj2Eb7Rt7j0Pg@mail.gmail.com>

On 1/3/24 16:21, Andrii Nakryiko wrote:
> On Wed, Jan 3, 2024 at 12:06 PM Barret Rhoden<brho@google.com>  wrote:
>> On 1/3/24 14:51, Andrii Nakryiko wrote:
>>> I'm curious how bpf_cmp_likely/bpf_cmp_unlikely (just applied to
>>> bpf-next) compares to this?
>> these work great!
>>
>> e.g.
>>
>>           if (bpf_cmp_likely(idx, <, NR_MAP_ELEMS))
>>                   map_elems[idx] = i;
>>
>> works fine.  since that's essentially the code that bpf_array_elem() was
>> trying to replace, i'd rather just use the new bpf_cmp helpers than have
>> the special array_elem helpers.
> ok, cool, thanks for checking! The less special macros, the better.

sorry - turns out it only worked in testing.  in my actual program, i 
still run into issues.  the comparison is done, which is what bpf_cmp 
enforces.  but the compiler is discarding the comparison.  i have more 
info in the other thread, but figured i'd mention it here too.  =(

  reply	other threads:[~2024-01-04 21:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 15:33 [PATCH bpf-next 0/2] inline asm helpers to access array elements Barret Rhoden
2024-01-03 15:33 ` [PATCH bpf-next 1/2] libbpf: add helpers for mmapping maps Barret Rhoden
2024-01-03 16:57   ` John Fastabend
2024-01-03 18:50     ` Barret Rhoden
2024-01-03 15:33 ` [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements Barret Rhoden
2024-01-03 17:52   ` John Fastabend
2024-01-03 19:51   ` Andrii Nakryiko
2024-01-03 20:06     ` Barret Rhoden
2024-01-03 21:21       ` Andrii Nakryiko
2024-01-04 21:32         ` Barret Rhoden [this message]
2024-01-04 21:37     ` Barret Rhoden
2024-01-04 22:45       ` Andrii Nakryiko

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=d6bd59f0-ba79-4e76-9fb7-aa07f86e4043@google.com \
    --to=brho@google.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattbobrowski@google.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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