Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753573AbcDUQFv (ORCPT ); Thu, 21 Apr 2016 12:05:51 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:39677 "EHLO e06smtp11.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751662AbcDUQFu (ORCPT ); Thu, 21 Apr 2016 12:05:50 -0400 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: ldufour@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Subject: Re: [PATCH V10 00/28] Add new powerpc specific ELF core notes To: Michael Ellerman , Anshuman Khandual , linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org References: <1455613198-5113-1-git-send-email-khandual@linux.vnet.ibm.com> <57062722.5090706@linux.vnet.ibm.com> <5EA48413-85A1-4CB7-8843-CE22B2BB1F08@ellerman.id.au> <570B54EB.90507@linux.vnet.ibm.com> <1460524468.30704.5.camel@ellerman.id.au> Cc: mikey@neuling.org, james.hogan@imgtec.com, avagin@openvz.org, Paul.Clothier@imgtec.com, davem@davemloft.net, peterz@infradead.org, palves@redhat.com, shuahkh@osg.samsung.com, oleg@redhat.com, dhowells@redhat.com, Ulrich.Weigand@de.ibm.com, kirjanov@gmail.com, tglx@linutronix.de, davej@redhat.com, akpm@linux-foundation.org, sukadev@linux.vnet.ibm.com, emachado@linux.vnet.ibm.com, sam.bobroff@au1.ibm.com From: Laurent Dufour Message-ID: <5718F901.6010104@linux.vnet.ibm.com> Date: Thu, 21 Apr 2016 18:00:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460524468.30704.5.camel@ellerman.id.au> Content-Type: multipart/mixed; boundary="------------010609080808060004030507" X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16042116-0041-0000-0000-0000134B0780 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3475 Lines: 99 This is a multi-part message in MIME format. --------------010609080808060004030507 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 13/04/2016 07:14, Michael Ellerman wrote: > On Mon, 2016-04-11 at 09:40 +0200, Laurent Dufour wrote: >> On 07/04/2016 23:49, Michael Ellerman wrote: >>> On 7 April 2016 7:23:46 pm AEST, Laurent Dufour wrote: >>>> This series is required to handle TM state in CRIU. >>>> Is there a chance to get it upstream soon ? >>> >>> We were waiting on the gdb support to make sure it had some testing. If it's working for CRIU that would be a good data point, have you actually tested it with CRIU? >> >> I just started integrating it in CRIU, my basic tests didn't report any >> issue with the new ptrace API, but I can't state that it is bug free ;) > > Sure. But if it's working for CRIU that's at least postive :) I did additional tests and the Anshuman's series is working fine for CRIU's support with the attached patch applied. Michael, could you please applied the attached patch among the Anshuman's series ? Thanks, Laurent. --------------010609080808060004030507 Content-Type: text/x-patch; name="ppc64-allow-ptrace-to-set-TM-bits.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ppc64-allow-ptrace-to-set-TM-bits.patch" >From 7a4f07c54afdbe7bef84d1f700ab9262f449513a Mon Sep 17 00:00:00 2001 From: Laurent Dufour Date: Mon, 11 Apr 2016 18:59:16 +0200 Subject: [PATCH] ppc64: allow ptrace to set TM bits This patch allows the MSR bits relative to the Transactional memory state to be manipulated through the ptrace API. However, in the case the TM available bit is not set in the manipulated MSR, the changes are ignored. When dealing with the checkpointed MSR, we must be sure that the TM state bits will not be set since the checkpointed state can't be a transactional one. Signed-off-by: Laurent Dufour --- arch/powerpc/kernel/ptrace.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index b063fc499c1d..5c792f0bf1ca 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -161,8 +161,12 @@ const char *regs_query_register_name(unsigned int offset) #ifdef CONFIG_PPC_ADV_DEBUG_REGS #define MSR_DEBUGCHANGE 0 #else +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +#define MSR_DEBUGCHANGE (MSR_TS_MASK | MSR_SE | MSR_BE) +#else #define MSR_DEBUGCHANGE (MSR_SE | MSR_BE) #endif +#endif /* * Max register writeable via put_reg @@ -180,6 +184,12 @@ static unsigned long get_user_msr(struct task_struct *task) static int set_user_msr(struct task_struct *task, unsigned long msr) { +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM + if (!(task->thread.regs->msr & MSR_TM)) { + /* If TM is not available, discard TM bits changes */ + msr &= ~(MSR_TM | MSR_TS_MASK); + } +#endif task->thread.regs->msr &= ~MSR_DEBUGCHANGE; task->thread.regs->msr |= msr & MSR_DEBUGCHANGE; return 0; @@ -193,6 +203,7 @@ static unsigned long get_user_ckpt_msr(struct task_struct *task) static int set_user_ckpt_msr(struct task_struct *task, unsigned long msr) { + msr &= ~MSR_TS_MASK; /* Checkpoint state can't be in transaction */ task->thread.ckpt_regs.msr &= ~MSR_DEBUGCHANGE; task->thread.ckpt_regs.msr |= msr & MSR_DEBUGCHANGE; return 0; -- 1.9.1 --------------010609080808060004030507--