Skip to content

Commit 7c68a9c

Browse files
mrvl-leoywildea01
authored andcommitted
arm64: fix bug for reloading FPSIMD state after cpu power off
Now arm64 defers reloading FPSIMD state, but this optimization also introduces the bug after cpu resume back from low power mode. The reason is after the cpu has been powered off, s/w need set the cpu's fpsimd_last_state to NULL so that it will force to reload FPSIMD state for the thread, otherwise there has the chance to meet the condition for both the task's fpsimd_state.cpu field contains the id of the current cpu, and the cpu's fpsimd_last_state per-cpu variable points to the task's fpsimd_state, so finally kernel will skip to reload the context during it return back to userland. Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Leo Yan <leoy@marvell.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 3168a74 commit 7c68a9c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎arch/arm64/kernel/fpsimd.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self,
270270
case CPU_PM_ENTER:
271271
if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE))
272272
fpsimd_save_state(&current->thread.fpsimd_state);
273+
this_cpu_write(fpsimd_last_state, NULL);
273274
break;
274275
case CPU_PM_EXIT:
275276
if (current->mm)

0 commit comments

Comments
 (0)