From: Catalin Marinas <catalin.marinas@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] arm64/fpsimd: Ensure we don't contend a SMCU from idling CPUs
Date: Thu, 5 Sep 2024 18:51:30 +0100 [thread overview]
Message-ID: <Ztnvosf0JHsvCf7-@arm.com> (raw)
In-Reply-To: <Zo8ZDBisWJonBVqF@finisterre.sirena.org.uk>
(replying to the previous version as it looks like I haven't followed up
on the discussion)
On Thu, Jul 11, 2024 at 12:28:12AM +0100, Mark Brown wrote:
> On Wed, Jul 10, 2024 at 09:10:53PM +0100, Catalin Marinas wrote:
> > On Tue, Jun 18, 2024 at 02:57:42PM +0100, Mark Brown wrote:
> > > + /*
> > > + * Leaving SME enabled may leave this core contending with
> > > + * other cores if we have a SMCU, disable whenever we enter
> > > + * idle to avoid this. Only do this if they're actually
> > > + * enabled to avoid overhead in cases where we don't enter a
> > > + * low enough power state to loose register state.
> > > + */
> > > + if (system_supports_sme() &&
> > > + (read_sysreg_s(SYS_SVCR) & (SVCR_SM_MASK | SVCR_ZA_MASK)))
> > > + fpsimd_save_and_flush_cpu_state();
> > > +}
>
> > Do we always enter here via the idle thread? If we already had a thread
> > switch we probably don't need to save the SME state again, only flush
> > the state.
>
> If we've actually switched the thread then TIF_FOREIGN_FPSTATE has been
> set and we'll just check the flag and return for the save portion rather
> than actually writing any register values out so the overhead should be
> minimal. It feels safer to check in case we get better at doing the
> save lazily.
OK, so likely the state is already saved, all we need to do here is
flush the state and SMSTOP. But why would switching to idle be any
different than switching to a thread that doesn't used SME? It feels
like we are just trying to optimise a special case only. Could we not
instead issue an SMSTOP in the context switch code?
Also this looks hypothetical until we have some hardware to test it on,
see how it would behave with a shared SME unit.
--
Catalin
next prev parent reply other threads:[~2024-09-05 17:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 13:57 [PATCH] arm64/fpsimd: Ensure we don't contend a SMCU from idling CPUs Mark Brown
2024-07-10 20:10 ` Catalin Marinas
2024-07-10 23:28 ` Mark Brown
2024-09-05 17:51 ` Catalin Marinas [this message]
2024-09-05 18:34 ` Mark Brown
2024-09-06 14:56 ` Catalin Marinas
2024-09-06 17:16 ` Mark Brown
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=Ztnvosf0JHsvCf7-@arm.com \
--to=catalin.marinas@arm.com \
--cc=broonie@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).