aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2013-05-29 15:34:27 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-31 18:29:25 -0400
commita515348fc69fd1d9e8ebd34a16f1026d7fe32048 (patch)
treeb51f9766922a1050e376df6680bfae4cec82014f
parent2ac6f427ad837a69561160b282eff80d9f0c2466 (diff)
powerpc/pseries: Kill all prefetch streams on context switch
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> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h11
-rw-r--r--arch/powerpc/kernel/entry_64.S7
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index cea8496091ff..2f1b6c5f8174 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)
523#define PPC440EP_ERR42 523#define PPC440EP_ERR42
524#endif 524#endif
525 525
526/* The following stops all load and store data streams associated with stream
527 * ID (ie. streams created explicitly). The embedded and server mnemonics for
528 * dcbt are different so we use machine "power4" here explicitly.
529 */
530#define DCBT_STOP_ALL_STREAM_IDS(scratch) \
531.machine push ; \
532.machine "power4" ; \
533 lis scratch,0x60000000@h; \
534 dcbt r0,scratch,0b01010; \
535.machine pop
536
526/* 537/*
527 * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them 538 * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
528 * keep the address intact to be compatible with code shared with 539 * 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 0e9095e47b5b..246b11c4fe7e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -501,6 +501,13 @@ BEGIN_FTR_SECTION
501 ldarx r6,0,r1 501 ldarx r6,0,r1
502END_FTR_SECTION_IFSET(CPU_FTR_STCX_CHECKS_ADDRESS) 502END_FTR_SECTION_IFSET(CPU_FTR_STCX_CHECKS_ADDRESS)
503 503
504#ifdef CONFIG_PPC_BOOK3S
505/* Cancel all explict user streams as they will have no use after context
506 * switch and will stop the HW from creating streams itself
507 */
508 DCBT_STOP_ALL_STREAM_IDS(r6)
509#endif
510
504 addi r6,r4,-THREAD /* Convert THREAD to 'current' */ 511 addi r6,r4,-THREAD /* Convert THREAD to 'current' */
505 std r6,PACACURRENT(r13) /* Set new 'current' */ 512 std r6,PACACURRENT(r13) /* Set new 'current' */
506 513