All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc64: Handle extremely large kernel TSB range flushes sanely.
@ 2016-10-26  2:44 David Miller
  2016-10-26  8:28 ` James Clarke
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: David Miller @ 2016-10-26  2:44 UTC (permalink / raw)
  To: sparclinux


If the number of pages we are flushing is more than twice the number
of entries in the TSB, just scan the TSB table for matches rather
than probing each and every page in the range.

Based upon a patch and report by James Clarke.

Signed-off-by: David S. Miller <davem@davemloft.net>
---

James this is the final version I pushed into the tree.

 arch/sparc/mm/tsb.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index f2b7711..e20fbba 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -27,6 +27,20 @@ static inline int tag_compare(unsigned long tag, unsigned long vaddr)
 	return (tag = (vaddr >> 22));
 }
 
+static void flush_tsb_kernel_range_scan(unsigned long start, unsigned long end)
+{
+	unsigned long idx;
+
+	for (idx = 0; idx < KERNEL_TSB_NENTRIES; idx++) {
+		struct tsb *ent = &swapper_tsb[idx];
+		unsigned long match = idx << 13;
+
+		match |= (ent->tag << 22);
+		if (match >= start && match < end)
+			ent->tag = (1UL << TSB_TAG_INVALID_BIT);
+	}
+}
+
 /* TSB flushes need only occur on the processor initiating the address
  * space modification, not on each cpu the address space has run on.
  * Only the TLB flush needs that treatment.
@@ -36,6 +50,9 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end)
 {
 	unsigned long v;
 
+	if ((end - start) >> PAGE_SHIFT >= 2 * KERNEL_TSB_NENTRIES)
+		return flush_tsb_kernel_range_scan(start, end);
+
 	for (v = start; v < end; v += PAGE_SIZE) {
 		unsigned long hash = tsb_hash(v, PAGE_SHIFT,
 					      KERNEL_TSB_NENTRIES);
-- 
2.1.2.532.g19b5d50


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-10-27 16:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-26  2:44 [PATCH] sparc64: Handle extremely large kernel TSB range flushes sanely David Miller
2016-10-26  8:28 ` James Clarke
2016-10-26 15:54 ` David Miller
2016-10-26 16:58 ` James Clarke
2016-10-26 17:09 ` David Miller
2016-10-26 17:21 ` James Clarke
2016-10-26 19:04 ` David Miller
2016-10-26 20:05 ` James Clarke
2016-10-26 21:02 ` David Miller
2016-10-27  1:27 ` James Clarke
2016-10-27  8:25 ` James Clarke
2016-10-27 15:51 ` David Miller
2016-10-27 16:02 ` James Clarke
2016-10-27 16:14 ` David Miller
2016-10-27 16:15 ` [PATCH] sparc64: Handle extremely large kernel TLB range flushes more gracefully David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.