linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: linuxppc-dev@lists.ozlabs.org
Cc: Breno Leitao <leitao@debian.org>
Subject: [PATCH v2 4/4] powerpc/tm: Do not recheckpoint non-tm task
Date: Mon, 18 Jun 2018 19:59:44 -0300	[thread overview]
Message-ID: <1529362784-14194-4-git-send-email-leitao@debian.org> (raw)
In-Reply-To: <1529362784-14194-1-git-send-email-leitao@debian.org>

If __switch_to() tries to context switch from task A to task B, and task A
 had task->thread->regs->msr[TM] enabled, then __switch_to_tm() will call
tm_recheckpoint_new_task(), which will call trecheckpoint, for task B, which
 is clearly wrong since task B might not be an active TM user.

This does not cause a lot of damage because tm_recheckpoint() will abort
the call since it realize that the current task does not have msr[TM] bit
set.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 arch/powerpc/kernel/process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f8beee03f00a..d26a150766ef 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1036,7 +1036,8 @@ static inline void __switch_to_tm(struct task_struct *prev,
 				prev->thread.regs->msr &= ~MSR_TM;
 		}
 
-		tm_recheckpoint_new_task(new);
+		if (tm_enabled(new))
+			tm_recheckpoint_new_task(new);
 	}
 }
 
-- 
2.16.3

  parent reply	other threads:[~2018-06-18 23:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 17:37 [PATCH 1/3] powerpc/tm: Remove msr_tm_active() Breno Leitao
2018-06-15 17:42 ` [PATCH 2/3] powerpc/tm: Fix HTM documentation Breno Leitao
2018-06-15 17:42   ` [PATCH 3/3] powerpc/tm: Remove struct thread_info param from tm_reclaim_thread() Breno Leitao
2018-06-15 20:06 ` [PATCH 1/3] powerpc/tm: Remove msr_tm_active() kbuild test robot
2018-06-18 22:59   ` [PATCH v2 1/4] " Breno Leitao
2018-06-18 22:59     ` [PATCH v2 2/4] powerpc/tm: Fix HTM documentation Breno Leitao
2018-08-15 23:46       ` Michael Neuling
2018-09-20  4:20       ` [v2,2/4] " Michael Ellerman
2018-06-18 22:59     ` [PATCH v2 3/4] powerpc/tm: Adjust tm_reclaim_thread() parameters Breno Leitao
2018-08-15 23:48       ` Michael Neuling
2018-06-18 22:59     ` Breno Leitao [this message]
2018-08-15 23:50       ` [PATCH v2 4/4] powerpc/tm: Do not recheckpoint non-tm task Michael Neuling
2018-08-16 14:19         ` Breno Leitao
2018-08-15 23:46     ` [PATCH v2 1/4] powerpc/tm: Remove msr_tm_active() Michael Neuling
2018-08-16 17:21       ` [PATCH v3] " Breno Leitao
2018-10-04  6:14         ` [v3] " Michael Ellerman
2018-08-17  0:49       ` [PATCH v2 1/4] " Michael Ellerman
2018-08-17 12:26         ` Breno Leitao
2018-08-21  6:33           ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1529362784-14194-4-git-send-email-leitao@debian.org \
    --to=leitao@debian.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).