From: sashiko-bot@kernel.org
To: "Boqun Feng" <boqun@kernel.org>
Cc: ojeda@kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 03/13] preempt: Introduce __preempt_count_{sub, add}_return()
Date: Fri, 05 Jun 2026 05:59:33 +0000 [thread overview]
Message-ID: <20260605055933.EDF3D1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260605054128.5925-4-boqun@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Operator precedence bug in the commit message usage example.
--
commit 7f1eb356534806694deb9a4e04de28fe3e6692ab
Author: Boqun Feng <boqun@kernel.org>
preempt: Introduce __preempt_count_{sub, add}_return()
This commit introduces __preempt_count_add_return() and
__preempt_count_sub_return() to track the interrupt disable nesting level
while returning the new value of the preempt count. This helps avoid an
additional read of preempt_count() on certain architectures.
Link: https://patch.msgid.link/20260121223933.1568682-4-lyude@redhat.com
> // if it's the first-time increment, then disable the interrupt
> // at hardware level.
> if (new_count & HARDIRQ_DISABLE_MASK == HARDIRQ_DISABLE_OFFSET) {
> local_irq_save(flags);
> raw_cpu_write(local_interrupt_disable_state.flags, flags);
> }
[Severity: Low]
Is there an operator precedence issue in this usage example?
In C, the equality operator == has higher precedence than the bitwise
AND operator &. This means the expression 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 like
(new_count & HARDIRQ_DISABLE_MASK) == HARDIRQ_DISABLE_OFFSET to prevent
readers from copying flawed logic into downstream implementations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260605054128.5925-1-boqun@kernel.org?part=3
next prev parent reply other threads:[~2026-06-05 5:59 UTC|newest]
Thread overview: 28+ 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:59 ` sashiko-bot
2026-06-05 5:41 ` [PATCH v3 02/13] preempt: Introduce HARDIRQ_DISABLE_BITS Boqun Feng
2026-06-05 6:01 ` sashiko-bot
2026-06-05 5:41 ` [PATCH v3 03/13] preempt: Introduce __preempt_count_{sub, add}_return() Boqun Feng
2026-06-05 5:59 ` sashiko-bot [this message]
2026-06-05 6:30 ` bot+bpf-ci
2026-06-05 6:45 ` Boqun Feng
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:01 ` sashiko-bot
2026-06-05 6:27 ` 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:53 ` sashiko-bot
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:57 ` sashiko-bot
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 5:59 ` sashiko-bot
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
2026-06-05 6:04 ` sashiko-bot
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=20260605055933.EDF3D1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=boqun@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.