From: Anton Blanchard <anton@ozlabs.org>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
aneesh.kumar@linux.vnet.ibm.com, acsawdey@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 2/3] powerpc: Avoid load hit store in setup_sigcontext()
Date: Sun, 29 May 2016 22:03:51 +1000 [thread overview]
Message-ID: <1464523432-12605-2-git-send-email-anton@ozlabs.org> (raw)
In-Reply-To: <1464523432-12605-1-git-send-email-anton@ozlabs.org>
From: Anton Blanchard <anton@samba.org>
In setup_sigcontext(), we set current->thread.vrsave then use it
straight after. Since current is hidden from the compiler via inline
assembly, it cannot optimise this and we end up with a load hit store.
Fix this by using a temporary.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/powerpc/kernel/signal_64.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 2552079..7e49984 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -104,6 +104,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
*/
#ifdef CONFIG_ALTIVEC
elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
+ unsigned long vrsave;
#endif
unsigned long msr = regs->msr;
long err = 0;
@@ -125,9 +126,13 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
/* We always copy to/from vrsave, it's 0 if we don't have or don't
* use altivec.
*/
- if (cpu_has_feature(CPU_FTR_ALTIVEC))
- current->thread.vrsave = mfspr(SPRN_VRSAVE);
- err |= __put_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
+ vrsave = 0;
+ if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ vrsave = mfspr(SPRN_VRSAVE);
+ current->thread.vrsave = vrsave;
+ }
+
+ err |= __put_user(vrsave, (u32 __user *)&v_regs[33]);
#else /* CONFIG_ALTIVEC */
err |= __put_user(0, &sc->v_regs);
#endif /* CONFIG_ALTIVEC */
--
2.7.4
next prev parent reply other threads:[~2016-05-29 12:04 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 ` Anton Blanchard [this message]
2016-05-29 23:14 ` [PATCH 2/3] powerpc: Avoid load hit store in setup_sigcontext() 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 ` [PATCH 1/3] powerpc: Avoid load hit store in __giveup_fpu() and __giveup_altivec() Gabriel Paubert
2016-05-31 10:09 ` 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=1464523432-12605-2-git-send-email-anton@ozlabs.org \
--to=anton@ozlabs.org \
--cc=acsawdey@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--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).