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,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"Shuah Khan" <shuah@kernel.org>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
"Shrikanth Hegde" <sshegde@linux.ibm.com>,
"Alexei Starovoitov" <ast@kernel.org>
Subject: Re: [PATCH v3] selftests/bpf: Use the new NMI_BITS definition
Date: Mon, 19 Oct 2026 08:23:55 -0700 [thread overview]
Message-ID: <atY2C77fARQNgWp3@tardis.local> (raw)
In-Reply-To: <da2773b2-1ed2-40ef-aefa-0e754cdb2f9d@linux.dev>
On Fri, Oct 02, 2026 at 09:50:02PM +0800, Leon Hwang wrote:
> On 2026/10/2 18:29, 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>
> > Fixes: 3b0e2a22d408 ("preempt: Introduce HAS_SEPARATE_PREEMPT_RESCHED_BITS")
> > Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> > Cc: Leon Hwang <leon.hwang@linux.dev>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > Signed-off-by: Boqun Feng <boqun@kernel.org>
>
> lgtm,
>
> Acked-by: Leon Hwang <leon.hwang@linux.dev>
>
> One nit below.
>
> > ---
> > v2: https://lore.kernel.org/lkml/20261001082519.16195-4-boqun@kernel.org/
> > v2 -> v3:
> >
> > * Add Fixes tag.
> > * Add CONFIG_HAS_SEPARATE_PREEMPT_RESCHED_BITS weak symbol because
> > CONFIG_* is not available in bpf programs.
> >
> >
> > tools/testing/selftests/bpf/bpf_experimental.h | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
> > index 2893bf06ff25..a09448347966 100644
> > --- a/tools/testing/selftests/bpf/bpf_experimental.h
> > +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> > @@ -367,11 +367,16 @@ 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;
> > +
> > +/* A trivial macro to make NMI_BITS exactly the same as in <linux/preempt.h> */
> > +#define IS_ENABLED(cfg) (cfg)
>
> NIT: change this to ((cfg) ? 1 : 0) to match IS_ENABLED() semantics.
>
Seems reasonable.
Regards,
Boqun
> Thanks,
> Leon
>
> > +
> > #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*IS_ENABLED(CONFIG_HAS_SEPARATE_PREEMPT_RESCHED_BITS))
> >
> > #define PREEMPT_SHIFT 0
> > #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
>
prev parent reply other threads:[~2026-10-19 15:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 10:29 Boqun Feng
2026-10-02 13:50 ` Leon Hwang
2026-10-19 15:23 ` Boqun Feng [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=atY2C77fARQNgWp3@tardis.local \
--to=boqun@kernel.org \
--cc=aliceryhl@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=gary@garyguo.net \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lyude@redhat.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mingo@kernel.org \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=sshegde@linux.ibm.com \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=work@onurozkan.dev \
--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
all inboxes | Powered by JetHome®