Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev,
	"Linux Trace Kernel" <linux-trace-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()
Date: Fri, 27 Nov 2026 17:23:52 -0500	[thread overview]
Message-ID: <20261127172352.4e3ef0f6@gandalf.local.home> (raw)
In-Reply-To: <sashiko-outbox-238322@kernel.org>

On Fri, 27 Nov 2026 22:16:58 +0000
sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] sched/isolation: housekeeping_any_cpu() still warns in
>   preemptible context
> --
> 
> commit c1392718dea3b288dab2eb1637739fbba4e0fc9a
> Author: Steven Rostedt <rostedt@goodmis.org>
> 
> sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()
> 
> This commit replaces smp_processor_id() with raw_smp_processor_id() in
>  the housekeeping_any_cpu() fallback returns so that callers in preemptible
> context do not trigger preemption warnings when isolation is not enabled.
> 
> > diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> > index 156025ef81b75..c1c84d72c7c5b 100644
> > --- a/kernel/sched/isolation.c
> > +++ b/kernel/sched/isolation.c
> > @@ -99,7 +99,7 @@ int housekeeping_any_cpu(enum hk_type type)
> >  				     type != HK_TYPE_TIMER);
> >  		}
> >  	}
> > -	return smp_processor_id();
> > +	return raw_smp_processor_id();
> >  }
> >  EXPORT_SYMBOL_GPL(housekeeping_any_cpu);  
> 
> [Severity: Medium]
> Can housekeeping_any_cpu() still trigger CONFIG_DEBUG_PREEMPT warnings when
> called from a preemptible context with CPU isolation enabled?
> 
> When housekeeping_overridden is active and housekeeping.flags has the
> requested type set, housekeeping_any_cpu() takes the branch above this
> fallback:
> 
> kernel/sched/isolation.c:housekeeping_any_cpu() {
> 	if (static_branch_unlikely(&housekeeping_overridden)) {
> 		if (housekeeping.flags & BIT(type)) {
> 			cpu = sched_numa_find_closest(housekeeping_cpumask(type), smp_processor_id());
> 			if (cpu < nr_cpu_ids)
> 				return cpu;
> 
> 			cpu = cpumask_any_and_distribute(housekeeping_cpumask(type), cpu_online_mask);
> }
> 
> That path still passes smp_processor_id() to sched_numa_find_closest(), and
> both sched_numa_find_closest() (under rcu_read_lock(), which remains
> preemptible on CONFIG_PREEMPT_RCU kernels) and the fallback call
> cpumask_any_and_distribute(), which uses __this_cpu_read() and
> __this_cpu_write() on distribute_cpu_mask_prev.  A preemptible caller such
> as ring_buffer_poll_remote() -> rb_wakeups() -> rb_irq_work_queue() on a
> system booted with nohz_full= will therefore still hit smp_processor_id()
> and __this_cpu_read() preemption splats.
> 

Hmm, I wonder if we should add a preempt_disable() to the above in case
that needs to keep on the same CPU for that logic.

I still do not see the point of having this function in general have to be
called with preemption disabled.

-- Steve



      reply	other threads:[~2026-11-27 22:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 22:10 [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id() Steven Rostedt
2026-11-27 22:16 ` sashiko-bot
2026-11-27 22:23   ` Steven Rostedt [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=20261127172352.4e3ef0f6@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tglx@linutronix.de \
    /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