[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJqbYN1VGoSqsHMqvMoZgTw1+PPS87zqsKhUtPgSarY1g@mail.gmail.com>
Date: Thu, 31 Jul 2025 09:46:56 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Soham Bagchi <soham.bagchi@...h.edu>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
Soham Bagchi <sohambagchi@...look.com>
Subject: Re: [PATCH] bpf: relax acquire for consumer_pos in ringbuf_process_ring()
On Wed, Jul 30, 2025 at 11:53 AM Soham Bagchi <soham.bagchi@...h.edu> wrote:
>
> Since r->consumer_pos is modified only by the user thread
> in the given ringbuf context (and as such, it is thread-local)
> it does not require a load-acquire.
>
> Signed-off-by: Soham Bagchi <soham.bagchi@...h.edu>
> ---
> tools/lib/bpf/ringbuf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c
> index 9702b70da44..7753a6570cf 100644
> --- a/tools/lib/bpf/ringbuf.c
> +++ b/tools/lib/bpf/ringbuf.c
> @@ -241,7 +241,7 @@ static int64_t ringbuf_process_ring(struct ring *r, size_t n)
> bool got_new_data;
> void *sample;
>
> - cons_pos = smp_load_acquire(r->consumer_pos);
> + cons_pos = *r->consumer_pos;
I don't think it's correct.
See comment in __bpf_user_ringbuf_sample_release()
--
pw-bot: cr
Powered by blists - more mailing lists