* [PATCH] powerpc/pseries: Kill all prefetch streams on context switch
@ 2013-05-30 5:34 Michael Neuling
2013-06-01 15:13 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Michael Neuling @ 2013-05-30 5:34 UTC (permalink / raw)
To: benh; +Cc: Linux PPC dev, anton, miltonm
On context switch, we should have no prefetch streams leak from one
userspace process to another. This frees up prefetch resources for the
next process.
Based on patch from Milton Miller.
Signed-off-by: Michael Neuling <mikey@neuling.org>
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index cea8496..2f1b6c5 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -523,6 +523,17 @@ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946)
#define PPC440EP_ERR42
#endif
+/* The following stops all load and store data streams associated with stream
+ * ID (ie. streams created explicitly). The embedded and server mnemonics for
+ * dcbt are different so we use machine "power4" here explicitly.
+ */
+#define DCBT_STOP_ALL_STREAM_IDS(scratch) \
+.machine push ; \
+.machine "power4" ; \
+ lis scratch,0x60000000@h; \
+ dcbt r0,scratch,0b01010; \
+.machine pop
+
/*
* toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
* keep the address intact to be compatible with code shared with
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 0e9095e..246b11c 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -501,6 +501,13 @@ BEGIN_FTR_SECTION
ldarx r6,0,r1
END_FTR_SECTION_IFSET(CPU_FTR_STCX_CHECKS_ADDRESS)
+#ifdef CONFIG_PPC_BOOK3S
+/* Cancel all explict user streams as they will have no use after context
+ * switch and will stop the HW from creating streams itself
+ */
+ DCBT_STOP_ALL_STREAM_IDS(r6)
+#endif
+
addi r6,r4,-THREAD /* Convert THREAD to 'current' */
std r6,PACACURRENT(r13) /* Set new 'current' */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/pseries: Kill all prefetch streams on context switch
2013-05-30 5:34 [PATCH] powerpc/pseries: Kill all prefetch streams on context switch Michael Neuling
@ 2013-06-01 15:13 ` Michael Ellerman
2013-06-03 0:42 ` Michael Neuling
0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2013-06-01 15:13 UTC (permalink / raw)
To: Michael Neuling; +Cc: anton, miltonm, Linux PPC dev
On Thu, May 30, 2013 at 03:34:27PM +1000, Michael Neuling wrote:
> On context switch, we should have no prefetch streams leak from one
> userspace process to another. This frees up prefetch resources for the
> next process.
>
> Based on patch from Milton Miller.
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
>
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index cea8496..2f1b6c5 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -523,6 +523,17 @@ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946)
> #define PPC440EP_ERR42
> #endif
>
> +/* The following stops all load and store data streams associated with stream
> + * ID (ie. streams created explicitly). The embedded and server mnemonics for
> + * dcbt are different so we use machine "power4" here explicitly.
> + */
> +#define DCBT_STOP_ALL_STREAM_IDS(scratch) \
> +.machine push ; \
> +.machine "power4" ; \
> + lis scratch,0x60000000@h; \
> + dcbt r0,scratch,0b01010; \
> +.machine pop
I don't see why we need the macro, ie. just stick this code in
entry_64.S directly.
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/pseries: Kill all prefetch streams on context switch
2013-06-01 15:13 ` Michael Ellerman
@ 2013-06-03 0:42 ` Michael Neuling
0 siblings, 0 replies; 3+ messages in thread
From: Michael Neuling @ 2013-06-03 0:42 UTC (permalink / raw)
To: Michael Ellerman; +Cc: anton, miltonm, Linux PPC dev
Michael Ellerman <michael@ellerman.id.au> wrote:
> On Thu, May 30, 2013 at 03:34:27PM +1000, Michael Neuling wrote:
> > On context switch, we should have no prefetch streams leak from one
> > userspace process to another. This frees up prefetch resources for the
> > next process.
> >
> > Based on patch from Milton Miller.
> >
> > Signed-off-by: Michael Neuling <mikey@neuling.org>
> >
> > diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> > index cea8496..2f1b6c5 100644
> > --- a/arch/powerpc/include/asm/ppc_asm.h
> > +++ b/arch/powerpc/include/asm/ppc_asm.h
> > @@ -523,6 +523,17 @@ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946)
> > #define PPC440EP_ERR42
> > #endif
> >
> > +/* The following stops all load and store data streams associated with stream
> > + * ID (ie. streams created explicitly). The embedded and server mnemonics for
> > + * dcbt are different so we use machine "power4" here explicitly.
> > + */
> > +#define DCBT_STOP_ALL_STREAM_IDS(scratch) \
> > +.machine push ; \
> > +.machine "power4" ; \
> > + lis scratch,0x60000000@h; \
> > + dcbt r0,scratch,0b01010; \
> > +.machine pop
>
> I don't see why we need the macro, ie. just stick this code in
> entry_64.S directly.
There's a decent chance we'll want to use this again at some point. We
also most stuck it in the error path of the power7 copy user loop but
after consulting Anton and heavily reviewing the code, we decoded it
shouldn't be needed.
It's in Linus tree now anyway.
Mikey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-03 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 5:34 [PATCH] powerpc/pseries: Kill all prefetch streams on context switch Michael Neuling
2013-06-01 15:13 ` Michael Ellerman
2013-06-03 0:42 ` Michael Neuling
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).