@@ -136,9 +136,19 @@ static void flush_tmregs_to_thread(struct task_struct *tsk)
if ((!cpu_has_feature(CPU_FTR_TM)) || (tsk != current))
return;
- if (MSR_TM_SUSPENDED(mfmsr())) {
- tm_reclaim_current(TM_CAUSE_SIGNAL);
- } else {
+ if (WARN_ON(MSR_TM_SUSPENDED(mfmsr()))) {
+ /*
+ * We should never be here in suspended state. This is a
+ * bug!
+ */
+ tm_reclaim_current(0x99);
+ }
+ if (tsk->thread.regs->msr & MSR_TM) {
+ /*
+ * Only flush TM SPRs to the thread if TM was enabled,
+ * otherwise (TM lazily disabled), the thread already
+ * contains the latest SPR value
+ */
tm_enable();
tm_save_sprs(&(tsk->thread));
}
Make sure that we are not suspended on ptrace and that the registers were already reclaimed. Since the data was already reclaimed, there is nothing to be done here except to restore the SPRs. Signed-off-by: Breno Leitao <leitao@debian.org> --- arch/powerpc/kernel/ptrace.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)