[PATCH] arm64/sve: Rework SVE access trap to convert state in registers

Catalin Marinas catalin.marinas at arm.com
Thu Apr 8 17:43:27 BST 2021


On Wed, Apr 07, 2021 at 01:48:06PM +0100, Mark Brown wrote:
> On Wed, Apr 07, 2021 at 12:45:12PM +0100, Catalin Marinas wrote:
> > The other case is TIF_FOREIGN_FPSTATE being set in do_sve_acc(). Since
> > we never return to user with this flag set, when can we actually hit the
> > 'else' path in your patch?
> 
> We'd have to have been preempted between entering the kernel and
> actually handling the access trap, I can't think of a scenario where
> that would happen but it seemed easier to have the code to handle it
> than to make absolutely sure that there was no possible case that I was
> missing.  I think we should have the detection code either way in case
> it does end up happening somehow but it could be changed to use
> WARN_ON_ONCE() or something instead of silently handling it?

If we get preempted before do_sve_acc() (and that's possible as the
interrupts are enabled), if the interrupted thread wakes up on another
CPU it will have TIF_FOREIGN_FPSTATE set so that it retrieves the new
state.

So the patch looks fine to me.

-- 
Catalin



More information about the linux-arm-kernel mailing list