From: Boqun Feng <boqun@kernel.org>
To: bot+bpf-ci@kernel.org
Cc: peterz@infradead.org, catalin.marinas@arm.com, will@kernel.org,
jonas@southpole.se, stefan.kristiansson@saunalahti.fi,
shorne@gmail.com, hca@linux.ibm.com, gor@linux.ibm.com,
agordeev@linux.ibm.com, borntraeger@linux.ibm.com,
svens@linux.ibm.com, tglx@kernel.org, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, arnd@arndb.de, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, longman@redhat.com,
akpm@linux-foundation.org, andrii@kernel.org, eddyz87@gmail.com,
ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
memxor@gmail.com, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, shuah@kernel.org, ojeda@kernel.org,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
dakr@kernel.org, ruanjinjie@huawei.com, lyude@redhat.com,
thuth@redhat.com, sohil.mehta@intel.com,
pawan.kumar.gupta@linux.intel.com, seanjc@google.com,
nikunj@amd.com, xin@zytor.com, joelagnelf@nvidia.com,
andriy.shevchenko@linux.intel.com, rdunlap@infradead.org,
ynorov@nvidia.com, bigeasy@linutronix.de,
linux-kernel@vger.kernel.org, linux-openrisc@vger.kernel.org,
linux-s390@vger.kernel.org, linux-arch@vger.kernel.org,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
rust-for-linux@vger.kernel.org, boqun.feng@gmail.com,
martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH v3 03/13] preempt: Introduce __preempt_count_{sub, add}_return()
Date: Thu, 4 Jun 2026 23:45:29 -0700 [thread overview]
Message-ID: <aiJwieZoxCBEZ2ji@tardis-2.local> (raw)
In-Reply-To: <d3e91d227b0e1b777a85806e54b03d46581e4460f893e5b45baa9168f5319fbf@mail.kernel.org>
On Fri, Jun 05, 2026 at 06:30:14AM +0000, bot+bpf-ci@kernel.org wrote:
> > preempt: Introduce __preempt_count_{sub, add}_return()
> >
> > In order to use preempt_count() to tracking the interrupt disable
> > nesting level, __preempt_count_{add,sub}_return() are introduced, as
> > their name suggest, these primitives return the new value of the
> > preempt_count() after changing it. The following example shows the usage
> > of it in local_interrupt_disable():
> >
> > // increase the HARDIRQ_DISABLE bit
> > new_count = __preempt_count_add_return(HARDIRQ_DISABLE_OFFSET);
> >
> > // if it's the first-time increment, then disable the interrupt
> > // at hardware level.
> > if (new_count & HARDIRQ_DISABLE_MASK == HARDIRQ_DISABLE_OFFSET) {
> ^^
>
> The operator precedence in this example appears incorrect. In C, the equality
> operator == has higher precedence than the bitwise AND operator &, so this
> evaluates as:
>
> new_count & (HARDIRQ_DISABLE_MASK == HARDIRQ_DISABLE_OFFSET)
>
> Since the mask does not equal the offset, the equality evaluates to 0, making
> the entire condition always false.
>
> Should this be written with explicit parentheses to prevent readers from
> copying flawed logic into downstream implementations?
>
Will fix this but this code is in commit log rather than real code.
Regards,
Boqun
> if ((new_count & HARDIRQ_DISABLE_MASK) == HARDIRQ_DISABLE_OFFSET) {
>
> This was raised by sashiko-bot@kernel.org in v3 review:
> https://lore.kernel.org/all/20260605055933.EDF3D1F00898@smtp.kernel.org/
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/26998319662
next prev parent reply other threads:[~2026-06-05 6:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 5:41 [PATCH v3 00/13] Refcounted interrupt disable and SpinLockIrq for rust (Part 1) Boqun Feng
2026-06-05 5:41 ` [PATCH v3 01/13] preempt: Track NMI nesting to separate per-CPU counter Boqun Feng
2026-06-05 5:41 ` [PATCH v3 02/13] preempt: Introduce HARDIRQ_DISABLE_BITS Boqun Feng
2026-06-05 5:41 ` [PATCH v3 03/13] preempt: Introduce __preempt_count_{sub, add}_return() Boqun Feng
2026-06-05 6:30 ` bot+bpf-ci
2026-06-05 6:45 ` Boqun Feng [this message]
2026-06-05 5:41 ` [PATCH v3 04/13] openrisc: Include <linux/cpumask.h> in smp.h Boqun Feng
2026-06-05 5:41 ` [PATCH v3 05/13] irq & spin_lock: Add counted interrupt disabling/enabling Boqun Feng
2026-06-05 6:30 ` bot+bpf-ci
2026-06-05 6:40 ` Boqun Feng
2026-06-05 5:41 ` [PATCH v3 06/13] irq: Add KUnit test for refcounted interrupt enable/disable Boqun Feng
2026-06-05 5:41 ` [PATCH v3 07/13] locking: Switch to _irq_{disable,enable}() variants in cleanup guards Boqun Feng
2026-06-05 5:41 ` [PATCH v3 08/13] sched: Remove the unused preempt_offset parameter of __cant_sleep() Boqun Feng
2026-06-05 5:41 ` [PATCH v3 09/13] sched: Avoid signed comparison of preempt_count() in __cant_migrate() Boqun Feng
2026-06-05 5:41 ` [PATCH v3 10/13] preempt: Introduce HAS_SEPARATE_PREEMPT_RESCHED_BITS Boqun Feng
2026-06-05 6:30 ` bot+bpf-ci
2026-06-05 5:41 ` [PATCH v3 11/13] arm64: sched/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS Boqun Feng
2026-06-05 5:41 ` [PATCH v3 12/13] s390/preempt: " Boqun Feng
2026-06-05 5:41 ` [PATCH v3 13/13] irq: Optimize reschedule check in local_interrupt_enable() 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=aiJwieZoxCBEZ2ji@tardis-2.local \
--to=boqun@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=andrii@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=borntraeger@linux.ibm.com \
--cc=bot+bpf-ci@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=bsegall@google.com \
--cc=catalin.marinas@arm.com \
--cc=clm@meta.com \
--cc=dakr@kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=dietmar.eggemann@arm.com \
--cc=eddyz87@gmail.com \
--cc=gary@garyguo.net \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=ihor.solodrai@linux.dev \
--cc=joelagnelf@nvidia.com \
--cc=jolsa@kernel.org \
--cc=jonas@southpole.se \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-openrisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=ojeda@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=ruanjinjie@huawei.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=seanjc@google.com \
--cc=shorne@gmail.com \
--cc=shuah@kernel.org \
--cc=sohil.mehta@intel.com \
--cc=song@kernel.org \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=svens@linux.ibm.com \
--cc=tglx@kernel.org \
--cc=thuth@redhat.com \
--cc=tmgross@umich.edu \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
--cc=ynorov@nvidia.com \
--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