linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>,
	Florian Weimer <fweimer@redhat.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@ozlabs.org
Cc: stewart@linux.vnet.ibm.com, mikey@neuling.org, cyrilbur@gmail.com
Subject: Re: [PATCH 3/4] powerpc/powernv: Enable TM without suspend if possible
Date: Thu, 19 Oct 2017 13:13:08 -0200	[thread overview]
Message-ID: <238022cd-ee1a-54a7-2da8-8327030ea593@linaro.org> (raw)
In-Reply-To: <8760bbb6su.fsf@linux.vnet.ibm.com>



On 19/10/2017 11:34, Tulio Magno Quites Machado Filho wrote:
> Forwarding some comments from Adhemerval sent to libc-alpha [1]...
> 
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> Florian Weimer <fweimer@redhat.com> writes:
>>
>>> On 10/12/2017 12:17 PM, Michael Ellerman wrote:
>>>> +	pr_info("Enabling TM (Transactional Memory) with Suspend Disabled\n");
>>>> +	cur_cpu_spec->cpu_features |= CPU_FTR_TM;
>>>> +	cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_HTM_NO_SUSPEND;
>>>> +	tm_suspend_disabled = true;
>>>
>>> This doesn't look right because if suspend is not available, you need to 
>>> clear the original PPC_FEATURE2_HTM flag because the semantics are not 
>>> right, so that applications can use fallback code.  Otherwise, 
>>> applications may incorrectly select the HTM code and break if running on 
>>> a system which supports HTM, but without the suspend state.
>>>
>>> The new flag should say that HTM is supported, but without the suspend 
>>> state, and it should be always set if PPC_FEATURE2_HTM is set.
>>
>> Will it also change TEXARS with the abort information?
> 
> It should, with a permanent error cause so that old applications entering
> suspended state can adopt another technique.
> Michael, could you clarify if this is indeed happening, please?
> 
>> I completely agree with Florian here, this is as *ABI* change
>> and the kernel need to advertise a different TM ABI instead
>> of as an extension.
> 
> Adhemerval, could you elaborate which problems you're foreseeing, please?
> 

Pretty much the same Florian already stated: an application can not any
more assume for instance:

        tsr. 	0
        mfcr	r9,128
        andis. 	r10,r9,0x4000
        be 	cr0,L(suspend)
	andis.	r10,r9,0x2000
	be	cr0,L(transactional)

However thinking more about it I am not sure if this should be really a
problem: on default HTM mode the program must handle self-induced failures
as the tbegin. failure path and I assume trying to suspend/resume in this
case will trigger this.  For instance:

   if (__builtin_tbegin (0))
     {
       /* some transactional stuff.  */
       __builtin_tsuspend ();
       /* non transactional stuff.  */
       __builtin_tresume ();
       /* more transactional stuff.  */
     }
   else
     {
       /* fall-out code.  */
     }

So I assume for these chips without suspend/resume support the example
code will always run the fall-out code.

  reply	other threads:[~2017-10-19 15:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 10:17 [PATCH 1/4] powerpc/tm: Add commandline option to disable hardware transactional memory Michael Ellerman
2017-10-12 10:17 ` [PATCH 2/4] powerpc: Add PPC_FEATURE2_HTM_NO_SUSPEND Michael Ellerman
2017-10-12 10:17 ` [PATCH 3/4] powerpc/powernv: Enable TM without suspend if possible Michael Ellerman
2017-10-19 10:07   ` Florian Weimer
2017-10-19 12:04     ` Tulio Magno Quites Machado Filho
2017-10-19 12:45       ` Florian Weimer
2017-10-19 13:34     ` Tulio Magno Quites Machado Filho
2017-10-19 15:13       ` Adhemerval Zanella [this message]
2017-10-22  9:59         ` Michael Ellerman
2017-10-20  2:47       ` Michael Neuling
2017-10-22  9:48       ` Michael Ellerman
2017-10-22  9:54     ` Michael Ellerman
2017-10-12 10:17 ` [PATCH 4/4] powerpc/tm: P9 disable transactionally suspended sigcontexts Michael Ellerman
2017-10-12 11:58 ` [PATCH 5/4] KVM: PPC: Tie KVM_CAP_PPC_HTM to the user-visible TM feature Michael Ellerman
2017-10-24  8:08   ` [5/4] " Michael Ellerman
2017-10-20 11:45 ` [PATCH 1/4] powerpc/tm: Add commandline option to disable hardware transactional memory Breno Leitao
2017-10-20 12:58   ` David Laight
2017-10-21  1:00     ` Michael Neuling
2017-10-23  9:01       ` David Laight
2017-10-23  9:15         ` Michael Neuling
2017-10-21  0:58   ` Michael Neuling
2017-10-23 12:56     ` Breno Leitao
2017-10-24  8:12       ` Michael Ellerman
2017-10-24  8:08 ` [1/4] " 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=238022cd-ee1a-54a7-2da8-8327030ea593@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=cyrilbur@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=stewart@linux.vnet.ibm.com \
    --cc=tuliom@linux.vnet.ibm.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).