powerpc: Rework context management for CPUs with no hash table
PATCH 3/3 powerpc: Rework context management for CPUs with no hash table
This reworks the context management code used by 4xx,8xx and freescale BookE. It adds support for SMP by implementing a concept of stale context map to lazily flush the TLB on processors where a context may have been invalidated. This also contains the ground work for generalizing such lazy TLB flushing by just picking up a new PID and marking the old one stale. This will be implemented later.
This is a first implementation that uses a global spinlock.
Ideally, we should try to get at least the fast path (context ID already assigned) lockless or limited to a per context lock, but for now this will do.
I tried to keep the UP case reasonably simple to avoid adding too much overhead to 8xx which does a lot of context stealing since it effectively has only 16 PIDs available.
---
arch/powerpc/include/asm/mmu-40x.h | 5 arch/powerpc/include/asm/mmu-44x.h | 5 arch/powerpc/include/asm/mmu-fsl-booke.h | 5 arch/powerpc/mm/mmu_context_nohash.c | 258 ++++++++++++++++++++++++------- 4 files changed, 217 insertions(+), 56 deletions(-)
arch/powerpc/include/asm/mmu-40x.h +3 -2
@@ -54,8 +54,9 @@#ifndef __ASSEMBLY__typedef struct { -unsigned long id; -unsigned long vdso_base; +unsigned short id; +unsigned short active; +unsigned long vdso_base; }mm_context_t ;#endif /* !__ASSEMBLY__ */
arch/powerpc/include/asm/mmu-44x.h +3 -2
@@ -56,8 +56,9 @@extern unsigned int tlb_44x_hwater;typedef struct { -unsigned long id; -unsigned long vdso_base; +unsigned short id; +unsigned short active; +unsigned long vdso_base; }mm_context_t ;#endif /* !__ASSEMBLY__ */
arch/powerpc/include/asm/mmu-fsl-booke.h +3 -2
@@ -74,8 +74,9 @@#ifndef __ASSEMBLY__typedef struct { -unsigned long id; -unsigned long vdso_base; +unsigned short id; +unsigned short active; +unsigned long vdso_base; }mm_context_t ;#endif /* !__ASSEMBLY__ */
arch/powerpc/mm/mmu_context_nohash.c +208 -50
320 lines not on this page · raw message
Hi Ben,
arch/powerpc/mm/mmu_context_nohash.c static void steal_context(void); · line 231
Quoted 5 lines · On Thu, 04 Dec 2008 16:41:53 +1100 Benjamin Herrenschmidt…
+++
linux-work/arch/powerpc/mm/mmu_context_nohash.c2008-12-04 15:18:46.000000000 +1100arch/powerpc/mm/mmu_context_nohash.c +3
-0+/* No more free contexts, let's try to steal one */ +if (nr_free_contexts ==0 ) { +#ifdef CONFIF_SMP
^
typo
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 10 lines · Stephen Rothwell
Hi Ben,
arch/powerpc/mm/mmu_context_nohash.c static void steal_context(void); · line 231
Quoted 5 lines · On Thu, 04 Dec 2008 16:41:53 +1100 Benjamin Herrenschmidt…
+++
linux-work/arch/powerpc/mm/mmu_context_nohash.c2008-12-04 15:18:46.000000000 +1100arch/powerpc/mm/mmu_context_nohash.c +3
-0+/* No more free contexts, let's try to steal one */ +if (nr_free_contexts ==0 ) { +#ifdef CONFIF_SMP ^typo
Bah, leave me some surprises for Kumar for when he tests on actual SMP hardware :-)
Cheers,
Ben.