LOCAL / arm64: fpsimd: Restore FPSIMD state always.
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Thu, 23 Apr 2015 12:47:40 +0000 (21:47 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:44:19 +0000 (13:44 +0900)
From patch '005f78cd : arm64: defer reloading a task's FPSIMD state~'
it restores FPSIMD state conditionally. However this also blocks
restoring when CPU wakes up from sleep if condition's satisfied.
It needs to restore the state always when system wakes from suspend.
Otherwise it causes unexpected result when it returns to userland.
This patch stops conditional restoring temporary until it is resolved.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
arch/arm64/kernel/fpsimd.c

index c31e59f..c67fec5 100644 (file)
@@ -142,13 +142,21 @@ void fpsimd_thread_switch(struct task_struct *next)
                 * the TIF_FOREIGN_FPSTATE flag so the state will be loaded
                 * upon the next return to userland.
                 */
-               struct fpsimd_state *st = &next->thread.fpsimd_state;
-
-               if (__this_cpu_read(fpsimd_last_state) == st
-                   && st->cpu == smp_processor_id())
-                       clear_ti_thread_flag(task_thread_info(next),
-                                            TIF_FOREIGN_FPSTATE);
-               else
+               /**
+                * FIXME:
+                * FPSIMD state should be restored when CPU wakes up from sleep.
+                * currently, following conditional restoring results abnormal
+                * behavior of userland because of loosing last context.
+                * Until this issue is resolved, restores FPSIMD state always.
+                *
+                * struct fpsimd_state *st = &next->thread.fpsimd_state;
+                *
+                * if (__this_cpu_read(fpsimd_last_state) == st
+                *   && st->cpu == smp_processor_id())
+                *      clear_ti_thread_flag(task_thread_info(next),
+                *                           TIF_FOREIGN_FPSTATE);
+                *  else
+                */
                        set_ti_thread_flag(task_thread_info(next),
                                           TIF_FOREIGN_FPSTATE);
        }