From: "Paul E. McKenney" <paulmck@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, rostedt@goodmis.org
Subject: Re: [PATCH 3/8] refscale: Add local_bh_disable() readers
Date: Tue, 11 Nov 2025 11:21:04 -0800 [thread overview]
Message-ID: <5b1fa8a6-0f47-4ab8-af7a-74916bc520e2@paulmck-laptop> (raw)
In-Reply-To: <20251111153803.5_08_ro2@linutronix.de>
On Tue, Nov 11, 2025 at 04:38:03PM +0100, Sebastian Andrzej Siewior wrote:
> On 2025-11-02 14:49:43 [-0800], Paul E. McKenney wrote:
> > --- a/kernel/rcu/refscale.c
> > +++ b/kernel/rcu/refscale.c
> > @@ -636,6 +636,37 @@ static const struct ref_scale_ops jiffies_ops = {
> > .name = "jiffies"
> > };
> >
> > +static void ref_bh_section(const int nloops)
> > +{
> > + int i;
> > +
> > + preempt_disable();
> > + for (i = nloops; i >= 0; i--) {
> > + local_bh_disable();
>
> This (preempt off followed by bh off) may cause warnings. That would be
> bh is disabled on the CPU, it gets preempted by _this_ which disables
> first preemption and then bh.
> I hid the code under CONFIG_PREEMPT_RT_NEEDS_BH_LOCK so it shouldn't be
> a problem in the long term I think. So just if you see a warning here
> under RT you know why :)
Huh. Would migrate_disable() be appropriate? Or I suppose I could just
let it migrate on RT. So how about the fix shown below?
Thanx, Paul
> > + local_bh_enable();
> > + }
> > + preempt_enable();
> > +}
>
> Sebastian
------------------------------------------------------------------------
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 07a313782dfd..5a692a3b93fa 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -887,25 +887,29 @@ static void ref_bh_section(const int nloops)
{
int i;
- preempt_disable();
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+ preempt_disable();
for (i = nloops; i >= 0; i--) {
local_bh_disable();
local_bh_enable();
}
- preempt_enable();
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+ preempt_enable();
}
static void ref_bh_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
- preempt_disable();
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+ preempt_disable();
for (i = nloops; i >= 0; i--) {
local_bh_disable();
un_delay(udl, ndl);
local_bh_enable();
}
- preempt_enable();
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+ preempt_enable();
}
static const struct ref_scale_ops bh_ops = {
next prev parent reply other threads:[~2025-11-11 19:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-02 22:49 [PATCH 0/8] refscale updates for v6.19 Paul E. McKenney
2025-11-02 22:49 ` [PATCH 1/8] refscale: Exercise DEFINE_STATIC_SRCU_FAST() and init_srcu_struct_fast() Paul E. McKenney
2025-11-02 22:49 ` [PATCH 2/8] refscale: Add local_irq_disable() and local_irq_save() readers Paul E. McKenney
2025-11-02 22:49 ` [PATCH 3/8] refscale: Add local_bh_disable() readers Paul E. McKenney
2025-11-11 15:38 ` Sebastian Andrzej Siewior
2025-11-11 19:21 ` Paul E. McKenney [this message]
2025-11-12 9:14 ` Sebastian Andrzej Siewior
2025-11-12 17:41 ` Paul E. McKenney
2025-11-02 22:49 ` [PATCH 4/8] refscale: Add preempt_disable() readers Paul E. McKenney
2025-11-02 22:49 ` [PATCH 5/8] refscale: Add this_cpu_inc() readers Paul E. McKenney
2025-11-02 22:49 ` [PATCH 6/8] refscale: Add non-atomic per-CPU increment readers Paul E. McKenney
2025-11-02 22:49 ` [PATCH 7/8] refscale: Do not diable interrupts for tests involving local_bh_enable() Paul E. McKenney
2025-11-02 22:49 ` [PATCH 8/8] refscale: Add SRCU-fast-updown readers Paul E. McKenney
2025-11-05 22:56 ` [PATCH 0/8] refscale updates for v6.19 Frederic Weisbecker
2025-11-05 23:01 ` Frederic Weisbecker
2025-11-06 1:43 ` Paul E. McKenney
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=5b1fa8a6-0f47-4ab8-af7a-74916bc520e2@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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®