Skip to content

Commit cf4f08b

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/radix: Optimise Page Walk Cache flush
Currently we implement flushing of the page walk cache (PWC) by calling _tlbiel_pid() with a RIC (Radix Invalidation Control) value of 1 which says to only flush the PWC. But _tlbiel_pid() loops over each set (congruence class) of the TLB, which is not necessary when we're just flushing the PWC. In fact the set argument is ignored for a PWC flush, so essentially we're just flushing the PWC 127 extra times for no benefit. Fix it by adding tlbiel_pwc() which just does a single flush of the PWC. Signed-off-by: Aneesh Kumar K.V <[email protected]> [mpe: Split out of combined patch, drop _ in name, rewrite change log] Signed-off-by: Michael Ellerman <[email protected]>
1 parent 45b21cf commit cf4f08b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

arch/powerpc/mm/tlb-radix.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ static inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
5353
asm volatile(PPC_INVALIDATE_ERAT "; isync" : : :"memory");
5454
}
5555

56+
static inline void tlbiel_pwc(unsigned long pid)
57+
{
58+
asm volatile("ptesync": : :"memory");
59+
60+
/* For PWC flush, we don't look at set number */
61+
__tlbiel_pid(pid, 0, RIC_FLUSH_PWC);
62+
63+
asm volatile("ptesync": : :"memory");
64+
asm volatile(PPC_INVALIDATE_ERAT "; isync" : : :"memory");
65+
}
66+
5667
static inline void _tlbie_pid(unsigned long pid, unsigned long ric)
5768
{
5869
unsigned long rb,rs,prs,r;
@@ -140,7 +151,7 @@ void radix__local_flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr)
140151

141152
pid = mm->context.id;
142153
if (pid != MMU_NO_CONTEXT)
143-
_tlbiel_pid(pid, RIC_FLUSH_PWC);
154+
tlbiel_pwc(pid);
144155

145156
preempt_enable();
146157
}
@@ -222,7 +233,7 @@ void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr)
222233
if (lock_tlbie)
223234
raw_spin_unlock(&native_tlbie_lock);
224235
} else
225-
_tlbiel_pid(pid, RIC_FLUSH_PWC);
236+
tlbiel_pwc(pid);
226237
no_context:
227238
preempt_enable();
228239
}

0 commit comments

Comments
 (0)