Re: [PATCH v2 3/5] selftests/bpf: Use the new NMI_BITS definition

From: Leon Hwang

Date: Fri Oct 02 2026 - 02:24:38 EST


On 1/10/26 21:13, Boqun Feng wrote:
> On Thu, Oct 01, 2026 at 10:25:17AM +0200, Boqun Feng wrote:
>> The definition of NMI_BITS was out of sync after the introduction of
>> HAS_SEPARATE_PREEMPT_RESCHED_BITS, hence adjust it.
>>
>> Reported-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
>> Reviewed-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
>> Signed-off-by: Boqun Feng <boqun@xxxxxxxxxx>
>> ---
>> tools/testing/selftests/bpf/bpf_experimental.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
>> index 2893bf06ff25..4bf7390994bf 100644
>> --- a/tools/testing/selftests/bpf/bpf_experimental.h
>> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
>
> Per sashiko's report, seems I need the following to make it work:

Sashiko is correct.

BPF compilation context is different from kernel compilation context. It
cannot directly use
IS_ENABLED(CONFIG_HAS_SEPARATE_PREEMPT_RESCHED_BITS)) when compiling BPF
objects.

>
> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
> index 4bf7390994bf..94143cf0ab0d 100644
> --- a/tools/testing/selftests/bpf/bpf_experimental.h
> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> @@ -367,6 +367,9 @@ extern int bpf_cgroup_read_xattr(struct cgroup *cgroup, const char *name__str,
> extern int bpf_sock_read_xattr(struct socket *sock, const char *name__str,
> struct bpf_dynptr *value_p) __weak __ksym;
>
> +extern bool CONFIG_HAS_SEPARATE_PREEMPT_RESCHED_BITS __kconfig __weak;
> +#define IS_ENABLED(cfg) (cfg)

Correct.

IS_ENABLED is unnecessary here.

The below patch passed the BPF ci [1].

[1] https://github.com/kernel-patches/bpf/pull/14197

> +
> #define PREEMPT_BITS 8
> #define SOFTIRQ_BITS 8
> #define HARDIRQ_DISABLE_BITS 8
>
> ?
>
> [Cc Leon and Alexi]

Please cc BPF list, BPF maintainers, and me when respinning.

Thanks,
Leon

>
> Regards,
> Boqun
>
---