Re: [RFC PATCH] powerpc/64s/radix: introduce option to disable broadcast tlbie
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2019-08-14 02:08:17
Hi Nick, Just a few comments. Nicholas Piggin [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c index 71f7fede2fa4..56ceecbd3d5c 100644 --- a/arch/powerpc/mm/book3s64/radix_tlb.c +++ b/arch/powerpc/mm/book3s64/radix_tlb.c@@ -285,6 +286,30 @@ static inline void _tlbie_pid(unsigned long pid, unsigned long ric) asm volatile("eieio; tlbsync; ptesync": : :"memory"); } +struct tlbiel_pid { + unsigned long pid; + unsigned long ric; +}; + +static void do_tlbiel_pid(void *info) +{ + struct tlbiel_pid *t = info; + + if (t->ric == RIC_FLUSH_TLB) + _tlbiel_pid(t->pid, RIC_FLUSH_TLB); + else if (t->ric == RIC_FLUSH_PWC) + _tlbiel_pid(t->pid, RIC_FLUSH_PWC); + else + _tlbiel_pid(t->pid, RIC_FLUSH_ALL); +} + +static inline void _tlbiel_pid_broadcast(const struct cpumask *cpus, + unsigned long pid, unsigned long ric)
Can we call these "multicast" instead of "broadcast"? I think that's more accurate, and avoids confusion with tlbie which literally does a broadcast (at least architecturally).
quoted hunk ↗ jump to hunk
@@ -524,6 +604,12 @@ static bool mm_needs_flush_escalation(struct mm_struct *mm) return false; } +static bool tlbie_enabled = true; +static bool use_tlbie(void) +{ + return tlbie_enabled; +}
No synchronisation, but that's OK. Would probably be good to have a comment though explaining why. We could use a static_key but I guess the overhead of a comparison and branch is in the noise vs the tlbie/tlbiel.
quoted hunk ↗ jump to hunk
@@ -1100,3 +1221,13 @@ extern void radix_kvm_prefetch_workaround(struct mm_struct *mm) } EXPORT_SYMBOL_GPL(radix_kvm_prefetch_workaround); #endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ + +static int __init radix_tlb_setup(void) +{ + debugfs_create_bool("tlbie_enabled", 0600, + powerpc_debugfs_root, + &tlbie_enabled); + + return 0; +} +arch_initcall(radix_tlb_setup);
For working around hardware bugs we would want a command line parameter or other boot time way to flip this. But I guess you're saying because we haven't converted all uses of tlbie we can't really support that anyway, and so a runtime switch is sufficient? cheers