Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/tm: Drop tm_orig_msr from thread_struct

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>

authored by

Anshuman Khandual and committed by
Michael Ellerman
829023df bd664f89

+7 -8
-1
arch/powerpc/include/asm/processor.h
··· 264 264 u64 tm_tfhar; /* Transaction fail handler addr */ 265 265 u64 tm_texasr; /* Transaction exception & summary */ 266 266 u64 tm_tfiar; /* Transaction fail instr address reg */ 267 - unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ 268 267 struct pt_regs ckpt_regs; /* Checkpointed registers */ 269 268 270 269 unsigned long tm_tar;
+7 -7
arch/powerpc/kernel/process.c
··· 86 86 if (tsk == current && tsk->thread.regs && 87 87 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 88 88 !test_thread_flag(TIF_RESTORE_TM)) { 89 - tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 89 + tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr; 90 90 set_thread_flag(TIF_RESTORE_TM); 91 91 } 92 92 ··· 104 104 if (tsk == current && tsk->thread.regs && 105 105 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 106 106 !test_thread_flag(TIF_RESTORE_TM)) { 107 - tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 107 + tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr; 108 108 set_thread_flag(TIF_RESTORE_TM); 109 109 } 110 110 ··· 543 543 * the thread will no longer be transactional. 544 544 */ 545 545 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) { 546 - msr_diff = thr->tm_orig_msr & ~thr->regs->msr; 546 + msr_diff = thr->ckpt_regs.msr & ~thr->regs->msr; 547 547 if (msr_diff & MSR_FP) 548 548 memcpy(&thr->transact_fp, &thr->fp_state, 549 549 sizeof(struct thread_fp_state)); ··· 594 594 /* Stash the original thread MSR, as giveup_fpu et al will 595 595 * modify it. We hold onto it to see whether the task used 596 596 * FP & vector regs. If the TIF_RESTORE_TM flag is set, 597 - * tm_orig_msr is already set. 597 + * ckpt_regs.msr is already set. 598 598 */ 599 599 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM)) 600 - thr->tm_orig_msr = thr->regs->msr; 600 + thr->ckpt_regs.msr = thr->regs->msr; 601 601 602 602 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " 603 603 "ccr=%lx, msr=%lx, trap=%lx)\n", ··· 666 666 tm_restore_sprs(&new->thread); 667 667 return; 668 668 } 669 - msr = new->thread.tm_orig_msr; 669 + msr = new->thread.ckpt_regs.msr; 670 670 /* Recheckpoint to restore original checkpointed register state. */ 671 671 TM_DEBUG("*** tm_recheckpoint of pid %d " 672 672 "(new->msr 0x%lx, new->origmsr 0x%lx)\n", ··· 726 726 if (!MSR_TM_ACTIVE(regs->msr)) 727 727 return; 728 728 729 - msr_diff = current->thread.tm_orig_msr & ~regs->msr; 729 + msr_diff = current->thread.ckpt_regs.msr & ~regs->msr; 730 730 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX; 731 731 if (msr_diff & MSR_FP) { 732 732 fp_enable();