public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] FRV: Handle update_mmu_cache() being called when current->mm is NULL
@ 2008-04-10 15:00 David Howells
  2008-04-10 15:00 ` [PATCH 2/5] FRV: Move STACK_TOP_MAX up David Howells
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Howells @ 2008-04-10 15:00 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, dhowells

From: David Howells <dhowells@redhat.com>

Handle update_mmu_cache() being called when current->mm is NULL.

We cache static TLB mappings for the current page table in DAMPR4 and DAMPR5
on the theory that the next data lookup is likely to be in the same general
region, and thus is likely to be mapped by the same page table.  However, we
can't get this information if we can't access the appropriate mm_struct.

If current->mm is NULL, we just clear the cache in the knowledge that the TLB
miss handlers will load it.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile                  |   11 ++++++-----
 include/asm-frv/pgtable.h |   19 ++++++++++++++-----
 2 files changed, 20 insertions(+), 10 deletions(-)


diff --git a/Makefile b/Makefile
index fec2a12..54d4fb2 100644
--- a/Makefile
+++ b/Makefile
@@ -501,11 +501,12 @@ endif # $(dot-config)
 # Defaults vmlinux but it is usually overridden in the arch makefile
 all: vmlinux
 
-ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS	+= -Os
-else
-KBUILD_CFLAGS	+= -O2
-endif
+#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+#KBUILD_CFLAGS	+= -Os
+#else
+#KBUILD_CFLAGS	+= -O2
+#endif
+KBUILD_CFLAGS	+= -O1
 
 # Force gcc to behave correct even for buggy distributions
 # Arch Makefiles may override this setting
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 6c0682e..4e21904 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -507,13 +507,22 @@ static inline int pte_file(pte_t pte)
  */
 static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
 {
+	struct mm_struct *mm;
 	unsigned long ampr;
-	pgd_t *pge = pgd_offset(current->mm, address);
-	pud_t *pue = pud_offset(pge, address);
-	pmd_t *pme = pmd_offset(pue, address);
 
-	ampr = pme->ste[0] & 0xffffff00;
-	ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V;
+	mm = current->mm;
+	if (mm) {
+		pgd_t *pge = pgd_offset(mm, address);
+		pud_t *pue = pud_offset(pge, address);
+		pmd_t *pme = pmd_offset(pue, address);
+
+		ampr = pme->ste[0] & 0xffffff00;
+		ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C |
+			xAMPRx_V;
+	} else {
+		address = ULONG_MAX;
+		ampr = 0;
+	}
 
 	asm volatile("movgs %0,scr0\n"
 		     "movgs %0,scr1\n"


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

end of thread, other threads:[~2008-04-10 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 15:00 [PATCH 1/5] FRV: Handle update_mmu_cache() being called when current->mm is NULL David Howells
2008-04-10 15:00 ` [PATCH 2/5] FRV: Move STACK_TOP_MAX up David Howells
2008-04-10 15:00 ` [PATCH 3/5] FRV: Add support for emulation of userspace atomic ops David Howells
2008-04-10 15:00 ` [PATCH 4/5] FRV: Make NOMMU-mode work with base addresses other than 0xC0000000 David Howells
2008-04-10 15:00 ` [PATCH 5/5] FRV: Don't make smp_{r, w, }mb() interpolate MEMBAR when CONFIG_SMP=n David Howells
2008-04-10 15:06 ` [PATCH 1/5] FRV: Handle update_mmu_cache() being called when current->mm is NULL David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox