Skip to contentSkip to conversation

powerpc/mm: convert tlbie to tlbiel when no batch is active

RFC PATCH Superseded Balbir Singh 2 participants 2 messages Apr 13, 2017 – Apr 17, 2017 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 powerpc/mm: convert tlbie to tlbiel when no batch is active

Do the checks that __flush_tlb_pending() does and check if a local flush will do when batch->active is false inside of hpte_need_flush(). I've checked the changes with tlbie tracing, I see local flushes as applicable now and I've also run some basic ltp testcases on top of these changes on a powernv machine.

---
 arch/powerpc/mm/tlb_hash64.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
arch/powerpc/mm/tlb_hash64.c +9 -4
index 4517aa4..1268e3a 100644
@@ -93,12 +93,17 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
 
 	/*
 	 * Check if we have an active batch on this CPU. If not, just
-	 * flush now and return. For now, we don global invalidates
-	 * in that case, might be worth testing the mm cpu mask though
-	 * and decide to use local invalidates instead...
+	 * flush now and return.
 	 */
 	if (!batch->active) {
-		flush_hash_page(vpn, rpte, psize, ssize, 0);
+		const struct cpumask *tmp;
+		int local = 0;
+
+		tmp = cpumask_of(smp_processor_id());
+		if (cpumask_equal(mm_cpumask(mm), tmp))
+			local = 1;
+
+		flush_hash_page(vpn, rpte, psize, ssize, local);
 		put_cpu_var(ppc64_tlb_batch);
 		return;
 	}
Signature · 1 line
2.9.3
#1 lore raw
Quoted 25 lines · Balbir Singh

Do the checks that __flush_tlb_pending() does and check if a local flush will do when batch->active is false inside of hpte_need_flush(). I've checked the changes with tlbie tracing, I see local flushes as applicable now and I've also run some basic ltp testcases on top of these changes on a powernv machine.

---
 arch/powerpc/mm/tlb_hash64.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
arch/powerpc/mm/tlb_hash64.c +1 -3
index 4517aa4..1268e3a 100644
@@ -93,12 +93,17 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
 
 	/*
 	 * Check if we have an active batch on this CPU. If not, just
-	 * flush now and return. For now, we don global invalidates
-	 * in that case, might be worth testing the mm cpu mask though
-	 * and decide to use local invalidates instead...
+	 * flush now and return.
 	 */

arch/powerpc/mm/tlb_hash64.c void hpte_need_flush(struct mm_struct *mm, unsigned long addr, · line 106

Quoted 10 lines
arch/powerpc/mm/tlb_hash64.c +8 -1
 	if (!batch->active) {
-		flush_hash_page(vpn, rpte, psize, ssize, 0);
+		const struct cpumask *tmp;
+		int local = 0;
+
+		tmp = cpumask_of(smp_processor_id());
+		if (cpumask_equal(mm_cpumask(mm), tmp))
+			local = 1;
+
+		flush_hash_page(vpn, rpte, psize, ssize, local);

Can you use mm_is_thread_local(). Also switch similar open coded paths when doing that ?

Quoted 5 lines
arch/powerpc/mm/tlb_hash64.c +0 -0
 		put_cpu_var(ppc64_tlb_batch);
 		return;
 	}
Signature · 1 line
2.9.3

-aneesh