All of lore.kernel.org
 help / color / mirror / Atom feed
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, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2 0/5] timer_migration: Fix two possible races and an improvement
Date: Tue, 25 Jun 2024 02:00:20 +0200	[thread overview]
Message-ID: <ZnoIlO22habOyQRe@lothringen> (raw)
In-Reply-To: <20240624-tmigr-fixes-v2-0-3eb4c0604790@linutronix.de>

On Mon, Jun 24, 2024 at 04:53:52PM +0200, Anna-Maria Behnsen wrote:
> Borislav reported a warning in timer migration deactive path
> 
>   https://lore.kernel.org/r/20240612090347.GBZmlkc5PwlVpOG6vT@fat_crate.local
> 
> Sadly it doesn't reproduce directly. But with the change of timing (by
> adding a trace prinkt before the warning), it is possible to trigger the
> warning reliable at least in my test setup. The problem here is a racy
> check agains group->parent pointer. This is also used in other places in
> the code and fixing this racy usage is adressed by the first patch.
> 
> There was another race reported by Frederic in setup path:
> 
>   https://lore.kernel.org/r/ZnWOswTMML6ShzYO@localhost.localdomain
> 
> It is addressed patch 2-4. Patch 2 is an already existing patch of v1
> (improve tracing) and makes the fix easier. Patch 3 is also a preparation
> patch for the final fix and Patch 4 is then the real fix. (I labelled all
> those three patches with Fixes tag to be easier selectable.)
> 
> While working with the code, I saw that the update of per cpu group wakeup
> value could be improved. This improvement is adressed by the last patch.

Another possible issue with the CPU up code is the fact that child->parent and
child->childmask updates and reads are unordered.

So it's possible that a CPU going (in-)active sees the new parent but doesn't
observe yet the update to child->childmask. This may result to calling
tmigr_(in-)active_up() with a zero data->childmask with all sorts of
consequences.

Or am I missing something that prevents from that?

Thanks.

      parent reply	other threads:[~2024-06-25  0:00 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
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 ` Frederic Weisbecker [this message]

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=ZnoIlO22habOyQRe@lothringen \
    --to=frederic@kernel.org \
    --cc=anna-maria@linutronix.de \
    --cc=bp@alien8.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.