Merge tag 'v3.10.103' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / powerpc / kernel / process.c
index 1e1c995ddacc4a89b716010ac62124b1b95eb962..a5e339806589d1bfe283f6d87346b3ca354d18a4 100644 (file)
@@ -948,6 +948,16 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
        flush_altivec_to_thread(src);
        flush_vsx_to_thread(src);
        flush_spe_to_thread(src);
+       /*
+       * Flush TM state out so we can copy it.  __switch_to_tm() does this
+       * flush but it removes the checkpointed state from the current CPU and
+       * transitions the CPU out of TM mode.  Hence we need to call
+       * tm_recheckpoint_new_task() (on the same task) to restore the
+       * checkpointed state back and the TM mode.
+       */
+       __switch_to_tm(src);
+       tm_recheckpoint_new_task(src);
+
        *dst = *src;
        return 0;
 }
@@ -1078,6 +1088,16 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
                current->thread.regs = regs - 1;
        }
 
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+       /*
+        * Clear any transactional state, we're exec()ing. The cause is
+        * not important as there will never be a recheckpoint so it's not
+        * user visible.
+        */
+       if (MSR_TM_SUSPENDED(mfmsr()))
+               tm_reclaim_current(0);
+#endif
+
        memset(regs->gpr, 0, sizeof(regs->gpr));
        regs->ctr = 0;
        regs->link = 0;