linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid
@ 2005-06-25 14:53 Marcelo Tosatti
  2005-06-25 22:24 ` Dan Malek
  0 siblings, 1 reply; 30+ messages in thread
From: Marcelo Tosatti @ 2005-06-25 14:53 UTC (permalink / raw)
  To: Dan Malek; +Cc: linux-ppc-embedded


Hi,

The following patch adds code to skip flushing of tlb's in the pinned TLB region 
(assuming that it is contiguous), thus preserving the pinned region.

It also introduces CONFIG_DEBUG_PIN_TLBIE to catch for overlapping invalidates
(as suggested by Dan).

It could be smarter and aware of non-contiguous regions (instead of a simple 
<start,end> tuple), but I'm not sure if thats worth at the moment.

Dan: I dont think ioremap() is an issue because it never works inside the 
kernel's static virtual address space (which is the only one we're interested 
in having pinned at the moment).

Comments on improvements are very welcome.

tree d682449fa55448a446081d8e9fc0fed8f92bf812
parent f17c5c6e4e1d1b7e8b01f323dfd2bd2197a0743f
author Marcelo <marcelo@xeon.cnet> 1119729961 -0300
committer Marcelo Tosatti <marcelo.tosatti@cyclades.com> 1119729961 -0300

Introduce pin_area_start and pin_area_end to hold info about pinned area.

Use that information in map_page() to skip invalidation of TLB in case 
of overlapping address (to preserve the large pinned TLB).

Introduce a debugging aid in _tlbie() to catch overlapping invalidations, 
governed by CONFIG_DEBUG_PIN_TLBIE.

diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1296,6 +1296,11 @@ config BOOT_LOAD
 config PIN_TLB
 	bool "Pinned Kernel TLBs (860 ONLY)"
 	depends on ADVANCED_OPTIONS && 8xx
+
+config DEBUG_PIN_TLBIE
+	bool "Check for overlapping TLB invalidates inside the pinned area"
+	depends on ADVANCED_OPTIONS && 8xx && PIN_TLB
+
 endmenu
 
 source "drivers/Kconfig"
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -565,6 +565,19 @@ _GLOBAL(_tlbie)
 	SYNC_601
 	isync
 #else /* CONFIG_SMP */
+#ifdef CONFIG_DEBUG_PIN_TLBIE
+/* check if the address being invalidated overlaps with the pinned region */
+	lis	r4,(pin_area_start)@ha
+	lwz	r5,(pin_area_start)@l(4)
+	cmplw	r3, r5
+	blt	11f
+	lis	r4,(pin_area_end)@ha
+	lwz	r5,(pin_area_end)@l(4)
+	cmplw	r3, r5
+	bge	11f
+	trap
+#endif
+11:
 	tlbie	r3
 	sync
 #endif /* CONFIG_SMP */
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -112,6 +112,12 @@ unsigned long __max_memory;
 /* max amount of low RAM to map in */
 unsigned long __max_low_memory = MAX_LOW_MEM;
 
+/* should be a per-platform definition */
+#ifdef CONFIG_PIN_TLB
+unsigned long pin_area_start = KERNELBASE;
+unsigned long pin_area_end = KERNELBASE + 0x00800000;
+#endif
+
 void show_mem(void)
 {
 	int i,free = 0,total = 0,reserved = 0;
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
--- a/arch/ppc/mm/pgtable.c
+++ b/arch/ppc/mm/pgtable.c
@@ -274,6 +274,11 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
+#ifdef CONFIG_PIN_TLB
+extern unsigned long pin_area_start;
+extern unsigned long pin_area_end;
+#endif
+
 int
 map_page(unsigned long va, phys_addr_t pa, int flags)
 {
@@ -290,7 +295,10 @@ map_page(unsigned long va, phys_addr_t p
 		err = 0;
 		set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
 		if (mem_init_done)
-			flush_HPTE(0, va, pmd_val(*pd));
+#ifdef CONFIG_PIN_TLB
+			if (va < pin_area_start || va >= pin_area_end)
+#endif
+				flush_HPTE(0, va, pmd_val(*pd));
 	}
 	spin_unlock(&init_mm.page_table_lock);
 	return err;

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

end of thread, other threads:[~2005-07-05 13:10 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-25 14:53 [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid Marcelo Tosatti
2005-06-25 22:24 ` Dan Malek
2005-06-26 14:30   ` Marcelo Tosatti
2005-06-27 13:39     ` Marcelo Tosatti
2005-06-27 20:46       ` Dan Malek
2005-06-28  6:30         ` Benjamin Herrenschmidt
2005-06-28 13:42           ` [PATCH] 8xx: get_mmu_context() for (very) FEW_CONTEXTS and KERNEL_PREEMPT race/starvation issue Guillaume Autran
2005-06-29  4:15             ` Benjamin Herrenschmidt
2005-06-29 15:32               ` Guillaume Autran
2005-06-29 15:54                 ` Marcelo Tosatti
2005-06-29 21:25                   ` Guillaume Autran
2005-06-29 17:00                     ` Marcelo Tosatti
2005-06-29 23:26                   ` Benjamin Herrenschmidt
2005-06-29 19:38                     ` Marcelo Tosatti
2005-06-30 13:54                       ` Guillaume Autran
2005-07-05 13:12                         ` Guillaume Autran
2005-06-30  0:34                     ` Eugene Surovegin
2005-06-29 23:24                 ` Benjamin Herrenschmidt
2005-06-28 13:53           ` [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid Dan Malek
2005-06-28 23:47             ` Benjamin Herrenschmidt
2005-06-29 17:19             ` Marcelo Tosatti
2005-06-29 23:31               ` Benjamin Herrenschmidt
2005-06-30 18:05                 ` Dan Malek
2005-06-30 23:29                   ` Benjamin Herrenschmidt
2005-07-01  7:01                     ` Pantelis Antoniou
2005-06-30 17:49               ` Dan Malek
2005-06-27 14:28   ` [PATCH] 8xx: tlbie debugging aid (try #2) Marcelo Tosatti
2005-06-27 20:18     ` Dan Malek
2005-06-27 14:56       ` Marcelo Tosatti
2005-06-27 20:53         ` Dan Malek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).