From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Dan Malek <dan@embeddededge.com>
Cc: linux-ppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid
Date: Sat, 25 Jun 2005 11:53:18 -0300 [thread overview]
Message-ID: <20050625145318.GA32117@logos.cnet> (raw)
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;
next reply other threads:[~2005-06-25 21:16 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-25 14:53 Marcelo Tosatti [this message]
2005-06-25 22:24 ` [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050625145318.GA32117@logos.cnet \
--to=marcelo.tosatti@cyclades.com \
--cc=dan@embeddededge.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.