[PATCH 4/6] arm64/signal: Consistently invalidate the in register FP state in restore
Mark Brown
broonie at kernel.org
Tue Dec 3 08:53:11 PST 2024
On Tue, Dec 03, 2024 at 03:34:01PM +0000, Dave Martin wrote:
> On Tue, Dec 03, 2024 at 12:45:56PM +0000, Mark Brown wrote:
> > When restoring the SVE and SME specific floating point register states we
> > flush the task floating point state, marking the hardware state as stale so
> > that preemption does not result in us saving register state from the signal
Now I think about it again this should probably be dropped from the
series, or at least ordered after the reenablement.
> > + * thread floating point state with preemption enabled, so
> > + * protection is needed to prevent a racing context switch
> > + * from writing stale registers back over the new data. Mark
> > + * the register floating point state as invalid and unbind the
> > + * task from the CPU to force a reload before we return to
> > + * userspace. fpsimd_flush_task_state() has a check for FP
> > + * support.
> > + */
> Maybe add a comment in fpsimd_flush_task_state() about why the
> system_supports_fpsimd() check is important? It's not obvious there
> why we should ever be calling that function on non-FPSIMD systems.
There already is a comment in there about it?
> But would it be a good idea to stick a
> WARN_ON(!test_thread_flag(TIF_FOREIGN_FPSTATE)) at the start of the
> functions that rely on this?
As I mentioned in reply to one of your other messages I want to just gut
the whole API here and replace it with get/put functions for the state
which would include the get/put functions making sure they're paired
with each other.
Please delete unneeded context from mails when replying. Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20241203/595016b4/attachment.sig>
More information about the linux-arm-kernel
mailing list