public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Breno Leitao <leitao@debian•org>, linuxppc-dev@lists•ozlabs.org
Cc: Michael Neuling <mikey@neuling•org>
Subject: Re: [PATCH v2 1/4] powerpc/tm: Remove msr_tm_active()
Date: Tue, 21 Aug 2018 16:33:06 +1000	[thread overview]
Message-ID: <874lfomdp9.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <7433b095-ce67-5097-8dd7-0f47ab797914@debian.org>

Breno Leitao <leitao@debian•org> writes:
> On 08/16/2018 09:49 PM, Michael Ellerman wrote:
>> Michael Neuling <mikey@neuling•org> writes:
>> 
>>> On Mon, 2018-06-18 at 19:59 -0300, Breno Leitao wrote:
>>>> Currently msr_tm_active() is a wrapper around MSR_TM_ACTIVE() if
>>>> CONFIG_PPC_TRANSACTIONAL_MEM is set, or it is just a function that
>>>> returns false if CONFIG_PPC_TRANSACTIONAL_MEM is not set.
>>>>
>>>> This function is not necessary, since MSR_TM_ACTIVE() just do the same,
>>>> checking for the TS bits and does not require any TM facility.
>>>>
>>>> This patchset remove every instance of msr_tm_active() and replaced it
>>>> by MSR_TM_ACTIVE().
>>>>
>>>> Signed-off-by: Breno Leitao <leitao@debian•org>
>>>>
>>>
>>> Patch looks good... one minor nit below...
>>>
>>>>  
>>>> -	if (!msr_tm_active(regs->msr) &&
>>>> -		!current->thread.load_fp && !loadvec(current->thread))
>>>> +	if (!current->thread.load_fp && !loadvec(current->thread)) {
>>>> +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
>>>> +		if (!MSR_TM_ACTIVE(regs->msr))
>>>> +			return;
>>>
>>> Can you make a MSR_TM_ACTIVE() that returns false when
>>> !CONFIG_PPC_TRANSACTIONAL_MEM. Then you don't need this inline #ifdef.
>> 
>> Is that safe?
>> 
>> I see ~50 callers of MSR_TM_ACTIVE(), are they all inside #ifdef TM ?
>
> I checked all of them, and the only two that are not called inside a #ifdef
> are at kvm/book3s_hv_tm.c. They are:
>
>   kvm/book3s_hv_tm.c:		if (!MSR_TM_ACTIVE(msr)) {
>   kvm/book3s_hv_tm.c:		if (MSR_TM_ACTIVE(msr) || !(vcpu->arch.texasr & TEXASR_FS)) {

That whole file is only built if TM=y:

kvm-hv-$(CONFIG_PPC_TRANSACTIONAL_MEM) += \
	book3s_hv_tm.o

> All the others are being called inside the #ifdef
>
> Other than that, I do not see why it would be a problem in the way I
> implemented it, since it will return false for the two cases above, which
> seems correct. Take a look on how the definition became:
>
>   #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
>   #define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */
>   #else
>   #define MSR_TM_ACTIVE(x) 0
>   #endif


Imagine we had some code somewhere that checked for TM being active in a
non-TM aware kernel, that would break with this change, because now the
MSR check does nothing when TM=n.

eg. we might check at boot time that we're not transactional, eg. in
case we came from a kdump kernel that was in a transaction.

So if all the call-sites are already inside an #ifdef I'd be inclined to
not add the #ifdef around the MSR_TM_ACTIVE macro.

That way the macro can always be used to check the MSR value, whether TM
is compiled in or out.

cheers

      reply	other threads:[~2018-08-21  6:33 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     ` [PATCH v2 4/4] powerpc/tm: Do not recheckpoint non-tm task Breno Leitao
2018-08-15 23:50       ` 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 [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=874lfomdp9.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=leitao@debian$(echo .)org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mikey@neuling$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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