]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/tm: Fix FP and VMX register corruption
authorMichael Neuling <mikey@neuling.org>
Mon, 8 May 2017 07:16:26 +0000 (17:16 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 15 May 2017 09:31:38 +0000 (19:31 +1000)
commita5f1e55d9ba74f6979d63c6bfe7005368e09a2d2
tree15b1039104618f970172dccf1af43f042eb38989
parent768976c09db8b7ac049962418de39912329d6d8d
powerpc/tm: Fix FP and VMX register corruption

In commit d1a595dd480b ("powerpc: tm: Always use fp_state and vr_state
to store live registers"), a section of code was removed that copied
the current state to checkpointed state. That code should not have been
removed.

When an FP (Floating Point) unavailable is taken inside a transaction,
we need to abort the transaction. This is because at the time of the
tbegin, the FP state is bogus so the state stored in the checkpointed
registers is incorrect. To fix this, we treclaim (to get the
checkpointed GPRs) and then copy the thread_struct FP live state into
the checkpointed state. We then trecheckpoint so that the FP state is
correctly restored into the CPU.

The copying of the FP registers from live to checkpointed is what was
missing.

This simplifies the logic slightly from the original patch.
tm_reclaim_thread() will now always write the checkpointed FP
state. Either the checkpointed FP state will be written as part of
the actual treclaim (in tm.S), or it'll be a copy of the live
state. Which one we use is based on MSR[FP] from userspace.

Similarly for VMX.

Fixes: d1a595dd480b ("powerpc: tm: Always use fp_state and vr_state to store live registers")
Cc: stable@vger.kernel.org # 4.9+
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: cyrilbur@gmail.com
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/process.c