mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Walter Chang (張維哲)" <Walter.Chang@mediatek.com>
To: "frederic@kernel.org" <frederic@kernel.org>
Cc: wsd_upstream <wsd_upstream@mediatek.com>,
	"boqun.feng@gmail.com" <boqun.feng@gmail.com>,
	"vlad.wing@gmail.com" <vlad.wing@gmail.com>,
	"Cheng-Jui Wang (王正睿)" <Cheng-Jui.Wang@mediatek.com>,
	"kernel-team@meta.com" <kernel-team@meta.com>,
	"Alex Hoh (賀振坤)" <Alex.Hoh@mediatek.com>,
	"usamaarif642@gmail.com" <usamaarif642@gmail.com>,
	"anna-maria@linutronix.de" <anna-maria@linutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"neeraj.upadhyay@amd.com" <neeraj.upadhyay@amd.com>,
	"leitao@debian.org" <leitao@debian.org>,
	"Freddy Hsin (辛恒豐)" <Freddy.Hsin@mediatek.com>,
	"urezki@gmail.com" <urezki@gmail.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"qiang.zhang1211@gmail.com" <qiang.zhang1211@gmail.com>,
	"paulmck@kernel.org" <paulmck@kernel.org>,
	"Xinghua Yang (杨兴华)" <Xinghua.Yang@mediatek.com>,
	"joel@joelfernandes.org" <joel@joelfernandes.org>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
	"Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>
Subject: Re: [PATCH v4] hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
Date: Tue, 1 Apr 2025 05:27:45 +0000	[thread overview]
Message-ID: <75585b6fe937a23e380b5d61df4932e8e87f3485.camel@mediatek.com> (raw)
In-Reply-To: <Z-Qu0stgvwHF9n3q@localhost.localdomain>

On Wed, 2025-03-26 at 17:44 +0100, Frederic Weisbecker wrote:
> 
> It's not the first time I get such a report on an out of tree
> kernel. The problem is I don't know if the tainted modules are
> involved. But something is probably making an offline CPU visible
> within
> the hierarchy on get_nohz_timer_target(). And that new warning made
> that visible.
> 
> Can you try this and tell us if the warning fires?
> 
> Thanks.
> 
> diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h
> index 6d67e9a5af6b..f49512628269 100644
> --- a/include/linux/sched/nohz.h
> +++ b/include/linux/sched/nohz.h
> @@ -9,6 +9,7 @@
>  #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
>  extern void nohz_balance_enter_idle(int cpu);
>  extern int get_nohz_timer_target(void);
> +extern void assert_domain_online(void);
>  #else
>  static inline void nohz_balance_enter_idle(int cpu) { }
>  #endif
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 07455d25329c..98c8f8408403 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -13,6 +13,7 @@
>  #include <linux/sched/isolation.h>
>  #include <linux/sched/task.h>
>  #include <linux/sched/smt.h>
> +#include <linux/sched/nohz.h>
>  #include <linux/unistd.h>
>  #include <linux/cpu.h>
>  #include <linux/oom.h>
> @@ -1277,6 +1278,7 @@ static int take_cpu_down(void *_param)
>         if (err < 0)
>                 return err;
> 
> +       assert_domain_online();
>         /*
>          * Must be called from CPUHP_TEARDOWN_CPU, which means, as we
> are going
>          * down, that the current state is CPUHP_TEARDOWN_CPU - 1.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 175a5a7ac107..88157b1645cc 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1163,6 +1163,20 @@ void resched_cpu(int cpu)
> 
>  #ifdef CONFIG_SMP
>  #ifdef CONFIG_NO_HZ_COMMON
> +void assert_domain_online(void)
> +{
> +       int cpu = smp_processor_id();
> +       int i;
> +       struct sched_domain *sd;
> +
> +       guard(rcu)();
> +
> +       for_each_domain(cpu, sd) {
> +               for_each_cpu(i, sched_domain_span(sd)) {
> +                       WARN_ON_ONCE(cpu_is_offline(i));
> +               }
> +       }
> +}
>  /*
>   * In the semi idle case, use the nearest busy CPU for migrating
> timers
>   * from an idle CPU.  This is good for power-savings.

Hi Frederic,

Thank you for providing the patch to debug the hrtimer warning issue.

I have applied the patch and conducted stress testing over the weekend.
And the warning provided in the patch did not occur during this period.

Additionally, after a thorough review of our internal tainted modules,
I can confirm that you are correct in your assessment. The
get_nohz_timer_target() with our tainted modules may indeed return a
CPU that is offline, leading to the hrtimer warning issue. We are
working on fixing this within our tainted modules.

Thanks again for your help in debugging this issue.

Best regards,
Walter Chang


  reply	other threads:[~2025-04-01  5:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 23:24 Frederic Weisbecker
2025-01-21 17:08 ` Paul E. McKenney
2025-03-26  5:46   ` Walter Chang (張維哲)
2025-03-26 16:44     ` Frederic Weisbecker
2025-04-01  5:27       ` Walter Chang (張維哲) [this message]
2025-04-02  6:53       ` Kuyo Chang (張建文)
2025-04-02 12:15         ` Frederic Weisbecker
2025-01-23 10:57 ` [tip: timers/urgent] " tip-bot2 for Frederic Weisbecker
2025-01-23 19:13 ` tip-bot2 for Frederic Weisbecker

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=75585b6fe937a23e380b5d61df4932e8e87f3485.camel@mediatek.com \
    --to=walter.chang@mediatek.com \
    --cc=Alex.Hoh@mediatek.com \
    --cc=Cheng-Jui.Wang@mediatek.com \
    --cc=Chun-hung.Wu@mediatek.com \
    --cc=Freddy.Hsin@mediatek.com \
    --cc=Xinghua.Yang@mediatek.com \
    --cc=anna-maria@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraj.upadhyay@amd.com \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=urezki@gmail.com \
    --cc=usamaarif642@gmail.com \
    --cc=vlad.wing@gmail.com \
    --cc=wsd_upstream@mediatek.com \
    /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®