public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Frederic Weisbecker <frederic@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: [PATCH] timers/migration: Fix ignored event due to missing CPU update
Date: Tue, 02 Apr 2024 11:52:23 +0200	[thread overview]
Message-ID: <87r0fo9jmw.fsf@somnus> (raw)
In-Reply-To: <20240401214859.11533-1-frederic@kernel.org>

Frederic Weisbecker <frederic@kernel.org> writes:

> When a group event is updated with its expiry unchanged but a different
> CPU, that target change may go unnoticed and the event may be propagated
> up with a stale CPU value. The following depicts a scenario that has
> been actually observed:

urgh...

>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> ---
>  kernel/time/timer_migration.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
> index c63a0afdcebe..90786bb9a607 100644
> --- a/kernel/time/timer_migration.c
> +++ b/kernel/time/timer_migration.c
> @@ -762,8 +762,11 @@ bool tmigr_update_events(struct tmigr_group *group, struct tmigr_group *child,
>  	 * queue when the expiry time changed only or when it could be ignored.
>  	 */
>  	if (timerqueue_node_queued(&evt->nextevt)) {
> -		if ((evt->nextevt.expires == nextexp) && !evt->ignore)
> +		if ((evt->nextevt.expires == nextexp) && !evt->ignore) {
> +			if (evt->cpu != first_childevt->cpu)
> +				evt->cpu = first_childevt->cpu;

Why not just unconditionally overwriting the evt->cpu value here?

>  			goto check_toplvl;
> +		}
>  
>  		if (!timerqueue_del(&group->events, &evt->nextevt))
>  			WRITE_ONCE(group->next_expiry, KTIME_MAX);

Thanks,

        Anna-Maria


  parent reply	other threads:[~2024-04-02  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01 21:48 [PATCH] timers/migration: Fix ignored event due to missing CPU update Frederic Weisbecker
2024-04-01 22:18 ` Frederic Weisbecker
2024-04-02  9:52 ` Anna-Maria Behnsen [this message]
2024-04-03 16:24   ` [PATCH v2] " Frederic Weisbecker
2024-04-04 16:52     ` Anna-Maria Behnsen
2024-04-05  9:11     ` [tip: timers/urgent] " 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=87r0fo9jmw.fsf@somnus \
    --to=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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