powerpc/tm: Drop tm_orig_msr from thread_struct
authorAnshuman Khandual <khandual@linux.vnet.ibm.com>
Mon, 6 Jul 2015 10:54:10 +0000 (16:24 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 16 Jul 2015 06:02:37 +0000 (16:02 +1000)
Currently tm_orig_msr is getting used during process context switch only.
Then there is ckpt_regs which saves the checkpointed userspace context
The MSR slot contained in ckpt_regs structure can be used during process
context switch instead of tm_orig_msr, thus allowing us to drop it from
thread_struct structure. This patch does that change.

Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/process.c

index 28ded5d9b57961b7be7b9265cf1f334a5a79395e..5afea361beaae9ee917b38bca3ece1d5a070166a 100644 (file)
@@ -264,7 +264,6 @@ struct thread_struct {
        u64             tm_tfhar;       /* Transaction fail handler addr */
        u64             tm_texasr;      /* Transaction exception & summary */
        u64             tm_tfiar;       /* Transaction fail instr address reg */
-       unsigned long   tm_orig_msr;    /* Thread's MSR on ctx switch */
        struct pt_regs  ckpt_regs;      /* Checkpointed registers */
 
        unsigned long   tm_tar;
index 8005e18d1b40381f6b815890b0d58c99a382b4e8..99adcbad36906ccbcb9f2181f3539b7fd3a5113e 100644 (file)
@@ -86,7 +86,7 @@ void giveup_fpu_maybe_transactional(struct task_struct *tsk)
        if (tsk == current && tsk->thread.regs &&
            MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
            !test_thread_flag(TIF_RESTORE_TM)) {
-               tsk->thread.tm_orig_msr = tsk->thread.regs->msr;
+               tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
                set_thread_flag(TIF_RESTORE_TM);
        }
 
@@ -104,7 +104,7 @@ void giveup_altivec_maybe_transactional(struct task_struct *tsk)
        if (tsk == current && tsk->thread.regs &&
            MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
            !test_thread_flag(TIF_RESTORE_TM)) {
-               tsk->thread.tm_orig_msr = tsk->thread.regs->msr;
+               tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
                set_thread_flag(TIF_RESTORE_TM);
        }
 
@@ -543,7 +543,7 @@ static void tm_reclaim_thread(struct thread_struct *thr,
         * the thread will no longer be transactional.
         */
        if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) {
-               msr_diff = thr->tm_orig_msr & ~thr->regs->msr;
+               msr_diff = thr->ckpt_regs.msr & ~thr->regs->msr;
                if (msr_diff & MSR_FP)
                        memcpy(&thr->transact_fp, &thr->fp_state,
                               sizeof(struct thread_fp_state));
@@ -594,10 +594,10 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
        /* Stash the original thread MSR, as giveup_fpu et al will
         * modify it.  We hold onto it to see whether the task used
         * FP & vector regs.  If the TIF_RESTORE_TM flag is set,
-        * tm_orig_msr is already set.
+        * ckpt_regs.msr is already set.
         */
        if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM))
-               thr->tm_orig_msr = thr->regs->msr;
+               thr->ckpt_regs.msr = thr->regs->msr;
 
        TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, "
                 "ccr=%lx, msr=%lx, trap=%lx)\n",
@@ -666,7 +666,7 @@ static inline void tm_recheckpoint_new_task(struct task_struct *new)
                tm_restore_sprs(&new->thread);
                return;
        }
-       msr = new->thread.tm_orig_msr;
+       msr = new->thread.ckpt_regs.msr;
        /* Recheckpoint to restore original checkpointed register state. */
        TM_DEBUG("*** tm_recheckpoint of pid %d "
                 "(new->msr 0x%lx, new->origmsr 0x%lx)\n",
@@ -726,7 +726,7 @@ void restore_tm_state(struct pt_regs *regs)
        if (!MSR_TM_ACTIVE(regs->msr))
                return;
 
-       msr_diff = current->thread.tm_orig_msr & ~regs->msr;
+       msr_diff = current->thread.ckpt_regs.msr & ~regs->msr;
        msr_diff &= MSR_FP | MSR_VEC | MSR_VSX;
        if (msr_diff & MSR_FP) {
                fp_enable();