Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add a real API for testing if a page is a managed page, ...
details: https://anonhg.NetBSD.org/src/rev/524dde29bb41
branches: trunk
changeset: 746715:524dde29bb41
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Aug 18 18:06:53 2009 +0000
description:
Add a real API for testing if a page is a managed page, and adjust callers
to stop relying on vm_physseg_find() for this purpose.
diffstat:
sys/arch/alpha/alpha/pmap.c | 10 ++++------
sys/arch/amiga/amiga/pmap.c | 7 +++----
sys/arch/atari/atari/pmap.c | 7 +++----
sys/arch/m68k/m68k/pmap_motorola.c | 7 +++----
sys/arch/mips/mips/pmap.c | 7 +++----
sys/arch/mips/mips/trap.c | 12 ++++++++----
sys/arch/powerpc/ibm4xx/pmap.c | 10 ++++------
sys/uvm/uvm_page.c | 15 +++++++++++++--
sys/uvm/uvm_page.h | 9 ++-------
9 files changed, 43 insertions(+), 41 deletions(-)
diffs (truncated from 309 to 300 lines):
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.239 2009/04/21 21:29:58 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.240 2009/08/18 18:06:53 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -140,7 +140,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.239 2009/04/21 21:29:58 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.240 2009/08/18 18:06:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -435,8 +435,6 @@
static struct pool_cache pmap_tlb_shootdown_job_cache;
#endif /* MULTIPROCESSOR */
-#define PAGE_IS_MANAGED(pa) (vm_physseg_find(atop(pa), NULL) != -1)
-
/*
* Internal routines
*/
@@ -1306,7 +1304,7 @@
l3pte = PMAP_KERNEL_PTE(sva);
if (pmap_pte_v(l3pte)) {
#ifdef DIAGNOSTIC
- if (PAGE_IS_MANAGED(pmap_pte_pa(l3pte)) &&
+ if (uvm_pageismanaged(pmap_pte_pa(l3pte)) &&
pmap_pte_pv(l3pte) == 0)
panic("pmap_remove: managed page "
"without PG_PVLIST for 0x%lx",
@@ -2760,7 +2758,7 @@
printf("\tpa = 0x%lx\n", pa);
#endif
#ifdef DIAGNOSTIC
- if (!PAGE_IS_MANAGED(pa))
+ if (!uvm_pageismanaged(pa))
panic("pmap_emulate_reference(%p, 0x%lx, %d, %d): "
"pa 0x%lx not managed", l, v, user, type, pa);
#endif
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/amiga/amiga/pmap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.152 2009/04/21 21:29:58 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.153 2009/08/18 18:06:53 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.152 2009/04/21 21:29:58 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.153 2009/08/18 18:06:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -321,8 +321,7 @@
#define PRM_CFLUSH 0x02
#define PRM_KEEPPTPAGE 0x04
-#define PAGE_IS_MANAGED(pa) (pmap_initialized \
- && vm_physseg_find(atop((pa)), NULL) != -1)
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
static inline struct pv_entry *pa_to_pvh(paddr_t pa);
static inline char *pa_to_attribute(paddr_t pa);
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/atari/atari/pmap.c
--- a/sys/arch/atari/atari/pmap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/atari/atari/pmap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.118 2009/04/21 21:29:59 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.119 2009/08/18 18:06:53 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2009/04/21 21:29:59 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2009/08/18 18:06:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -316,8 +316,7 @@
#define PRM_CFLUSH 0x02
#define PRM_KEEPPTPAGE 0x04
-#define PAGE_IS_MANAGED(pa) (pmap_initialized \
- && vm_physseg_find(atop((pa)), NULL) != -1)
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
static inline struct pv_entry *pa_to_pvh(paddr_t pa);
static inline char *pa_to_attribute(paddr_t pa);
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/m68k/m68k/pmap_motorola.c
--- a/sys/arch/m68k/m68k/pmap_motorola.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/m68k/m68k/pmap_motorola.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_motorola.c,v 1.44 2009/04/21 21:29:59 cegger Exp $ */
+/* $NetBSD: pmap_motorola.c,v 1.45 2009/08/18 18:06:53 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.44 2009/04/21 21:29:59 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.45 2009/08/18 18:06:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -270,8 +270,7 @@
void pmap_free_pv(struct pv_entry *);
void pmap_collect_pv(void);
-#define PAGE_IS_MANAGED(pa) (pmap_initialized && \
- vm_physseg_find(atop((pa)), NULL) != -1)
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
static inline struct pv_entry *pa_to_pvh(paddr_t pa);
static inline char *pa_to_attribute(paddr_t pa);
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/mips/mips/pmap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.183 2009/06/29 13:22:51 tsutsui Exp $ */
+/* $NetBSD: pmap.c,v 1.184 2009/08/18 18:06:53 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183 2009/06/29 13:22:51 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.184 2009/08/18 18:06:53 thorpej Exp $");
/*
* Manages physical address maps.
@@ -210,8 +210,7 @@
bool pmap_initialized = false;
-#define PAGE_IS_MANAGED(pa) \
- (pmap_initialized == true && vm_physseg_find(atop(pa), NULL) != -1)
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
#define PMAP_IS_ACTIVE(pm) \
((pm) == pmap_kernel() || \
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/mips/mips/trap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.218 2009/08/06 23:07:55 matt Exp $ */
+/* $NetBSD: trap.c,v 1.219 2009/08/18 18:06:53 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.218 2009/08/06 23:07:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.219 2009/08/18 18:06:53 thorpej Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ddb.h"
@@ -289,11 +289,13 @@
vaddr &= ~PGOFSET;
MachTLBUpdate(vaddr, entry);
pa = mips_tlbpfn_to_paddr(entry);
- if (!IS_VM_PHYSADDR(pa)) {
+#if defined(DIAGNOSTIC)
+ if (!uvm_pageismanaged(pa)) {
printf("ktlbmod: va %#lx pa %#llx\n",
vaddr, (long long)pa);
panic("ktlbmod: unmanaged page");
}
+#endif
pmap_set_modified(pa);
return; /* KERN */
}
@@ -324,11 +326,13 @@
(pmap->pm_asid << MIPS_TLB_PID_SHIFT);
MachTLBUpdate(vaddr, entry);
pa = mips_tlbpfn_to_paddr(entry);
- if (!IS_VM_PHYSADDR(pa)) {
+#if defined(DIAGNOSTIC)
+ if (!uvm_pageismanaged(pa)) {
printf("utlbmod: va %#lx pa %#llx\n",
vaddr, (long long)pa);
panic("utlbmod: unmanaged page");
}
+#endif
pmap_set_modified(pa);
if (type & T_USER)
userret(l);
diff -r 056aba84ec73 -r 524dde29bb41 sys/arch/powerpc/ibm4xx/pmap.c
--- a/sys/arch/powerpc/ibm4xx/pmap.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/arch/powerpc/ibm4xx/pmap.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.56 2009/08/11 17:04:19 matt Exp $ */
+/* $NetBSD: pmap.c,v 1.57 2009/08/18 18:06:53 thorpej Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.56 2009/08/11 17:04:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.57 2009/08/18 18:06:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -812,7 +812,7 @@
{
int s;
u_int tte;
- int managed;
+ bool managed;
/*
* Have to remove any existing mapping first.
@@ -822,9 +822,7 @@
if (flags & PMAP_WIRED)
flags |= prot;
- managed = 0;
- if (vm_physseg_find(atop(pa), NULL) != -1)
- managed = 1;
+ managed = uvm_pageismanaged(pa);
/*
* Generate TTE.
diff -r 056aba84ec73 -r 524dde29bb41 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/uvm/uvm_page.c Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.149 2009/08/11 16:27:08 matt Exp $ */
+/* $NetBSD: uvm_page.c,v 1.150 2009/08/18 18:06:53 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.149 2009/08/11 16:27:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.150 2009/08/18 18:06:53 thorpej Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@@ -1850,6 +1850,17 @@
}
/*
+ * uvm_pageismanaged: test it see that a page (specified by PA) is managed.
+ */
+
+bool
+uvm_pageismanaged(paddr_t pa)
+{
+
+ return (vm_physseg_find(atop(pa), NULL) != -1);
+}
+
+/*
* uvm_page_lookup_freelist: look up the free list for the specified page
*/
diff -r 056aba84ec73 -r 524dde29bb41 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h Tue Aug 18 18:00:28 2009 +0000
+++ b/sys/uvm/uvm_page.h Tue Aug 18 18:06:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.h,v 1.56 2009/01/16 02:33:14 yamt Exp $ */
+/* $NetBSD: uvm_page.h,v 1.57 2009/08/18 18:06:54 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -285,6 +285,7 @@
void uvm_pagewake(struct vm_page *);
void uvm_pagewire(struct vm_page *);
void uvm_pagezero(struct vm_page *);
+bool uvm_pageismanaged(paddr_t);
int uvm_page_lookup_freelist(struct vm_page *);
@@ -383,12 +384,6 @@
/*
Home |
Main Index |
Thread Index |
Old Index