linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.vnet.ibm.com>
To: Cyril Bur <cyrilbur@gmail.com>, Simon Guo <wei.guo.simon@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH] ppc64: allow ptrace to set TM bits
Date: Mon, 22 Aug 2016 11:53:46 +0200	[thread overview]
Message-ID: <410ae489-935d-322c-8568-a4ab3f518594@linux.vnet.ibm.com> (raw)
In-Reply-To: <1471827666.758.3.camel@gmail.com>

On 22/08/2016 03:01, Cyril Bur wrote:
> On Tue, 2016-08-02 at 13:43 +0800, Simon Guo wrote:
>> Hi Laurent,
>> On Fri, Jul 29, 2016 at 11:51:22AM +0200, Laurent Dufour wrote:
>>>
>>>  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
>>
>> I am not sure whether following is an issue:
>> Per PowerISA, any exception/interrupt will disable MSR[TM] bit 
>> automatically and mark MSR_TS to be suspended when it is 
>> transactional. It is possible that MSR[TM] = 0 and MSR[MSR_TS] != 0
>> (suspended). 
>>
>> Will set_user_msr() be able to escape from the above?
>>  For example, one user space application encountered 
>> page fault during transaction, its task->thread.regs->msr & MSR_TM ==
>> 0
>> and MSR[MSR_TS] == suspended.  Then it is being traced and 
>> set_user_msr() is invoked on it. I think it will be incorrect to 
>> clear its  MSR_TS_MASK bits.....
>>
>> (suspended).ible that MSRTM] = 0 and MSR[MSR_TS] != 0> (suspended).
> 
>> Please correct me if I am wrong.
> 
> I'm not very familiar with ptracing and exactly what can happen but I
> agree with Simon. Trying to change an MSR with that possible condition
> stated ("It is possible that MSR[TM] = 0 and MSR[MSR_TS] !=
> 0> (suspended)") to MSR_TS and MSR_TS_MASK bits all 0 will cause a Bad
> Thing.

I don't think this may happen since from the user space point of view,
we can't have MSR[TM]=0 & MSR[MSR_TS]=1, because MSR[TM] will be set
once the transaction is initiated.

Anyway, this patch is no more required since the recent patch
http://patchwork.ozlabs.org/patch/661358/ is now dropping the TM state
form the signal return path, which is enough fof CRIU to work fine.

Cheers,
Laurent.

      reply	other threads:[~2016-08-22  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29  9:51 [PATCH] ppc64: allow ptrace to set TM bits Laurent Dufour
2016-08-02  5:43 ` Simon Guo
2016-08-17 14:40   ` Laurent Dufour
2016-08-22  1:01   ` Cyril Bur
2016-08-22  9:53     ` Laurent Dufour [this message]

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=410ae489-935d-322c-8568-a4ab3f518594@linux.vnet.ibm.com \
    --to=ldufour@linux.vnet.ibm.com \
    --cc=cyrilbur@gmail.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=wei.guo.simon@gmail.com \
    /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).