linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Cyril Bur <cyrilbur@gmail.com>
To: Simon Guo <wei.guo.simon@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au,
	mikey@neuling.org, anton@samba.org
Subject: Re: [PATCH 2/2] powerpc: tm: Enable transactional memory (TM) lazily for userspace
Date: Mon, 19 Sep 2016 15:26:28 +1000	[thread overview]
Message-ID: <1474262788.5093.8.camel@gmail.com> (raw)
In-Reply-To: <20160919044718.GB3797@simonLocalRHEL7.x64>

On Mon, 2016-09-19 at 12:47 +0800, Simon Guo wrote:
> On Wed, Sep 14, 2016 at 06:02:16PM +1000, Cyril Bur wrote:
> > 
> > @@ -954,8 +963,16 @@ static inline void __switch_to_tm(struct
> > task_struct *prev,
> >  		struct task_struct *new)
> >  {
> >  	if (cpu_has_feature(CPU_FTR_TM)) {
> > -		tm_enable();
> > -		tm_reclaim_task(prev);
> > +		if (tm_enabled(prev) || tm_enabled(new))
> > +			tm_enable();
> > +
> > +		if (tm_enabled(prev)) {
> > +			prev->thread.load_tm++;
> > +			tm_reclaim_task(prev);
> > +			if (!MSR_TM_ACTIVE(prev->thread.regs->msr) 
> > && prev->thread.load_tm == 0)
> > +				prev->thread.regs->msr &= ~MSR_TM;
> > +		}
> Hi Cyril,
> 
> If MSR_TM_ACTIVE(), is it better to reset load_tm to 0?
> Other looks good to me.
> 

Doing so would extend the window that we keep TM enabled for when we
might not need to. It is possible that we could assume that if
MSR_TM_ACTIVE() then they're in codepathes that will reuse TM again
soon so load_tm = 0 could be a good idea but there's really no way to
know. Food for thought I guess...

Maybe?

Good thought,
Cyril

> Thanks,
> - Simon

  reply	other threads:[~2016-09-19  5:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  8:02 [PATCH 0/2] Enable MSR_TM lazily Cyril Bur
2016-09-14  8:02 ` [PATCH 1/2] powerpc: tm: Add TM Unavailable Exception Cyril Bur
2016-10-05  2:36   ` [1/2] " Michael Ellerman
2016-09-14  8:02 ` [PATCH 2/2] powerpc: tm: Enable transactional memory (TM) lazily for userspace Cyril Bur
2016-09-19  4:47   ` Simon Guo
2016-09-19  5:26     ` Cyril Bur [this message]
2016-09-14 11:28 ` [PATCH 0/2] Enable MSR_TM lazily Nicholas Piggin
2016-09-14 11:46   ` Michael Neuling
2016-09-14 12:12     ` Nicholas Piggin
2016-09-14 12:17       ` Michael Neuling
2016-09-14 14:10   ` Carlos Eduardo Seo
2016-09-15  3:59     ` Nicholas Piggin

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=1474262788.5093.8.camel@gmail.com \
    --to=cyrilbur@gmail.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --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).