From: Cyril Bur <cyrilbur@gmail•com>
To: Simon Guo <simonguo@linux•vnet.ibm.com>
Cc: mpe@ellerman•id.au, linuxppc-dev@ozlabs•org, mikey@neuling•org,
Anshuman Khandual <khandual@linux•vnet.ibm.com>,
Simon Guo <wei.guo.simon@gmail•com>
Subject: Re: [PATCH 3/5] powerpc: tm: Always use fp_state and vr_state to store live registers
Date: Mon, 18 Jul 2016 11:28:30 +1000 [thread overview]
Message-ID: <20160718112830.71ee878c@camb691> (raw)
In-Reply-To: <20160717032543.GB3843@simonLocalRHEL7.x64>
On Sun, 17 Jul 2016 11:25:43 +0800
Simon Guo <simonguo@linux•vnet.ibm.com> wrote:
> Hi Cyril,
> On Wed, Jun 08, 2016 at 02:00:34PM +1000, Cyril Bur wrote:
> > @@ -917,24 +907,10 @@ static inline void tm_recheckpoint_new_task(struct task_struct *new)
> > "(new->msr 0x%lx, new->origmsr 0x%lx)\n",
> > new->pid, new->thread.regs->msr, msr);
> >
> > - /* This loads the checkpointed FP/VEC state, if used */
> > tm_recheckpoint(&new->thread, msr);
> >
> > - /* This loads the speculative FP/VEC state, if used */
> > - if (msr & MSR_FP) {
> > - do_load_up_transact_fpu(&new->thread);
> > - new->thread.regs->msr |=
> > - (MSR_FP | new->thread.fpexc_mode);
> > - }
> > -#ifdef CONFIG_ALTIVEC
> > - if (msr & MSR_VEC) {
> > - do_load_up_transact_altivec(&new->thread);
> > - new->thread.regs->msr |= MSR_VEC;
> > - }
> > -#endif
> > - /* We may as well turn on VSX too since all the state is restored now */
> > - if (msr & MSR_VSX)
> > - new->thread.regs->msr |= MSR_VSX;
> > + /* Won't restore math get called later? */
> > + restore_math(new->thread.regs);
>
> I have some question for the "restore_math" in tm_recheckpoint_new_task().
>
Please ask!
> Per my understanding, now after tm_recheckpoint, the fp_state content
> is obsolete. However restore_math() will try to restore FP/Vec/VSX state
> from fp_state, (orginally it is right, since fp_state was the valid
> checkpointed state and consistent with FP register ). Should we remove
> the restore_math() here?
>
The aim of this patch is to ensure that pt_regs, fp_state and vr_state always
hold a threads 'live' registers. So, after a recheckpoint fp_state is where the
the state should be. tm_reclaim_thread() does a save_all() before doing the
reclaim.
This means that the call to restore_math() is a replacement for all deleted
lines above it.
I added it here because I'd prefer to be safe but I left that comment in
because I suspect restore_math() will be called later and we can get away with
not calling it here.
> And, should the thread's MSR now set FP bit in tm_recheckpoint(), to
> indicate that FP register content is "fresh" in contrast to thread.fp_state?
>
I'm not sure what you mean by 'fresh'. You do highlight that we'll have to be
sure that the MSR bits are off (so that restore_math() doesn't assume the
registers are already loaded) which makes me think that tm_reclaim_thread()
should be doing a giveup_all(), I'll fix that.
I hope that helps,
Cyril
> Please correct me if I am wrong.
>
> Thanks,
> - Simon
>
next prev parent reply other threads:[~2016-07-18 1:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 4:00 [PATCH 0/5] Consistent TM structures Cyril Bur
2016-06-08 4:00 ` [PATCH 1/5] selftests/powerpc: Check for VSX preservation across userspace preemption Cyril Bur
2016-06-09 1:35 ` Daniel Axtens
2016-06-09 3:52 ` Michael Ellerman
2016-06-10 6:10 ` Cyril Bur
2016-06-08 4:00 ` [PATCH 2/5] selftests/powerpc: Add test to check TM ucontext creation Cyril Bur
2016-06-09 5:12 ` Daniel Axtens
2016-06-10 5:55 ` Cyril Bur
2016-06-08 4:00 ` [PATCH 3/5] powerpc: tm: Always use fp_state and vr_state to store live registers Cyril Bur
2016-06-28 3:53 ` Simon Guo
2016-06-30 1:31 ` Cyril Bur
2016-07-17 3:25 ` Simon Guo
2016-07-18 1:28 ` Cyril Bur [this message]
2016-07-20 9:36 ` Simon Guo
2016-06-08 4:00 ` [PATCH 4/5] powerpc: tm: Rename transct_(*) to ck(\1)_state Cyril Bur
2016-06-08 4:00 ` [PATCH 5/5] powerpc: Remove do_load_up_transact_{fpu,altivec} Cyril Bur
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=20160718112830.71ee878c@camb691 \
--to=cyrilbur@gmail$(echo .)com \
--cc=khandual@linux$(echo .)vnet.ibm.com \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=mikey@neuling$(echo .)org \
--cc=mpe@ellerman$(echo .)id.au \
--cc=simonguo@linux$(echo .)vnet.ibm.com \
--cc=wei.guo.simon@gmail$(echo .)com \
/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