mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boqun Feng <boqun@kernel.org>
To: Leon Hwang <leon.hwang@linux.dev>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@kernel.org>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>, "Gary Guo" <gary@garyguo.net>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Thomas Gleixner" <tglx@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	"Shrikanth Hegde" <sshegde@linux.ibm.com>,
	"Alexei Starovoitov" <ast@kernel.org>
Subject: Re: [PATCH v2 3/5] selftests/bpf: Use the new NMI_BITS definition
Date: Fri, 2 Oct 2026 08:41:06 +0200	[thread overview]
Message-ID: <ar9SAuIQ8RAp4GsG@MacBook-0RXW5> (raw)
In-Reply-To: <ffd241f1-3f75-44c6-93b1-1482b7a17a5b@linux.dev>

On Fri, Oct 02, 2026 at 02:24:11PM +0800, Leon Hwang wrote:
> 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@linux.ibm.com>
> >> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> >> Signed-off-by: Boqun Feng <boqun@kernel.org>
> >> ---
> >>  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
> 

Thanks for the testing. I know that IS_ENABLED is not unnecessary, but I
put it there to make NMI_BITS definition stay the same as
include/linux/preempt.h.

> > +
> >  #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.
> 

Sure, will do.

Regards,
Boqun

> Thanks,
> Leon
> 
> > 
> > Regards,
> > Boqun
> > 
> ---
> 
> From 4c1b9a6f6404aa25d1d300465dba4bee9a139668 Mon Sep 17 00:00:00 2001
> From: Boqun Feng <boqun@kernel.org>
> Date: Thu, 1 Oct 2026 10:25:17 +0200
> Subject: [PATCH 1/3] selftests/bpf: Use the new NMI_BITS definition
> 
> 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@linux.ibm.com>
> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> Signed-off-by: Boqun Feng <boqun@kernel.org>
> ---
>  tools/testing/selftests/bpf/bpf_experimental.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h
> b/tools/testing/selftests/bpf/bpf_experimental.h
> index 2893bf06ff25..b567a48f1dce 100644
> --- a/tools/testing/selftests/bpf/bpf_experimental.h
> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> @@ -367,11 +367,13 @@ 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 __weak __kconfig;
> +
>  #define PREEMPT_BITS	8
>  #define SOFTIRQ_BITS	8
>  #define HARDIRQ_DISABLE_BITS	8
>  #define HARDIRQ_BITS	4
> -#define NMI_BITS	1
> +#define NMI_BITS	(1 + 3*CONFIG_HAS_SEPARATE_PREEMPT_RESCHED_BITS)
> 
>  #define PREEMPT_SHIFT	0
>  #define SOFTIRQ_SHIFT	(PREEMPT_SHIFT + PREEMPT_BITS)
> -- 
> 2.55.0
> 
> 

  reply	other threads:[~2026-10-02  6:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  8:25 [PATCH v2 0/5] Improvements and fixes on SpinLockIrq patch series Boqun Feng
2026-10-01  8:25 ` [PATCH v2 1/5] irq: Make refcount_interrupt kunit test selectable Boqun Feng
2026-10-02  9:44   ` [tip: locking/urgent] " tip-bot2 for Kuan-Wei Chiu
2026-10-01  8:25 ` [PATCH v2 2/5] irq: Add {over,under}flow detection for local_interrupt_{enable,disable} Boqun Feng
2026-10-01  8:25 ` [PATCH v2 3/5] selftests/bpf: Use the new NMI_BITS definition Boqun Feng
2026-10-01 13:13   ` Boqun Feng
2026-10-02  6:24     ` Leon Hwang
2026-10-02  6:41       ` Boqun Feng [this message]
2026-10-01  8:25 ` [PATCH v2 4/5] irq: Explain better on NMI_MASK overflow condition Boqun Feng
2026-10-01  8:25 ` [PATCH v2 5/5] irq: Add max local_interrupt_disable() nesting level kunit test case Boqun Feng
2026-10-02  9:42 ` [PATCH v2 0/5] Improvements and fixes on SpinLockIrq patch series Peter Zijlstra
2026-10-02 10:30   ` Boqun Feng

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=ar9SAuIQ8RAp4GsG@MacBook-0RXW5 \
    --to=boqun@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=ast@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=leon.hwang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=lyude@redhat.com \
    --cc=mingo@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sshegde@linux.ibm.com \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=work@onurozkan.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

all inboxes | Powered by JetHome®