From: Thomas Gleixner <tglx@linutronix.de>
To: Imran Khan <imran.f.khan@oracle.com>,
anna-maria@linutronix.de, frederic@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] timers: WARN if add_timer_on is used with offlined cpu.
Date: Wed, 15 Jan 2025 15:39:47 +0100 [thread overview]
Message-ID: <87wmewb0p8.ffs@tglx> (raw)
In-Reply-To: <20250115134111.2703089-2-imran.f.khan@oracle.com>
On Thu, Jan 16 2025 at 00:41, Imran Khan wrote:
> timer started on an offlined cpu will not fire after
> its expiry time and may never fire if that cpu remains
> offline.
> So add a WARN_ON_ONCE in add_timer_on, to indicate
> if any of its users are (wrongly) starting a timer
> on an offlined cpu.
>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
> ---
> kernel/time/timer.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index a5860bf6d16f9..ec9eb58e45241 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -1370,6 +1370,12 @@ void add_timer_on(struct timer_list *timer, int cpu)
> if (!timer->function)
> goto out_unlock;
>
> + /*
> + * WARN if specified cpu is offline, because on offlined cpu
> + * timer will not fire even after its expiry.
> + */
> + WARN_ON_ONCE(!cpu_online(cpu));
Then why queueing the timer in the first place?
Thanks,
tglx
next prev parent reply other threads:[~2025-01-15 14:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 13:41 [PATCH 0/2] Handle timers added to offlined CPU(s) Imran Khan
2025-01-15 13:41 ` [PATCH 1/2] timers: WARN if add_timer_on is used with offlined cpu Imran Khan
2025-01-15 14:39 ` Thomas Gleixner [this message]
2025-01-15 15:10 ` imran.f.khan
2025-01-15 13:41 ` [PATCH 2/2] timers: introduce timer_try_add_on_cpu Imran Khan
2025-01-15 16:04 ` Thomas Gleixner
2025-01-15 17:00 ` imran.f.khan
2025-01-28 3:36 ` imran.f.khan
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=87wmewb0p8.ffs@tglx \
--to=tglx@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=imran.f.khan@oracle.com \
--cc=linux-kernel@vger.kernel.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