From patchwork Mon Jun 18 22:59:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 931225 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 418mvc4S8Gz9s3C for ; Tue, 19 Jun 2018 09:07:24 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 418mvc34mBzF0sk for ; Tue, 19 Jun 2018 09:07:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=debian.org (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=leitao@debian.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 418ml84wZkzF0tr for ; Tue, 19 Jun 2018 09:00:04 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5IMxXdh006089 for ; Mon, 18 Jun 2018 19:00:01 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jpfyvn9th-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Jun 2018 19:00:00 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Jun 2018 18:59:59 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Jun 2018 18:59:58 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5IMxvWJ65863790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Jun 2018 22:59:57 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 971A1AC065; Mon, 18 Jun 2018 19:01:14 -0400 (EDT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3109AC05B; Mon, 18 Jun 2018 19:01:13 -0400 (EDT) Received: from debra.ibm.com (unknown [9.85.175.66]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 18 Jun 2018 19:01:13 -0400 (EDT) From: Breno Leitao To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 4/4] powerpc/tm: Do not recheckpoint non-tm task Date: Mon, 18 Jun 2018 19:59:44 -0300 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1529362784-14194-1-git-send-email-leitao@debian.org> References: <201806160346.lDndh49W%fengguang.wu@intel.com> <1529362784-14194-1-git-send-email-leitao@debian.org> X-TM-AS-GCONF: 00 x-cbid: 18061822-0052-0000-0000-000003007A63 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009216; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01048961; UDB=6.00537442; IPR=6.00827935; MB=3.00021728; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-18 22:59:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061822-0053-0000-0000-00005D0F97E6 Message-Id: <1529362784-14194-4-git-send-email-leitao@debian.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-18_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=622 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806180259 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Breno Leitao Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- 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); } }