From: Frederic Weisbecker <frederic@kernel.org>
To: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] timer_migration: Fix possible race in tmigr_active_up() in setup path
Date: Tue, 25 Jun 2024 00:24:36 +0200 [thread overview]
Message-ID: <ZnnyJPPTm8NHqPbf@pavilion.home> (raw)
In-Reply-To: <Znnst52fdxIeBats@pavilion.home>
Le Tue, Jun 25, 2024 at 12:01:27AM +0200, Frederic Weisbecker a écrit :
> > +static void tmigr_setup_active_up(struct tmigr_group *group, struct tmigr_group *child)
> > +{
> > + union tmigr_state curstate, childstate;
> > + bool walk_done;
> > +
> > + /*
> > + * Memory barrier is paired with the cmpxchg in tmigr_inactive_up() to
> > + * make sure updates of child and group states are ordered. The ordering
> > + * is mandatory, as the update of the group state is only valid for when
> > + * child state is active.
> > + */
> > + curstate.state = atomic_read_acquire(&group->migr_state);
> > +
> > + for (;;) {
>
> /*
> * If the child hasn't yet propagated anything to the top level, the above
> * acquire has no effect. However thanks to child locking (see comment in
> * tmigr_connect_child_parent()), either the latest child->migr_state is
> * observed or the remote CPU now observes the new parent and is about to
> * propagate to the new parent. In the latter case it will either beat the
> * current trial update or overwrite it.
> */
>
> And another comment later:
>
> > + childstate.state = atomic_read(&child->migr_state);
> > + if (!childstate.active)
> > + return;
Hmm, on the other hand the remote group doesn't use locking if some tmc activates
after that and so there is no guarantee it will see the new parent. Does it
matter?
Thanks.
next prev parent reply other threads:[~2024-06-24 22:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 14:53 [PATCH v2 0/5] timer_migration: Fix two possible races and an improvement Anna-Maria Behnsen
2024-06-24 14:53 ` [PATCH v2 1/5] timer_migration: Do not rely always on group->parent Anna-Maria Behnsen
2024-06-24 20:29 ` Frederic Weisbecker
2024-06-24 14:53 ` [PATCH v2 2/5] timer_migration: Improve tracing Anna-Maria Behnsen
2024-06-24 20:37 ` Frederic Weisbecker
2024-06-24 14:53 ` [PATCH v2 3/5] timer_migration: Split out state update of tmigr_active_up() Anna-Maria Behnsen
2024-06-24 20:42 ` Frederic Weisbecker
2024-06-24 14:53 ` [PATCH v2 4/5] timer_migration: Fix possible race in tmigr_active_up() in setup path Anna-Maria Behnsen
2024-06-24 22:01 ` Frederic Weisbecker
2024-06-24 22:24 ` Frederic Weisbecker [this message]
2024-06-24 14:53 ` [PATCH v2 5/5] timer_migration: Spare write when nothing changed Anna-Maria Behnsen
2024-06-24 22:08 ` Frederic Weisbecker
2024-06-25 0:00 ` [PATCH v2 0/5] timer_migration: Fix two possible races and an improvement 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=ZnnyJPPTm8NHqPbf@pavilion.home \
--to=frederic@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=linux-kernel@vger.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