mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yiyang Chen" <cyyzero16@gmail.com>
Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] softirq: Limit the BH count warning to RT BH lock users
Date: Sun, 22 Nov 2026 18:42:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-228188@kernel.org> (raw)
In-Reply-To: <d9554bee441d2c763ef8d61e966a7a471915bbee.1795372382.git.cyyzero16@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] softirq: missing Fixes trailer for false-positive BH count
  warning fix
--

commit aff1deb32f25d2d4caa853499ddafd50802def5a
Author: Yiyang Chen <cyyzero16@gmail.com>

> softirq: Limit the BH count warning to RT BH lock users
>
> __local_bh_disable_ip() warns if a non-preemptible task first disables
> BHs while the per-CPU BH count is nonzero. Without the RT BH lock,
> this check can turn off lock debugging on a valid call sequence.
>
> With CONFIG_PREEMPT_RT_NEEDS_BH_LOCK=n, the following sequence is valid
> for two tasks on the same CPU.
> Both tasks call the BH helpers with IRQs enabled. The per-CPU BH count
> starts at zero.
>
>   Task A                          Task B
>   ------                          ------
>   local_bh_disable()
>     softirq_ctrl.cnt += SOFTIRQ_DISABLE_OFFSET
>     current->softirq_disable_cnt += SOFTIRQ_DISABLE_OFFSET
>   <preempted by B>
>                                   preempt_disable()
>                                   local_bh_disable()
>                                     B's softirq_disable_cnt is zero
>                                     preemptible() is false
>                                     WARN on nonzero softirq_ctrl.cnt
>                                     softirq_ctrl.cnt += SOFTIRQ_DISABLE_OFFSET
>                                     current->softirq_disable_cnt += SOFTIRQ_DISABLE_OFFSET
>                                   local_bh_enable()
>                                   preempt_enable()
>   <resumes>
>   local_bh_enable()
>
> The warning relies on the per-CPU BH lock serializing BH-disabled
> sections on the same CPU. With CONFIG_PREEMPT_RT_NEEDS_BH_LOCK=y, A
> still holds that lock when B runs. Since B is non-preemptible, it skips
> the lock acquisition. The nonzero count then exposes B entering the
> section while A holds the lock.
>
> With CONFIG_PREEMPT_RT_NEEDS_BH_LOCK=n, there is no BH lock for B to
> bypass. The same nonzero count simply records A's active BH-disabled
> section, which may legitimately overlap B's.
>
> Guard the warning with CONFIG_PREEMPT_RT_NEEDS_BH_LOCK for as long as
> the lock is optional. If the lock is removed, as discussed earlier,
> the check can go away with it.
>
> Link: https://lore.kernel.org/lkml/20260310115534.3477871-1-jackzxcui1989@163.com
> Signed-off-by: Yiyang Chen <cyyzero16@gmail.com>

[Severity: Low]
This fixes the warning left unguarded when CONFIG_PREEMPT_RT_NEEDS_BH_LOCK
was introduced.  Should this include:

  Fixes: 3253cb49cbad ("softirq: Allow to drop the softirq-BKL lock on PREEMPT_RT")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/d9554bee441d2c763ef8d61e966a7a471915bbee.1795372382.git.cyyzero16@gmail.com?part=1

      reply	other threads:[~2026-11-22 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 18:35 Yiyang Chen
2026-11-22 18:42 ` sashiko-bot [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=sashiko-outbox-228188@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cyyzero16@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --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 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®