[PATCH v2] timers/migration: Fix ignored event due to missing CPU update
From: Frederic Weisbecker
Date: Wed Apr 03 2024 - 12:24:53 EST
Le Tue, Apr 02, 2024 at 11:52:23AM +0200, Anna-Maria Behnsen a écrit :
> Frederic Weisbecker <frederic@xxxxxxxxxx> 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@xxxxxxxxxx>
> > ---
> > 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?
Right! See below:
---