From: Gabriel Paubert <paubert@iram.es>
To: Anton Blanchard <anton@ozlabs.org>
Cc: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
aneesh.kumar@linux.vnet.ibm.com, acsawdey@linux.vnet.ibm.com,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] powerpc: Avoid load hit store in __giveup_fpu() and __giveup_altivec()
Date: Mon, 30 May 2016 10:15:52 +0200 [thread overview]
Message-ID: <20160530081552.GA2547@visitor2.iram.es> (raw)
In-Reply-To: <1464523432-12605-1-git-send-email-anton@ozlabs.org>
On Sun, May 29, 2016 at 10:03:50PM +1000, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
>
> In both __giveup_fpu() and __giveup_altivec() we make two modifications
> to tsk->thread.regs->msr. gcc decides to do a read/modify/write of
> each change, so we end up with a load hit store:
>
> ld r9,264(r10)
> rldicl r9,r9,50,1
> rotldi r9,r9,14
> std r9,264(r10)
> ...
> ld r9,264(r10)
> rldicl r9,r9,40,1
> rotldi r9,r9,24
> std r9,264(r10)
>
> Fix this by using a temporary.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> arch/powerpc/kernel/process.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index e2f12cb..7da1f92 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -139,12 +139,16 @@ EXPORT_SYMBOL(__msr_check_and_clear);
> #ifdef CONFIG_PPC_FPU
> void __giveup_fpu(struct task_struct *tsk)
> {
> + u64 msr;
Huh? Make it an unsigned long please, which is the type of the msr
field in struct pt_regs to work on both 32 and 64 bit processors.
> +
> save_fpu(tsk);
> - tsk->thread.regs->msr &= ~MSR_FP;
> + msr = tsk->thread.regs->msr;
> + msr &= ~MSR_FP;
> #ifdef CONFIG_VSX
> if (cpu_has_feature(CPU_FTR_VSX))
> - tsk->thread.regs->msr &= ~MSR_VSX;
> + msr &= ~MSR_VSX;
> #endif
> + tsk->thread.regs->msr = msr;
> }
>
> void giveup_fpu(struct task_struct *tsk)
> @@ -219,12 +223,16 @@ static int restore_fp(struct task_struct *tsk) { return 0; }
>
> static void __giveup_altivec(struct task_struct *tsk)
> {
> + u64 msr;
> +
Ditto.
> save_altivec(tsk);
> - tsk->thread.regs->msr &= ~MSR_VEC;
> + msr = tsk->thread.regs->msr;
> + msr &= ~MSR_VEC;
> #ifdef CONFIG_VSX
> if (cpu_has_feature(CPU_FTR_VSX))
> - tsk->thread.regs->msr &= ~MSR_VSX;
> + msr &= ~MSR_VSX;
> #endif
> + tsk->thread.regs->msr = msr;
> }
>
> void giveup_altivec(struct task_struct *tsk)
> --
> 2.7.4
>
Gabriel
next prev parent reply other threads:[~2016-05-30 8:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-29 12:03 [PATCH 1/3] powerpc: Avoid load hit store in __giveup_fpu() and __giveup_altivec() Anton Blanchard
2016-05-29 12:03 ` [PATCH 2/3] powerpc: Avoid load hit store in setup_sigcontext() Anton Blanchard
2016-05-29 23:14 ` Michael Neuling
2016-05-29 23:23 ` Anton Blanchard
2016-06-15 12:39 ` [2/3] " Michael Ellerman
2016-05-29 12:03 ` [PATCH 3/3] powerpc: Avoid load hit store when using find_linux_pte_or_hugepte() Anton Blanchard
2016-05-30 5:17 ` Aneesh Kumar K.V
2016-05-30 23:29 ` Michael Ellerman
2016-05-31 3:29 ` Aneesh Kumar K.V
2016-05-31 4:18 ` Michael Ellerman
2016-05-31 6:52 ` Aneesh Kumar K.V
2016-06-01 3:43 ` [3/3] " Michael Ellerman
2016-06-01 5:35 ` Anton Blanchard
2016-05-30 8:15 ` Gabriel Paubert [this message]
2016-05-31 10:09 ` [PATCH 1/3] powerpc: Avoid load hit store in __giveup_fpu() and __giveup_altivec() Anton Blanchard
2016-06-01 3:06 ` Michael Ellerman
2016-06-15 12:39 ` [1/3] " 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=20160530081552.GA2547@visitor2.iram.es \
--to=paubert@iram.es \
--cc=acsawdey@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=anton@ozlabs.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/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).