mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: George Guo <dongtai.guo@linux.dev>
To: yangtiezhu@loongson.cn
Cc: chenhuacai@kernel.org, hengqi.chen@gmail.com,
	loongarch@lists.linux.dev, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] LoongArch: BPF: Make arena support depend on SCQ extension
Date: Wed,  4 Nov 2026 19:17:53 +0900	[thread overview]
Message-ID: <20261104101753.20704-1-dongtai.guo@linux.dev> (raw)
In-Reply-To: <20261102072808.23080-2-yangtiezhu@loongson.cn>

Hi Tiezhu,

On 2026/11/2 15:28, Tiezhu Yang wrote:
> This is because the arena range tree uses kmalloc_nolock(), which requires
> 128-bit atomic cmpxchg support, provided by SCQ extension on LoongArch.

There is an existing SLUB debug fallback worth checking before making
arena support depend on SCQ.

In __kmalloc_nolock_noprof(), the rejection condition is:

        if (!(s->flags & __CMPXCHG_DOUBLE) && !kmem_cache_debug(s))
                return NULL;

Debug caches do not require cmpxchg128 for this path. They use
kmem_cache_node->list_lock with spin_trylock_irqsave() instead.
With CONFIG_SLUB_DEBUG=y, booting with slab_debug enables this path;
CONFIG_SLUB_DEBUG_ON=y enables debugging by default as well.

The proposed bpf_jit_supports_arena() check would reject arena maps on
CPUs without SCQ, even when the SLUB debug fallback is available.
This would prevent us from running arena tests on those machines
with slab_debug enabled.

Could you rerun jit_insns/cast_to_user on the 3A5000 with slab_debug
enabled, before and after this patch? The claim that kmalloc_nolock()
requires 128-bit cmpxchg should account for debug caches, and it would
be useful to preserve that fallback when addressing the error reporting.

Thanks,
George

  parent reply	other threads:[~2026-11-04 10:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  7:28 [PATCH v1 0/2] LoongArch: BPF: Fix arena and trampoline Tiezhu Yang
2026-11-02  7:28 ` [PATCH v1 1/2] LoongArch: BPF: Make arena support depend on SCQ extension Tiezhu Yang
2026-11-02 14:20   ` Huacai Chen
2026-11-03  2:24     ` Tiezhu Yang
2026-11-04  4:29       ` Huacai Chen
2026-11-04  6:58         ` Tiezhu Yang
2026-11-04  9:54           ` Huacai Chen
2026-11-04 13:06             ` Tiezhu Yang
2026-11-04 10:17   ` George Guo [this message]
2026-11-02  7:28 ` [PATCH v1 2/2] LoongArch: BPF: Use beqz and bnez instructions for trampoline Tiezhu Yang
2026-11-02  7:53   ` bot+bpf-ci
2026-11-03  2:27     ` Tiezhu Yang

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=20261104101753.20704-1-dongtai.guo@linux.dev \
    --to=dongtai.guo@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=hengqi.chen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /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

all inboxes | Powered by JetHome®