From: Jiri Olsa <olsajiri@gmail.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: bot+bpf-ci@kernel.org, andrii@kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org, eddyz87@gmail.com,
yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCHv4 bpf-next 2/5] libbpf: Add support to detect nop,nop5 instructions combo for usdt probe
Date: Sun, 22 Feb 2026 15:32:52 +0100 [thread overview]
Message-ID: <aZsTlJqakDLWzHqn@krava> (raw)
In-Reply-To: <20260221120035.4562df85@pumpkin>
On Sat, Feb 21, 2026 at 12:00:35PM +0000, David Laight wrote:
> On Fri, 20 Feb 2026 11:24:45 +0000 (UTC)
> bot+bpf-ci@kernel.org wrote:
>
> > > diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
> > > index d1524f6f54ae..c81e0a58caf5 100644
> > > --- a/tools/lib/bpf/usdt.c
> > > +++ b/tools/lib/bpf/usdt.c
> >
> > [ ... ]
> >
> > > +#if defined(__x86_64__)
> > > +static bool has_nop_combo(int fd, long off)
> > > +{
> > > + static unsigned char nop_combo[6] = {
> > ^^^^^^^^^^^^^^^^^^^^^^
> >
> > Should nop_combo be declared const? It is a read-only lookup table
> > used only in the memcmp() below.
>
> Actually you either want 'static const unsigned char' or just 'unsigned char'.
> In either case gcc optimises away the array, the call to memcmp(), and
> just compares with 32bit and 64bit constants.
ok, makes sense, will change
>
> >
> > > + 0x90, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nop,nop5 */
> > > + };
> > > + unsigned char buf[6] = {};
>
> No need to initialise buf[];
right, thanks,
jirka
>
> David
>
> > > +
> > > + if (pread(fd, buf, 6, off) != 6)
> > > + return false;
> > > + return memcmp(buf, nop_combo, 6) == 0;
> > > +}
> >
> > [ ... ]
> >
> >
> > ---
> > AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> > See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
> >
> > CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22221513473
> >
> > AI-authorship-score: low
> > AI-authorship-explanation: Domain-specific optimization from established BPF/tracing maintainer with iterative lore review history and deep x86_64 uprobe internals knowledge.
> > issues-found: 1
> > issue-severity-score: low
> > issue-severity-explanation: Missing const qualifier on a static read-only byte array is a minor C best practice deviation with no runtime impact.
>
next prev parent reply other threads:[~2026-02-22 14:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 10:42 [PATCHv4 bpf-next 0/5] libbpf: Make optimized uprobes backward compatible Jiri Olsa
2026-02-20 10:42 ` [PATCHv4 bpf-next 1/5] libbpf: Add uprobe syscall feature detection Jiri Olsa
2026-02-20 10:42 ` [PATCHv4 bpf-next 2/5] libbpf: Add support to detect nop,nop5 instructions combo for usdt probe Jiri Olsa
2026-02-20 11:24 ` bot+bpf-ci
2026-02-21 12:00 ` David Laight
2026-02-22 14:32 ` Jiri Olsa [this message]
2026-02-20 10:42 ` [PATCHv4 bpf-next 3/5] selftests/bpf: Emit nop,nop5 instructions combo for x86_64 arch Jiri Olsa
2026-02-20 10:42 ` [PATCHv4 bpf-next 4/5] selftests/bpf: Add test for checking correct nop of optimized usdt Jiri Olsa
2026-02-20 10:42 ` [PATCHv4 bpf-next 5/5] selftests/bpf: Add usdt trigger bench Jiri Olsa
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=aZsTlJqakDLWzHqn@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=david.laight.linux@gmail.com \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
--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