BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Yonghong Song <yonghong.song@linux.dev>,
	bot+bpf-ci@kernel.org, puranjay@kernel.org, bpf@vger.kernel.org
Cc: puranjay12@gmail.com, ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net, martin.lau@kernel.org, eddyz87@gmail.com,
	memxor@gmail.com, mykyta.yatsenko5@gmail.com, qmo@kernel.org,
	kernel-team@meta.com, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2] bpftool: Enable aarch64 ISA extensions for JIT disassembly
Date: Wed, 11 Mar 2026 14:20:37 +0800	[thread overview]
Message-ID: <ea235f43-095a-4c21-8d4a-32bec84bf7c7@linux.dev> (raw)
In-Reply-To: <41c6f48d-1e45-40b2-b2b0-7035cadfa1de@linux.dev>

Yonghong Song wrote:
> 
> 
> On 3/10/26 4:05 PM, bot+bpf-ci@kernel.org wrote:
>>> diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/
>>> jit_disasm.c
>>> --- a/tools/bpf/bpftool/jit_disasm.c
>>> +++ b/tools/bpf/bpftool/jit_disasm.c
>>> @@ -93,7 +93,16 @@ init_context(disasm_ctx_t *ctx, const char *arch,
>>>           p_err("Failed to retrieve triple");
>>>           return -1;
>>>       }
>>> -    *ctx = LLVMCreateDisasm(triple, NULL, 0, NULL,
>>> symbol_lookup_callback);
>>> +
>>> +    /*
>>> +     * Enable all aarch64 ISA extensions so the disassembler can
>>> handle any
>>> +     * instruction the kernel JIT might emit (e.g. ARM64 LSE atomics).
>>> +     */
>>> +    if (strncmp(triple, "aarch64", 7))
>>> +        *ctx = LLVMCreateDisasmCPUFeatures(triple, "", "+all", NULL,
>>> 0, NULL,
>>> +                           symbol_lookup_callback);
>>> +    else
>>> +        *ctx = LLVMCreateDisasm(triple, NULL, 0, NULL,
>>> symbol_lookup_callback);
>> Isn't this condition inverted? strncmp() returns 0 when the
>> strings match, so when triple starts with "aarch64" the condition
>> is false and the else branch runs, which calls the old
>> LLVMCreateDisasm() without any features enabled.
>>
>> Conversely, for non-aarch64 targets (e.g. x86_64), strncmp()
>> returns non-zero, making the condition true, and
>> LLVMCreateDisasmCPUFeatures() with "+all" gets called on the
>> wrong architecture.
>>
>> It looks like this should be:
>>
>>     if (!strncmp(triple, "aarch64", 7))
>>
>> The v1 of this patch used strstr(triple, "aarch64") which has the
>> correct polarity (returns non-NULL on match). The switch to
>> strncmp() for v2 appears to have lost the negation.
> 
> AI is correct. The condition should be
>     if (strncmp(triple, "aarch64", 7) == 0)
> 

Agreed.

After addressing it,

Acked-by: Leon Hwang <leon.hwang@linux.dev>

[...]


      reply	other threads:[~2026-03-11  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 22:34 [PATCH bpf-next v2] bpftool: Enable aarch64 ISA extensions for JIT disassembly Puranjay Mohan
2026-03-10 23:05 ` bot+bpf-ci
2026-03-11  3:51   ` Yonghong Song
2026-03-11  6:20     ` Leon Hwang [this message]

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=ea235f43-095a-4c21-8d4a-32bec84bf7c7@linux.dev \
    --to=leon.hwang@linux.dev \
    --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=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=puranjay12@gmail.com \
    --cc=puranjay@kernel.org \
    --cc=qmo@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