CVS commit: src/sys/uvm/pmap

2024-04-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 18 12:16:23 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h

Log Message:
Fix types in pmap_page_clear_attributes so that the top bits of
the u_long mdpg_attrs aren't dropped giving atomic_cas_ulong no
chance of completing if any of the top bits is set.

Update pmap_page_set_attributes for consistency.

An ATF test run completed for me with this fix.

port-riscv/58006: ATF tests no longer complete on riscv-riscv64


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.77 src/sys/uvm/pmap/pmap.c:1.78
--- src/sys/uvm/pmap/pmap.c:1.77	Sat Mar 23 08:31:15 2024
+++ src/sys/uvm/pmap/pmap.c	Thu Apr 18 12:16:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -415,21 +415,21 @@ pmap_addr_range_check(pmap_t pmap, vaddr
  */
 
 bool
-pmap_page_clear_attributes(struct vm_page_md *mdpg, u_int clear_attributes)
+pmap_page_clear_attributes(struct vm_page_md *mdpg, u_long clear_attributes)
 {
-	volatile unsigned long * const attrp = >mdpg_attrs;
+	volatile u_long * const attrp = >mdpg_attrs;
 
 #ifdef MULTIPROCESSOR
 	for (;;) {
-		u_int old_attr = *attrp;
+		u_long old_attr = *attrp;
 		if ((old_attr & clear_attributes) == 0)
 			return false;
-		u_int new_attr = old_attr & ~clear_attributes;
+		u_long new_attr = old_attr & ~clear_attributes;
 		if (old_attr == atomic_cas_ulong(attrp, old_attr, new_attr))
 			return true;
 	}
 #else
-	unsigned long old_attr = *attrp;
+	u_long old_attr = *attrp;
 	if ((old_attr & clear_attributes) == 0)
 		return false;
 	*attrp &= ~clear_attributes;
@@ -438,7 +438,7 @@ pmap_page_clear_attributes(struct vm_pag
 }
 
 void
-pmap_page_set_attributes(struct vm_page_md *mdpg, u_int set_attributes)
+pmap_page_set_attributes(struct vm_page_md *mdpg, u_long set_attributes)
 {
 #ifdef MULTIPROCESSOR
 	atomic_or_ulong(>mdpg_attrs, set_attributes);

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.26 src/sys/uvm/pmap/pmap.h:1.27
--- src/sys/uvm/pmap/pmap.h:1.26	Thu Nov  3 18:55:07 2022
+++ src/sys/uvm/pmap/pmap.h	Thu Apr 18 12:16:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.26 2022/11/03 18:55:07 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.27 2024/04/18 12:16:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -296,8 +296,8 @@ extern pmap_segtab_t pmap_kern_segtab;
 
 bool	pmap_remove_all(pmap_t);
 void	pmap_set_modified(paddr_t);
-bool	pmap_page_clear_attributes(struct vm_page_md *, u_int);
-void	pmap_page_set_attributes(struct vm_page_md *, u_int);
+bool	pmap_page_clear_attributes(struct vm_page_md *, u_long);
+void	pmap_page_set_attributes(struct vm_page_md *, u_long);
 void	pmap_pvlist_lock_init(size_t);
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
 void	pmap_page_cache(struct vm_page_md *, bool);



CVS commit: src/sys/uvm/pmap

2024-04-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 18 12:16:23 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h

Log Message:
Fix types in pmap_page_clear_attributes so that the top bits of
the u_long mdpg_attrs aren't dropped giving atomic_cas_ulong no
chance of completing if any of the top bits is set.

Update pmap_page_set_attributes for consistency.

An ATF test run completed for me with this fix.

port-riscv/58006: ATF tests no longer complete on riscv-riscv64


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2024-03-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 23 08:31:15 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Default pmap_stealdebug to false


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.76 src/sys/uvm/pmap/pmap.c:1.77
--- src/sys/uvm/pmap/pmap.c:1.76	Tue Mar  5 13:16:29 2024
+++ src/sys/uvm/pmap/pmap.c	Sat Mar 23 08:31:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -367,7 +367,7 @@ kmutex_t pmap_pvlist_mutex	__cacheline_a
 
 #ifdef DEBUG
 
-bool pmap_stealdebug = true;
+bool pmap_stealdebug = false;
 
 #define DPRINTF(...)			 \
 do { if (pmap_stealdebug) { printf(__VA_ARGS__); } } while (false)



CVS commit: src/sys/uvm/pmap

2024-03-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 23 08:31:15 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Default pmap_stealdebug to false


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2024-03-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar  5 13:16:29 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Change the PMAP_STEAL_MEMORY debug output from aprint_debug.

The new printfs are conditional on pmap_stealdebug and the DEBUG compile
option. The former defaults to true, but can be changed at a boot -d ddb
prompt.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.75 src/sys/uvm/pmap/pmap.c:1.76
--- src/sys/uvm/pmap/pmap.c:1.75	Sun Feb 26 07:13:55 2023
+++ src/sys/uvm/pmap/pmap.c	Tue Mar  5 13:16:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.75 2023/02/26 07:13:55 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2023/02/26 07:13:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -366,6 +366,12 @@ kmutex_t pmap_pvlist_mutex	__cacheline_a
  */
 
 #ifdef DEBUG
+
+bool pmap_stealdebug = true;
+
+#define DPRINTF(...)			 \
+do { if (pmap_stealdebug) { printf(__VA_ARGS__); } } while (false)
+
 static inline void
 pmap_asid_check(pmap_t pm, const char *func)
 {
@@ -378,6 +384,10 @@ pmap_asid_check(pmap_t pm, const char *f
 		panic("%s: inconsistency for active TLB update: %u <-> %u",
 		func, asid, pai->pai_asid);
 }
+#else
+
+#define DPRINTF(...) __nothing
+
 #endif
 
 static void
@@ -564,7 +574,7 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 	size = round_page(size);
 	npgs = atop(size);
 
-	aprint_debug("%s: need %zu pages\n", __func__, npgs);
+	DPRINTF("%s: need %zu pages\n", __func__, npgs);
 
 	for (uvm_physseg_t bank = uvm_physseg_get_first();
 	 uvm_physseg_valid_p(bank);
@@ -573,19 +583,19 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 		if (uvm.page_init_done == true)
 			panic("pmap_steal_memory: called _after_ bootstrap");
 
-		aprint_debug("%s: seg %"PRIxPHYSSEG": %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR"\n",
+		DPRINTF("%s: seg %"PRIxPHYSSEG": %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR"\n",
 		__func__, bank,
 		uvm_physseg_get_avail_start(bank), uvm_physseg_get_start(bank),
 		uvm_physseg_get_avail_end(bank), uvm_physseg_get_end(bank));
 
 		if (uvm_physseg_get_avail_start(bank) != uvm_physseg_get_start(bank)
 		|| uvm_physseg_get_avail_start(bank) >= uvm_physseg_get_avail_end(bank)) {
-			aprint_debug("%s: seg %"PRIxPHYSSEG": bad start\n", __func__, bank);
+			DPRINTF("%s: seg %"PRIxPHYSSEG": bad start\n", __func__, bank);
 			continue;
 		}
 
 		if (uvm_physseg_get_avail_end(bank) - uvm_physseg_get_avail_start(bank) < npgs) {
-			aprint_debug("%s: seg %"PRIxPHYSSEG": too small for %zu pages\n",
+			DPRINTF("%s: seg %"PRIxPHYSSEG": too small for %zu pages\n",
 			__func__, bank, npgs);
 			continue;
 		}
@@ -614,7 +624,7 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 		pa = ptoa(uvm_physseg_get_start(bank));
 		uvm_physseg_unplug(atop(pa), npgs);
 
-		aprint_debug("%s: seg %"PRIxPHYSSEG": %zu pages stolen (%#"PRIxPADDR" left)\n",
+		DPRINTF("%s: seg %"PRIxPHYSSEG": %zu pages stolen (%#"PRIxPADDR" left)\n",
 		__func__, bank, npgs, VM_PHYSMEM_SPACE(bank));
 
 		va = pmap_md_map_poolpage(pa, size);



CVS commit: src/sys/uvm/pmap

2024-03-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar  5 13:16:29 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Change the PMAP_STEAL_MEMORY debug output from aprint_debug.

The new printfs are conditional on pmap_stealdebug and the DEBUG compile
option. The former defaults to true, but can be changed at a boot -d ddb
prompt.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2024-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  1 16:56:30 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Appease KASSERTs for zero ASID CPUs (I mean harts)


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct  6 08:48:16 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c pmap_tlb.h

Log Message:
Support CPUs that might not have ASIDs in the common pmap.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/uvm/pmap/pmap_tlb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/pmap/pmap_tlb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct  6 08:48:16 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c pmap_tlb.h

Log Message:
Support CPUs that might not have ASIDs in the common pmap.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/uvm/pmap/pmap_tlb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/pmap/pmap_tlb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.60 src/sys/uvm/pmap/pmap_tlb.c:1.61
--- src/sys/uvm/pmap/pmap_tlb.c:1.60	Tue Aug  1 08:17:26 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Fri Oct  6 08:48:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.61 2023/10/06 08:48:16 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.61 2023/10/06 08:48:16 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -830,6 +830,22 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info
 	KASSERT(ti->ti_asids_free > 0);
 	KASSERT(ti->ti_asid_hint > KERNEL_PID);
 
+	if (__predict_false(!tlbinfo_asids_p(ti))) {
+#if defined(MULTIPROCESSOR)
+		/*
+		 * Mark that we are active for all CPUs sharing this TLB.
+		 * The bits in pm_active belonging to this TLB can only
+		 * be changed  while this TLBs lock is held.
+		 */
+#if PMAP_TLB_MAX == 1
+		kcpuset_copy(pm->pm_active, kcpuset_running);
+#else
+		kcpuset_merge(pm->pm_active, ti->ti_kcpuset);
+#endif
+#endif
+		return;
+	}
+
 	/*
 	 * If the last ASID allocated was the maximum ASID, then the
 	 * hint will be out of range.  Reset the hint to first
@@ -937,7 +953,7 @@ pmap_tlb_asid_acquire(pmap_t pm, struct 
 		/*
 		 * If we've run out ASIDs, reinitialize the ASID space.
 		 */
-		if (__predict_false(tlbinfo_noasids_p(ti))) {
+		if (__predict_false(tlbinfo_asids_p(ti) && tlbinfo_noasids_p(ti))) {
 			KASSERT(l == curlwp);
 			UVMHIST_LOG(maphist, " asid reinit", 0, 0, 0, 0);
 			pmap_tlb_asid_reinitialize(ti, TLBINV_NOBODY);

Index: src/sys/uvm/pmap/pmap_tlb.h
diff -u src/sys/uvm/pmap/pmap_tlb.h:1.16 src/sys/uvm/pmap/pmap_tlb.h:1.17
--- src/sys/uvm/pmap/pmap_tlb.h:1.16	Wed Oct 26 07:35:20 2022
+++ src/sys/uvm/pmap/pmap_tlb.h	Fri Oct  6 08:48:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.h,v 1.16 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.h,v 1.17 2023/10/06 08:48:16 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -86,6 +86,10 @@
 # endif
 #endif
 
+#if !defined(PMAP_TLB_ALWAYS_ASIDS)
+#define	PMAP_TLB_ALWAYS_ASIDS	true
+#endif
+
 /*
  * Per TLB (normally same as CPU) asid info
  */
@@ -97,7 +101,7 @@ struct pmap_asid_info {
 #define	TLBINFO_LOCK(ti)		mutex_spin_enter((ti)->ti_lock)
 #define	TLBINFO_UNLOCK(ti)		mutex_spin_exit((ti)->ti_lock)
 #define	TLBINFO_OWNED(ti)		mutex_owned((ti)->ti_lock)
-#define	PMAP_PAI_ASIDVALID_P(pai, ti)	((pai)->pai_asid != 0)
+#define	PMAP_PAI_ASIDVALID_P(pai, ti)	(!tlbinfo_asids_p(ti) || (pai)->pai_asid != 0)
 #define	PMAP_PAI(pmap, ti)		(&(pmap)->pm_pai[tlbinfo_index(ti)])
 #define	PAI_PMAP(pai, ti)	\
 	((pmap_t)((intptr_t)(pai) \
@@ -188,5 +192,11 @@ void	pmap_tlb_asid_check(void);
 /* for ddb */
 void pmap_db_tlb_print(struct pmap *, void (*)(const char *, ...) __printflike(1, 2));
 
+static inline bool
+tlbinfo_asids_p(struct pmap_tlb_info *ti)
+{
+	return PMAP_TLB_ALWAYS_ASIDS || (ti)->ti_asid_max != 0;
+}
+
 #endif	/* _KERNEL */
 #endif	/* _UVM_PMAP_PMAP_TLB_H_ */



CVS commit: src/sys/uvm/pmap

2023-08-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug  1 08:17:26 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Improve debug


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.59 src/sys/uvm/pmap/pmap_tlb.c:1.60
--- src/sys/uvm/pmap/pmap_tlb.c:1.59	Mon Jun 12 06:47:17 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Tue Aug  1 08:17:26 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -568,7 +568,7 @@ pmap_tlb_shootdown_process(void)
 		struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti);
 		KASSERT(ti->ti_victim != pmap_kernel());
 		if (pmap_tlb_intersecting_onproc_p(ti->ti_victim, ti)) {
-			UVMHIST_LOG(maphist, "pmap_tlb_intersecting_onproc_p", 0, 0, 0, 0);
+			UVMHIST_LOG(maphist, "... onproc asid %jd", pai->pai_asid, 0, 0, 0);
 			/*
 			 * The victim is an active pmap so we will just
 			 * invalidate its TLB entries.
@@ -578,7 +578,7 @@ pmap_tlb_shootdown_process(void)
 			tlb_invalidate_asids(pai->pai_asid, pai->pai_asid);
 			pmap_tlb_asid_check();
 		} else if (pai->pai_asid) {
-			UVMHIST_LOG(maphist, "asid %jd", pai->pai_asid, 0, 0, 0);
+			UVMHIST_LOG(maphist, "... not active asid %jd", pai->pai_asid, 0, 0, 0);
 			/*
 			 * The victim is no longer an active pmap for this TLB.
 			 * So simply clear its ASID and when pmap_activate is



CVS commit: src/sys/uvm/pmap

2023-08-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug  1 08:17:26 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Improve debug


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul 23 07:25:36 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
KASSERT -> KASSERTMSG


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-07-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul 23 07:25:36 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
KASSERT -> KASSERTMSG


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.32 src/sys/uvm/pmap/pmap_segtab.c:1.33
--- src/sys/uvm/pmap/pmap_segtab.c:1.32	Sat Jul  1 07:10:13 2023
+++ src/sys/uvm/pmap/pmap_segtab.c	Sun Jul 23 07:25:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.33 2023/07/23 07:25:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.33 2023/07/23 07:25:36 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -282,7 +282,10 @@ pmap_ptpage(struct pmap *pmap, vaddr_t v
 
 //	UVMHIST_LOG(pmaphist, "pm_pdetab %#jx", ptb, 0, 0, 0);
 
-	KASSERT(pmap != pmap_kernel() || !pmap_md_direct_mapped_vaddr_p(va));
+	KASSERTMSG(pmap != pmap_kernel() || !pmap_md_direct_mapped_vaddr_p(va),
+	"pmap_kernel: %s, va %#" PRIxVADDR,
+	pmap == pmap_kernel() ? "true" : "false",
+	pmap == pmap_kernel() ? va : 0);
 
 #ifdef _LP64
 	for (size_t segshift = XSEGSHIFT;



CVS commit: src/sys/uvm/pmap

2023-07-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul  1 07:10:13 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Fix build when KERNHIST defined, but not UVMHIST


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.31 src/sys/uvm/pmap/pmap_segtab.c:1.32
--- src/sys/uvm/pmap/pmap_segtab.c:1.31	Wed Dec 21 11:39:46 2022
+++ src/sys/uvm/pmap/pmap_segtab.c	Sat Jul  1 07:10:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.31 2022/12/21 11:39:46 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.31 2022/12/21 11:39:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -557,7 +557,7 @@ pmap_pdetab_alloc(struct pmap *pmap)
 	UVMHIST_CALLARGS(pmapxtabhist, "pm %#jx", (uintptr_t)pmap, 0, 0, 0);
 
 	pmap_pdetab_t *ptb;
-#ifdef KERNHIST
+#ifdef UVMHIST
 	bool found_on_freelist = false;
 #endif
 
@@ -573,7 +573,7 @@ pmap_pdetab_alloc(struct pmap *pmap)
 
 		PDETAB_ADD(nget, 1);
 		ptb->pde_next = NULL;
-#ifdef KERNHIST
+#ifdef UVMHIST
 		found_on_freelist = true;
 #endif
 	}



CVS commit: src/sys/uvm/pmap

2023-07-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul  1 07:10:13 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Fix build when KERNHIST defined, but not UVMHIST


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:47:17 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:47:17 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.58 src/sys/uvm/pmap/pmap_tlb.c:1.59
--- src/sys/uvm/pmap/pmap_tlb.c:1.58	Mon Jun 12 06:36:28 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Mon Jun 12 06:47:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -1114,7 +1114,7 @@ void
 pmap_db_tlb_print(struct pmap *pm,
 void (*pr)(const char *, ...) __printflike(1, 2))
 {
-#if PMAP_TLB_MAX == 1
+#if !defined(MULTIPROCESSOR) || PMAP_TLB_MAX == 1
 	pr(" asid %5u\n", pm->pm_pai[0].pai_asid);
 #else
 	for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) {



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:36:28 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fixup UVMHIST builds


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.57 src/sys/uvm/pmap/pmap_tlb.c:1.58
--- src/sys/uvm/pmap/pmap_tlb.c:1.57	Sat Apr 22 10:22:43 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Mon Jun 12 06:36:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -557,14 +557,14 @@ pmap_tlb_shootdown_process(void)
 	__func__, ci->ci_cpl, IPL_SCHED);
 
 	TLBINFO_LOCK(ti);
-	UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0);
+	UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0);
 
 	switch (ti->ti_tlbinvop) {
 	case TLBINV_ONE: {
 		/*
 		 * We only need to invalidate one user ASID.
 		 */
-		UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", ti->ti_victim, 0, 0, 0);
+		UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", (uintptr_t)ti->ti_victim, 0, 0, 0);
 		struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti);
 		KASSERT(ti->ti_victim != pmap_kernel());
 		if (pmap_tlb_intersecting_onproc_p(ti->ti_victim, ti)) {
@@ -674,7 +674,7 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 		KASSERT(i < pmap_ntlbs);
 		struct pmap_tlb_info * const ti = pmap_tlbs[i];
 		KASSERT(tlbinfo_index(ti) == i);
-		UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0);
+		UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0);
 		/*
 		 * Skip this TLB if there are no active mappings for it.
 		 */



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:36:28 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fixup UVMHIST builds


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-04-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 27 06:23:31 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_devmap.c

Log Message:
Correct a type.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/uvm/pmap/pmap_devmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-04-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 27 06:23:31 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_devmap.c

Log Message:
Correct a type.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/uvm/pmap/pmap_devmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_devmap.c
diff -u src/sys/uvm/pmap/pmap_devmap.c:1.1 src/sys/uvm/pmap/pmap_devmap.c:1.2
--- src/sys/uvm/pmap/pmap_devmap.c:1.1	Thu Apr 20 08:28:02 2023
+++ src/sys/uvm/pmap/pmap_devmap.c	Thu Apr 27 06:23:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_devmap.c,v 1.1 2023/04/20 08:28:02 skrll Exp $	*/
+/*	$NetBSD: pmap_devmap.c,v 1.2 2023/04/27 06:23:31 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_devmap.c,v 1.1 2023/04/20 08:28:02 skrll Exp $");
+__RCSID("$NetBSD: pmap_devmap.c,v 1.2 2023/04/27 06:23:31 skrll Exp $");
 
 
 #include 
@@ -91,7 +91,7 @@ pmap_devmap_bootstrap(vaddr_t root, cons
 	for (size_t i = 0; table[i].pd_size != 0; i++) {
 		const struct pmap_devmap * const pdp = [i];
 		const vaddr_t vmax = __type_max_u(vaddr_t);
-		const vaddr_t pmax = __type_max_u(paddr_t);
+		const paddr_t pmax = __type_max_u(paddr_t);
 
 		KASSERT(pdp->pd_size != 0);
 		KASSERTMSG(vmax - pdp->pd_va >= pdp->pd_size - 1,



CVS commit: src/sys/uvm/pmap

2023-04-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 22 10:22:43 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
KASSERT(kpreempt_disabled()) before accessing curcpu()


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-04-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 22 10:22:43 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
KASSERT(kpreempt_disabled()) before accessing curcpu()


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.56 src/sys/uvm/pmap/pmap_tlb.c:1.57
--- src/sys/uvm/pmap/pmap_tlb.c:1.56	Sun Feb 19 07:20:44 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Sat Apr 22 10:22:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -655,7 +655,10 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, "pm %#jx", (uintptr_t)pm, 0, 0, 0);
 
+	KASSERT(kpreempt_disabled());
+
 	const struct cpu_info * const ci = curcpu();
+
 	kcpuset_t *pm_active = ci->ci_shootdowncpus;
 	kcpuset_copy(pm_active, pm->pm_active);
 	kcpuset_remove(pm_active, cpu_tlb_info(curcpu())->ti_kcpuset);
@@ -745,6 +748,8 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 int
 pmap_tlb_update_addr(pmap_t pm, vaddr_t va, pt_entry_t pte, u_int flags)
 {
+	KASSERT(kpreempt_disabled());
+
 	struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
 	struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
 	int rv = -1;
@@ -753,8 +758,6 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t 
 	UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx, pte=%#jx flags=%#jx)",
 	(uintptr_t)pm, va, pte_value(pte), flags);
 
-	KASSERT(kpreempt_disabled());
-
 	KASSERTMSG(pte_valid_p(pte), "va %#"PRIxVADDR" %#"PRIxPTE,
 	va, pte_value(pte));
 
@@ -785,6 +788,8 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t 
 void
 pmap_tlb_invalidate_addr(pmap_t pm, vaddr_t va)
 {
+	KASSERT(kpreempt_disabled());
+
 	struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
 	struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
 
@@ -792,8 +797,6 @@ pmap_tlb_invalidate_addr(pmap_t pm, vadd
 	UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx) ti=%#jx asid=%#jx",
 	(uintptr_t)pm, va, (uintptr_t)ti, pai->pai_asid);
 
-	KASSERT(kpreempt_disabled());
-
 	TLBINFO_LOCK(ti);
 	if (pm == pmap_kernel() || PMAP_PAI_ASIDVALID_P(pai, ti)) {
 		pmap_tlb_asid_check();
@@ -908,6 +911,8 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info
 void
 pmap_tlb_asid_acquire(pmap_t pm, struct lwp *l)
 {
+	KASSERT(kpreempt_disabled());
+
 	struct cpu_info * const ci = l->l_cpu;
 	struct pmap_tlb_info * const ti = cpu_tlb_info(ci);
 	struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
@@ -916,8 +921,6 @@ pmap_tlb_asid_acquire(pmap_t pm, struct 
 	UVMHIST_CALLARGS(maphist, "(pm=%#jx, l=%#jx, ti=%#jx)", (uintptr_t)pm,
 	(uintptr_t)l, (uintptr_t)ti, 0);
 
-	KASSERT(kpreempt_disabled());
-
 	/*
 	 * Kernels use a fixed ASID and thus doesn't need to acquire one.
 	 */



CVS commit: src/sys/uvm/pmap

2023-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 19 07:20:44 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Spaces to TABs. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.55 src/sys/uvm/pmap/pmap_tlb.c:1.56
--- src/sys/uvm/pmap/pmap_tlb.c:1.55	Mon Nov  7 07:28:04 2022
+++ src/sys/uvm/pmap/pmap_tlb.c	Sun Feb 19 07:20:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -1114,9 +1114,9 @@ pmap_db_tlb_print(struct pmap *pm,
 #if PMAP_TLB_MAX == 1
 	pr(" asid %5u\n", pm->pm_pai[0].pai_asid);
 #else
-for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) {
-pr(" tlb %zu  asid %5u\n", i, pm->pm_pai[i].pai_asid);
-}
+	for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) {
+		pr(" tlb %zu  asid %5u\n", i, pm->pm_pai[i].pai_asid);
+	}
 #endif
 }
 #endif /* DDB */



CVS commit: src/sys/uvm/pmap

2023-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 19 07:20:44 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Spaces to TABs. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-11-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov  7 07:28:04 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix UVMHIST build


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.54 src/sys/uvm/pmap/pmap_tlb.c:1.55
--- src/sys/uvm/pmap/pmap_tlb.c:1.54	Wed Oct 26 07:35:20 2022
+++ src/sys/uvm/pmap/pmap_tlb.c	Mon Nov  7 07:28:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.54 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.54 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -1078,19 +1078,19 @@ void
 pmap_tlb_asid_check(void)
 {
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLED(maphist);
 
 #ifdef DEBUG
 	kpreempt_disable();
 	const tlb_asid_t asid __debugused = tlb_get_asid();
-	UVMHIST_LOG(pmaphist, " asid %u vs pmap_cur_asid %u", asid,
+	UVMHIST_LOG(maphist, " asid %u vs pmap_cur_asid %u", asid,
 	curcpu()->ci_pmap_asid_cur, 0, 0);
 	KDASSERTMSG(asid == curcpu()->ci_pmap_asid_cur,
 	   "%s: asid (%#x) != current asid (%#x)",
 	__func__, asid, curcpu()->ci_pmap_asid_cur);
 	kpreempt_enable();
 #endif
-	UVMHIST_LOG(pmaphist, " <-- done", 0, 0, 0, 0);
+	UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0);
 }
 
 #ifdef DEBUG



CVS commit: src/sys/uvm/pmap

2022-11-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov  7 07:28:04 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix UVMHIST build


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-11-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  3 18:55:07 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
_KERNEL_OPT protection


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.25 src/sys/uvm/pmap/pmap.h:1.26
--- src/sys/uvm/pmap/pmap.h:1.25	Thu Nov  3 09:04:57 2022
+++ src/sys/uvm/pmap/pmap.h	Thu Nov  3 18:55:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.25 2022/11/03 09:04:57 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.26 2022/11/03 18:55:07 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -71,7 +71,9 @@
  *	@(#)pmap.h	8.1 (Berkeley) 6/10/93
  */
 
+#ifdef _KERNEL_OPT
 #include "opt_efi.h"
+#endif
 
 #ifndef	_UVM_PMAP_PMAP_H_
 #define	_UVM_PMAP_PMAP_H_



CVS commit: src/sys/uvm/pmap

2022-11-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  3 18:55:07 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
_KERNEL_OPT protection


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  2 08:05:17 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.72 src/sys/uvm/pmap/pmap.c:1.73
--- src/sys/uvm/pmap/pmap.c:1.72	Fri Oct 28 07:16:34 2022
+++ src/sys/uvm/pmap/pmap.c	Wed Nov  2 08:05:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.73 2022/11/02 08:05:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2022/11/02 08:05:17 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -880,7 +880,7 @@ pmap_page_remove(struct vm_page_md *mdpg
 	}
 
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
-	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE|VM_PAGEMD_UNCACHED);
+	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE | VM_PAGEMD_UNCACHED);
 #else
 	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE);
 #endif
@@ -1166,13 +1166,13 @@ pmap_page_protect(struct vm_page *pg, vm
 	PMAP_COUNT(page_protect);
 
 	switch (prot) {
-	case VM_PROT_READ|VM_PROT_WRITE:
+	case VM_PROT_READ | VM_PROT_WRITE:
 	case VM_PROT_ALL:
 		break;
 
 	/* copy_on_write */
 	case VM_PROT_READ:
-	case VM_PROT_READ|VM_PROT_EXECUTE:
+	case VM_PROT_READ | VM_PROT_EXECUTE:
 		pv = >mdpg_first;
 		kpreempt_disable();
 		VM_PAGEMD_PVLIST_READLOCK(mdpg);
@@ -1415,7 +1415,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 	if (mdpg) {
 		/* Set page referenced/modified status based on flags */
 		if (flags & VM_PROT_WRITE) {
-			pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED|VM_PAGEMD_REFERENCED);
+			pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED | VM_PAGEMD_REFERENCED);
 		} else if (flags & VM_PROT_ALL) {
 			pmap_page_set_attributes(mdpg, VM_PAGEMD_REFERENCED);
 		}
@@ -1941,7 +1941,7 @@ pmap_set_modified(paddr_t pa)
 {
 	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
-	pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED|VM_PAGEMD_REFERENCED);
+	pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED | VM_PAGEMD_REFERENCED);
 }
 
 / pv_entry management /



CVS commit: src/sys/uvm/pmap

2022-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  2 08:05:17 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:49:51 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
In pmap_pte_reserve ensure we're atomically swapping out an invalid entry
otherwise concurrent updates might both think they've updated the entry.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.29 src/sys/uvm/pmap/pmap_segtab.c:1.30
--- src/sys/uvm/pmap/pmap_segtab.c:1.29	Wed Oct 26 07:35:20 2022
+++ src/sys/uvm/pmap/pmap_segtab.c	Thu Oct 27 06:49:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1161,8 +1161,7 @@ pmap_pte_reserve(pmap_t pmap, vaddr_t va
 		pd_entry_t npde = pte_pde_ptpage(pa, pmap == pmap_kernel());
 #endif
 #if defined(PMAP_HWPAGEWALKER) && defined(PMAP_MAP_PDETABPAGE)
-		pd_entry_t opde = *pde_p;
-		opde = pte_pde_cas(pde_p, opde, npde);
+		pd_entry_t opde = pte_pde_cas(pde_p, pte_invalid_pde(), npde);
 		if (__predict_false(pte_pde_valid_p(opde))) {
 			pmap_ptpage_free(pmap, ppg, __func__);
 			ppg = pmap_pde_to_ptpage(opde);



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:49:51 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
In pmap_pte_reserve ensure we're atomically swapping out an invalid entry
otherwise concurrent updates might both think they've updated the entry.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:20:41 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
No need to hold the pmap_tlb_miss_lock when calling pmap_segtab_destroy


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.70 src/sys/uvm/pmap/pmap.c:1.71
--- src/sys/uvm/pmap/pmap.c:1.70	Thu Oct 27 06:19:56 2022
+++ src/sys/uvm/pmap/pmap.c	Thu Oct 27 06:20:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -764,8 +764,8 @@ pmap_destroy(pmap_t pmap)
 	kpreempt_disable();
 	pmap_tlb_miss_lock_enter();
 	pmap_tlb_asid_release_all(pmap);
-	pmap_segtab_destroy(pmap, NULL, 0);
 	pmap_tlb_miss_lock_exit();
+	pmap_segtab_destroy(pmap, NULL, 0);
 
 	KASSERT(TAILQ_EMPTY(>pm_ppg_list));
 



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:20:41 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
No need to hold the pmap_tlb_miss_lock when calling pmap_segtab_destroy


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:19:56 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h

Log Message:
Rename pm_count to pm_refcnt


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.23 -r1.24 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.69 src/sys/uvm/pmap/pmap.c:1.70
--- src/sys/uvm/pmap/pmap.c:1.69	Wed Oct 26 07:35:20 2022
+++ src/sys/uvm/pmap/pmap.c	Thu Oct 27 06:19:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.69 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.69 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -223,7 +223,7 @@ pmap_segtab_t	pmap_kern_segtab PMAP_SEGT
 
 struct pmap_kernel kernel_pmap_store = {
 	.kernel_pmap = {
-		.pm_count = 1,
+		.pm_refcnt = 1,
 #ifdef PMAP_HWPAGEWALKER
 		.pm_pdetab = PMAP_INVALID_PDETAB_ADDRESS,
 #endif
@@ -707,7 +707,7 @@ pmap_create(void)
 
 	KASSERT(pmap->pm_pai[0].pai_link.le_prev == NULL);
 
-	pmap->pm_count = 1;
+	pmap->pm_refcnt = 1;
 	pmap->pm_minaddr = VM_MIN_ADDRESS;
 	pmap->pm_maxaddr = VM_MAXUSER_ADDRESS;
 
@@ -751,7 +751,7 @@ pmap_destroy(pmap_t pmap)
 	UVMHIST_CALLARGS(pmapxtabhist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
 
 	membar_release();
-	if (atomic_dec_uint_nv(>pm_count) > 0) {
+	if (atomic_dec_uint_nv(>pm_refcnt) > 0) {
 		PMAP_COUNT(dereference);
 		UVMHIST_LOG(pmaphist, " <-- done (deref)", 0, 0, 0, 0);
 		UVMHIST_LOG(pmapxtabhist, " <-- done (deref)", 0, 0, 0, 0);
@@ -760,7 +760,7 @@ pmap_destroy(pmap_t pmap)
 	membar_acquire();
 
 	PMAP_COUNT(destroy);
-	KASSERT(pmap->pm_count == 0);
+	KASSERT(pmap->pm_refcnt == 0);
 	kpreempt_disable();
 	pmap_tlb_miss_lock_enter();
 	pmap_tlb_asid_release_all(pmap);
@@ -807,7 +807,7 @@ pmap_reference(pmap_t pmap)
 	PMAP_COUNT(reference);
 
 	if (pmap != NULL) {
-		atomic_inc_uint(>pm_count);
+		atomic_inc_uint(>pm_refcnt);
 	}
 
 	UVMHIST_LOG(pmaphist, " <-- done", 0, 0, 0, 0);

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.23 src/sys/uvm/pmap/pmap.h:1.24
--- src/sys/uvm/pmap/pmap.h:1.23	Thu Oct 27 05:33:37 2022
+++ src/sys/uvm/pmap/pmap.h	Thu Oct 27 06:19:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.23 2022/10/27 05:33:37 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.24 2022/10/27 06:19:56 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -189,7 +189,7 @@ extern kmutex_t pmap_segtab_lock;
  */
 struct pmap {
 	struct uvm_object	pm_uobject;
-#define pm_count		pm_uobject.uo_refs /* pmap reference count */
+#define pm_refcnt		pm_uobject.uo_refs /* pmap reference count */
 #define pm_pvp_list		pm_uobject.memq
 
 	krwlock_t		pm_obj_lock;	/* lock for pm_uobject */



CVS commit: src/sys/uvm/pmap

2022-10-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 06:19:56 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h

Log Message:
Rename pm_count to pm_refcnt


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.23 -r1.24 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 05:33:37 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Fix the crash(1) build for mips platforms


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.22 src/sys/uvm/pmap/pmap.h:1.23
--- src/sys/uvm/pmap/pmap.h:1.22	Wed Oct 26 07:35:20 2022
+++ src/sys/uvm/pmap/pmap.h	Thu Oct 27 05:33:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.22 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.23 2022/10/27 05:33:37 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -225,6 +225,8 @@ struct pmap {
 	struct pmap_asid_info	pm_pai[1];
 };
 
+
+#ifdef	_KERNEL
 static inline void
 pmap_lock(struct pmap *pm)
 {
@@ -239,7 +241,6 @@ pmap_unlock(struct pmap *pm)
 	rw_exit(pm->pm_lock);
 }
 
-#ifdef	_KERNEL
 struct pmap_kernel {
 	struct pmap kernel_pmap;
 #if defined(MULTIPROCESSOR) && PMAP_TLB_MAX > 1



CVS commit: src/sys/uvm/pmap

2022-10-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 27 05:33:37 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Fix the crash(1) build for mips platforms


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 23 06:37:15 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Correct the pmap_kstart_segtab entry in pmap_kern_segtab


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.67 src/sys/uvm/pmap/pmap.c:1.68
--- src/sys/uvm/pmap/pmap.c:1.67	Thu Sep 15 06:44:18 2022
+++ src/sys/uvm/pmap/pmap.c	Sun Oct 23 06:37:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.68 2022/10/23 06:37:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 2022/10/23 06:37:15 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -202,7 +202,7 @@ pmap_segtab_t	pmap_kstart_segtab PMAP_SE
 #endif
 pmap_segtab_t	pmap_kern_segtab PMAP_SEGTAB_ALIGN = { /* top level segtab for kernel */
 #ifdef _LP64
-	.seg_seg[(VM_MIN_KERNEL_ADDRESS & XSEGOFSET) >> SEGSHIFT] = _kstart_segtab,
+	.seg_seg[(VM_MIN_KERNEL_ADDRESS >> XSEGSHIFT) & (NSEGPG - 1)] = _kstart_segtab,
 #endif
 };
 



CVS commit: src/sys/uvm/pmap

2022-10-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 23 06:37:15 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Correct the pmap_kstart_segtab entry in pmap_kern_segtab


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 20 06:24:51 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Add a KASSERT to check that tlb_asid_t is a large enough type.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.52 src/sys/uvm/pmap/pmap_tlb.c:1.53
--- src/sys/uvm/pmap/pmap_tlb.c:1.52	Fri Mar  4 08:11:48 2022
+++ src/sys/uvm/pmap/pmap_tlb.c	Thu Oct 20 06:24:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.53 2022/10/20 06:24:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.53 2022/10/20 06:24:51 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -384,6 +384,7 @@ pmap_tlb_info_init(struct pmap_tlb_info 
 		ti->ti_asids_free = TLBINFO_ASID_INITIAL_FREE(ti->ti_asid_max);
 	}
 
+	KASSERT(__type_fit(tlb_asid_t, ti->ti_asid_max + 1));
 	KASSERT(ti->ti_asid_max < PMAP_TLB_BITMAP_LENGTH);
 }
 



CVS commit: src/sys/uvm/pmap

2022-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 20 06:24:51 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Add a KASSERT to check that tlb_asid_t is a large enough type.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 15 06:44:18 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
whitespace - remove spaces before tabs


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 15 06:44:18 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
whitespace - remove spaces before tabs


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.66 src/sys/uvm/pmap/pmap.c:1.67
--- src/sys/uvm/pmap/pmap.c:1.66	Mon Sep 12 07:38:32 2022
+++ src/sys/uvm/pmap/pmap.c	Thu Sep 15 06:44:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -253,7 +253,7 @@ u_int	pmap_page_colormask;
 #define PAGE_IS_MANAGED(pa)	(pmap_initialized && uvm_pageismanaged(pa))
 
 #define PMAP_IS_ACTIVE(pm)		\
-	((pm) == pmap_kernel() || 	\
+	((pm) == pmap_kernel() ||	\
 	 (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
 
 /* Forward function declarations */
@@ -290,7 +290,7 @@ struct pool_allocator pmap_pv_page_alloc
 #define	pmap_tlb_miss_lock_enter()	pmap_md_tlb_miss_lock_enter()
 #define	pmap_tlb_miss_lock_exit()	pmap_md_tlb_miss_lock_exit()
 #else
-kmutex_t pmap_tlb_miss_lock 		__cacheline_aligned;
+kmutex_t pmap_tlb_miss_lock		__cacheline_aligned;
 
 static void
 pmap_tlb_miss_lock_init(void)
@@ -1369,7 +1369,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 	if (resident) {
 		if (pte_to_paddr(opte) != pa) {
 			KASSERT(!is_kernel_pmap_p);
-			const pt_entry_t rpte = pte_nv_entry(false);
+			const pt_entry_t rpte = pte_nv_entry(false);
 
 			pmap_addr_range_check(pmap, va, va + NBPG, __func__);
 			pmap_pte_process(pmap, va, va + NBPG, pmap_pte_remove,
@@ -1870,7 +1870,7 @@ pmap_pvlist_check(struct vm_page_md *mdp
 		colors, VM_PAGEMD_UNCACHED_P(mdpg));
 #endif
 	} else {
-		KASSERT(pv->pv_next == NULL);
+		KASSERT(pv->pv_next == NULL);
 	}
 #endif /* DEBUG */
 }



CVS commit: src/sys/uvm/pmap

2022-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 12 07:38:32 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
A simplification and some minor whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 12 07:38:32 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
A simplification and some minor whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.65 src/sys/uvm/pmap/pmap.c:1.66
--- src/sys/uvm/pmap/pmap.c:1.65	Sat May  7 06:53:16 2022
+++ src/sys/uvm/pmap/pmap.c	Mon Sep 12 07:38:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -984,14 +984,14 @@ pmap_update(struct pmap *pmap)
 
 static bool
 pmap_pte_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva, pt_entry_t *ptep,
-	uintptr_t flags)
+uintptr_t flags)
 {
 	const pt_entry_t npte = flags;
 	const bool is_kernel_pmap_p = (pmap == pmap_kernel());
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx kernel=%jd va=%#jx..%#jx)",
-	(uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), sva, eva);
+	(uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva);
 	UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx)",
 	(uintptr_t)ptep, flags, 0, 0);
 
@@ -1626,7 +1626,7 @@ pmap_unwire(pmap_t pmap, vaddr_t va)
 	pmap, va);
 	pt_entry_t pte = *ptep;
 	KASSERTMSG(pte_valid_p(pte),
-	"pmap %p va %#"PRIxVADDR" invalid PTE %#"PRIxPTE" @ %p",
+	"pmap %p va %#" PRIxVADDR " invalid PTE %#" PRIxPTE " @ %p",
 	pmap, va, pte_value(pte), ptep);
 
 	if (pte_wired_p(pte)) {



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:03:02 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Oops, correct misleading #endif comment.

It seems I need a cup of coffee...


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.14 src/sys/uvm/pmap/pmap_pvt.c:1.15
--- src/sys/uvm/pmap/pmap_pvt.c:1.14	Sun May  8 22:00:06 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 22:03:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.15 2022/05/08 22:03:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.15 2022/05/08 22:03:02 rin Exp $");
 
 #include 
 #include 
@@ -219,4 +219,4 @@ pmap_pv_untrack(paddr_t start, psize_t s
 }
 #endif /* notdef */
 
-#endif /* !PMAP_PV_TRACK_ONLY_STUBS */
+#endif /* PMAP_PV_TRACK_ONLY_STUBS */



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:03:02 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Oops, correct misleading #endif comment.

It seems I need a cup of coffee...


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:00:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Improve wording a bit in a comment for the previous.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.13 src/sys/uvm/pmap/pmap_pvt.c:1.14
--- src/sys/uvm/pmap/pmap_pvt.c:1.13	Sun May  8 21:55:34 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 22:00:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $");
 
 #include 
 #include 
@@ -201,8 +201,8 @@ pmap_pv_tracked(paddr_t pa)
  * pmap_pv_{,un}track() are intentionally commented out. If modules
  * call these functions, the result should be an inconsistent state.
  *
- * Such modules require real PV-tracking support. Let us make two
- * symbols undefined, and prevent these modules from loaded.
+ * Such modules require real PV-tracking support. Let us make the
+ * two symbols undefined, and prevent these modules from loaded.
  */
 void
 pmap_pv_track(paddr_t start, psize_t size)



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:00:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Improve wording a bit in a comment for the previous.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 21:55:35 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
For PMAP_PV_TRACK_ONLY_STUBS, comment out pmap_pv_{,un}track().

If modules call these functions, the result should be an
inconsistent state.

Such modules require real PV-tracking support, anyway.

The best we can do should be to make two symbols undefined, and
prevent these modules from loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.12 src/sys/uvm/pmap/pmap_pvt.c:1.13
--- src/sys/uvm/pmap/pmap_pvt.c:1.12	Sat May  7 06:53:16 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 21:55:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $");
 
 #include 
 #include 
@@ -189,22 +189,34 @@ pmap_pv_init(void)
 
 }
 
-void
-pmap_pv_track(paddr_t start, psize_t size)
+struct pmap_page *
+pmap_pv_tracked(paddr_t pa)
 {
 
+	return NULL;
 }
 
+#if notdef
+/*
+ * pmap_pv_{,un}track() are intentionally commented out. If modules
+ * call these functions, the result should be an inconsistent state.
+ *
+ * Such modules require real PV-tracking support. Let us make two
+ * symbols undefined, and prevent these modules from loaded.
+ */
 void
-pmap_pv_untrack(paddr_t start, psize_t size)
+pmap_pv_track(paddr_t start, psize_t size)
 {
 
+	panic("PV-tracking not supported");
 }
 
-struct pmap_page *
-pmap_pv_tracked(paddr_t pa)
+void
+pmap_pv_untrack(paddr_t start, psize_t size)
 {
 
-	return NULL;
+	panic("PV-tracking not supported");
 }
-#endif
+#endif /* notdef */
+
+#endif /* !PMAP_PV_TRACK_ONLY_STUBS */



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 21:55:35 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
For PMAP_PV_TRACK_ONLY_STUBS, comment out pmap_pv_{,un}track().

If modules call these functions, the result should be an
inconsistent state.

Such modules require real PV-tracking support, anyway.

The best we can do should be to make two symbols undefined, and
prevent these modules from loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 06:53:16 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_pvt.c

Log Message:
Introduce PMAP_PV_TRACK_ONLY_STUBS option, by which only empty stubs for
global functions in pmap_pvt.h are provided, instead of real support for
PV tracking.

Necessary for powerpc: Only one sub-arch (oea) has PV tracking support.
Others (booke/ibm4xx) do not at the moment (probably never for ibm4xx),
but __HAVE_PMAP_PV_TRACK is necessary, so that modules can be shared by
all of sub-archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.64 src/sys/uvm/pmap/pmap.c:1.65
--- src/sys/uvm/pmap/pmap.c:1.64	Sat Apr  9 23:38:33 2022
+++ src/sys/uvm/pmap/pmap.c	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.64 2022/04/09 23:38:33 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.64 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $");
 
 /*
  *	Manages physical address maps.
@@ -120,6 +120,10 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.6
  PMAP_NO_PV_UNCACHED to be defined
 #endif
 
+#if defined(PMAP_PV_TRACK_ONLY_STUBS)
+#undef	__HAVE_PMAP_PV_TRACK
+#endif
+
 PMAP_COUNTER(remove_kernel_calls, "remove kernel calls");
 PMAP_COUNTER(remove_kernel_pages, "kernel pages unmapped");
 PMAP_COUNTER(remove_user_calls, "remove user calls");

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.20 src/sys/uvm/pmap/pmap.h:1.21
--- src/sys/uvm/pmap/pmap.h:1.20	Fri Mar 19 07:51:33 2021
+++ src/sys/uvm/pmap/pmap.h	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.20 2021/03/19 07:51:33 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.21 2022/05/07 06:53:16 rin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -203,7 +203,7 @@ void	pmap_pvlist_lock_init(size_t);
 void	pmap_page_cache(struct vm_page_md *, bool);
 #endif
 
-#ifdef __HAVE_PMAP_PV_TRACK
+#if defined(__HAVE_PMAP_PV_TRACK) && !defined(PMAP_PV_TRACK_ONLY_STUBS)
 void	pmap_pv_protect(paddr_t, vm_prot_t);
 #endif
 

Index: src/sys/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.11 src/sys/uvm/pmap/pmap_pvt.c:1.12
--- src/sys/uvm/pmap/pmap_pvt.c:1.11	Wed Jul 21 06:35:45 2021
+++ src/sys/uvm/pmap/pmap_pvt.c	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.11 2021/07/21 06:35:45 skrll Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.11 2021/07/21 06:35:45 skrll Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __RCSID("$NetBSD: pmap_pvt.c,v 1.11 2021
 #include 
 #include 
 
+#if !defined(PMAP_PV_TRACK_ONLY_STUBS)
 /*
  * unmanaged pv-tracked ranges
  *
@@ -177,3 +178,33 @@ pmap_pv_tracked(paddr_t pa)
 	return >pvt_pages[pgno];
 }
 
+#else /* PMAP_PV_TRACK_ONLY_STUBS */
+/*
+ * Provide empty stubs just for MODULAR kernels.
+ */
+
+void
+pmap_pv_init(void)
+{
+
+}
+
+void
+pmap_pv_track(paddr_t start, psize_t size)
+{
+
+}
+
+void
+pmap_pv_untrack(paddr_t start, psize_t size)
+{
+
+}
+
+struct pmap_page *
+pmap_pv_tracked(paddr_t pa)
+{
+
+	return NULL;
+}
+#endif



CVS commit: src/sys/uvm/pmap

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 06:53:16 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_pvt.c

Log Message:
Introduce PMAP_PV_TRACK_ONLY_STUBS option, by which only empty stubs for
global functions in pmap_pvt.h are provided, instead of real support for
PV tracking.

Necessary for powerpc: Only one sub-arch (oea) has PV tracking support.
Others (booke/ibm4xx) do not at the moment (probably never for ibm4xx),
but __HAVE_PMAP_PV_TRACK is necessary, so that modules can be shared by
all of sub-archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/pmap_pvt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-03-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar  4 08:11:48 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Rmmove an incorrect KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-03-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar  4 08:11:48 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Rmmove an incorrect KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.51 src/sys/uvm/pmap/pmap_tlb.c:1.52
--- src/sys/uvm/pmap/pmap_tlb.c:1.51	Sun Jan  2 16:03:30 2022
+++ src/sys/uvm/pmap/pmap_tlb.c	Fri Mar  4 08:11:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.51 2022/01/02 16:03:30 christos Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.51 2022/01/02 16:03:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -547,9 +547,6 @@ pmap_tlb_shootdown_process(void)
 {
 	struct cpu_info * const ci = curcpu();
 	struct pmap_tlb_info * const ti = cpu_tlb_info(ci);
-#ifdef DIAGNOSTIC
-	struct pmap * const pm = curlwp->l_proc->p_vmspace->vm_map.pmap;
-#endif
 
 	KASSERT(cpu_intr_p());
 	KASSERTMSG(ci->ci_cpl >= IPL_SCHED, "%s: cpl (%d) < IPL_SCHED (%d)",
@@ -580,7 +577,6 @@ pmap_tlb_shootdown_process(void)
 			 * next called for this pmap, it will allocate a new
 			 * ASID.
 			 */
-			KASSERT(!pmap_tlb_intersecting_onproc_p(pm, ti));
 			pmap_tlb_pai_reset(ti, pai, PAI_PMAP(pai, ti));
 		}
 		break;



CVS commit: src/sys/uvm/pmap

2022-02-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 16 20:14:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.h

Log Message:
pmap_pvt.h: Fix bogus include.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/uvm/pmap/pmap_pvt.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_pvt.h
diff -u src/sys/uvm/pmap/pmap_pvt.h:1.2 src/sys/uvm/pmap/pmap_pvt.h:1.3
--- src/sys/uvm/pmap/pmap_pvt.h:1.2	Sat Jun 24 05:31:03 2017
+++ src/sys/uvm/pmap/pmap_pvt.h	Wed Feb 16 20:14:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.h,v 1.2 2017/06/24 05:31:03 skrll Exp $	*/
+/*	$NetBSD: pmap_pvt.h,v 1.3 2022/02/16 20:14:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #ifndef	_UVM_PMAP_PMAP_PVT_H_
 #define	_UVM_PMAP_PMAP_PVT_H_
 
-#include 
+#include 
 
 struct pmap_page;
 



CVS commit: src/sys/uvm/pmap

2022-02-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 16 20:14:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.h

Log Message:
pmap_pvt.h: Fix bogus include.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/uvm/pmap/pmap_pvt.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2022-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  2 16:03:30 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
fix KASSERTMSG issue


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.50 src/sys/uvm/pmap/pmap_tlb.c:1.51
--- src/sys/uvm/pmap/pmap_tlb.c:1.50	Wed Dec 29 07:53:38 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Sun Jan  2 11:03:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.50 2021/12/29 12:53:38 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.51 2022/01/02 16:03:30 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.50 2021/12/29 12:53:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.51 2022/01/02 16:03:30 christos Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -471,9 +471,9 @@ pmap_tlb_asid_reinitialize(struct pmap_t
 		pmap_tlb_asid_check();
 #ifdef DIAGNOSTIC
 		const u_int asids_count = pmap_tlb_asid_count(ti);
-#endif
 		KASSERTMSG(asids_found == asids_count,
 		"found %u != count %u", asids_found, asids_count);
+#endif
 		if (__predict_false(asids_found >= ti->ti_asid_max / 2)) {
 			tlb_invalidate_asids(KERNEL_PID + 1, ti->ti_asid_max);
 #else /* MULTIPROCESSOR && !PMAP_TLB_NEED_SHOOTDOWN */



CVS commit: src/sys/uvm/pmap

2022-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  2 16:03:30 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
fix KASSERTMSG issue


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-12-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 29 12:53:38 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Remove duplicate KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.49 src/sys/uvm/pmap/pmap_tlb.c:1.50
--- src/sys/uvm/pmap/pmap_tlb.c:1.49	Wed Oct 27 06:54:15 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Wed Dec 29 12:53:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.49 2021/10/27 06:54:15 simonb Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.50 2021/12/29 12:53:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.49 2021/10/27 06:54:15 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.50 2021/12/29 12:53:38 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -866,7 +866,6 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info
 	 * Mark it as used and insert the pai into the list of active asids.
 	 * There is also one less asid free in this TLB.
 	 */
-	KASSERT(ti->ti_asid_hint > KERNEL_PID);
 	pai->pai_asid = ti->ti_asid_hint++;
 #ifdef MULTIPROCESSOR
 	if (PMAP_TLB_FLUSH_ASID_ON_RESET) {



CVS commit: src/sys/uvm/pmap

2021-12-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 29 12:53:38 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Remove duplicate KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-10-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 06:54:15 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
TAB police.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.48 src/sys/uvm/pmap/pmap_tlb.c:1.49
--- src/sys/uvm/pmap/pmap_tlb.c:1.48	Wed Oct 27 05:33:59 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Wed Oct 27 06:54:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.48 2021/10/27 05:33:59 simonb Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.49 2021/10/27 06:54:15 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.48 2021/10/27 05:33:59 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.49 2021/10/27 06:54:15 simonb Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -1084,11 +1084,11 @@ pmap_tlb_asid_check(void)
 void
 pmap_tlb_check(pmap_t pm, bool (*func)(void *, vaddr_t, tlb_asid_t, pt_entry_t))
 {
-struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
-struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
-TLBINFO_LOCK(ti);
-if (pm == pmap_kernel() || pai->pai_asid > KERNEL_PID)
+	struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu());
+	struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
+	TLBINFO_LOCK(ti);
+	if (pm == pmap_kernel() || pai->pai_asid > KERNEL_PID)
 		tlb_walk(pm, func);
-TLBINFO_UNLOCK(ti);
+	TLBINFO_UNLOCK(ti);
 }
 #endif /* DEBUG */



CVS commit: src/sys/uvm/pmap

2021-10-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 06:54:15 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
TAB police.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-10-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 05:33:59 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
When adjusting the max ASID count, check if ti->ti_asid_max == 0 as
well.  This defaults to 0 for the non-PMAP_TLB_NUM_PIDS case, so would
skip the updated test.

Fix for port-pmax/56466 (which affects all MIPS).

ok srkll@


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-10-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Oct 27 05:33:59 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
When adjusting the max ASID count, check if ti->ti_asid_max == 0 as
well.  This defaults to 0 for the non-PMAP_TLB_NUM_PIDS case, so would
skip the updated test.

Fix for port-pmax/56466 (which affects all MIPS).

ok srkll@


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.47 src/sys/uvm/pmap/pmap_tlb.c:1.48
--- src/sys/uvm/pmap/pmap_tlb.c:1.47	Fri Oct  8 07:17:32 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Wed Oct 27 05:33:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.47 2021/10/08 07:17:32 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.48 2021/10/27 05:33:59 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.47 2021/10/08 07:17:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.48 2021/10/27 05:33:59 simonb Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -379,7 +379,7 @@ pmap_tlb_info_init(struct pmap_tlb_info 
 #endif
 
 	const tlb_asid_t asid_max = pmap_md_tlb_asid_max();
-	if (asid_max < ti->ti_asid_max) {
+	if (ti->ti_asid_max == 0 || asid_max < ti->ti_asid_max) {
 		ti->ti_asid_max = asid_max;
 		ti->ti_asids_free = TLBINFO_ASID_INITIAL_FREE(ti->ti_asid_max);
 	}



CVS commit: src/sys/uvm/pmap

2021-10-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct  8 07:17:32 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix a logic botch to actually apply the ASID limit returned by
pmap_md_tlb_asid_max.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.46 src/sys/uvm/pmap/pmap_tlb.c:1.47
--- src/sys/uvm/pmap/pmap_tlb.c:1.46	Sat Oct  2 14:28:05 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Fri Oct  8 07:17:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.46 2021/10/02 14:28:05 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.47 2021/10/08 07:17:32 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.46 2021/10/02 14:28:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.47 2021/10/08 07:17:32 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -378,8 +378,9 @@ pmap_tlb_info_init(struct pmap_tlb_info 
 	kcpuset_set(ti->ti_kcpuset, cpu_index(curcpu()));
 #endif
 
-	if (ti->ti_asid_max == 0) {
-		ti->ti_asid_max = pmap_md_tlb_asid_max();
+	const tlb_asid_t asid_max = pmap_md_tlb_asid_max();
+	if (asid_max < ti->ti_asid_max) {
+		ti->ti_asid_max = asid_max;
 		ti->ti_asids_free = TLBINFO_ASID_INITIAL_FREE(ti->ti_asid_max);
 	}
 



CVS commit: src/sys/uvm/pmap

2021-10-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct  8 07:17:32 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix a logic botch to actually apply the ASID limit returned by
pmap_md_tlb_asid_max.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 09:05:01 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
comment whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 09:05:01 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
comment whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.44 src/sys/uvm/pmap/pmap_tlb.c:1.45
--- src/sys/uvm/pmap/pmap_tlb.c:1.44	Tue May  4 09:05:34 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Sun Sep 12 09:05:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.44 2021/05/04 09:05:34 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.44 2021/05/04 09:05:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v
  * "current ASID" field, e.g. the ASID field of the COP 0 register EntryHi for
  * MIPS, or the ASID field of TTBR0 for AA64.  The bit number used in these
  * bitmaps comes from the CPU's cpu_index().  Even though these bitmaps contain
- * the bits for all CPUs, the bits that  correspond to the bits belonging to
+ * the bits for all CPUs, the bits that correspond to the bits belonging to
  * the CPUs sharing a TLB can only be manipulated while holding that TLB's
  * lock.  Atomic ops must be used to update them since multiple CPUs may be
  * changing different sets of bits at same time but these sets never overlap.



re: CVS commit: src/sys/uvm/pmap

2020-08-23 Thread matthew green
> Modified Files:
>   src/sys/uvm/pmap: pmap_segtab.c
> 
> Log Message:
> Remove the #if defined(__mips_n64) && PAGE_SIZE == 8192 and make the
> check MI - all PTs are PAGE_SIZE aligned

thanks!  that is a much better way of doing it.


.mrg.


CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:58:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.13 src/sys/uvm/pmap/vmpagemd.h:1.14
--- src/sys/uvm/pmap/vmpagemd.h:1.13	Sun Oct 20 07:54:29 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Sun Oct 20 07:58:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.13 2019/10/20 07:54:29 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.14 2019/10/20 07:58:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -101,11 +101,11 @@ struct vm_page_md {
 #define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	__nothing
 #endif /* MULTIPROCESSOR || MODULAR */
 
-#define	VM_PAGEMD_PVLIST_LOCK(mdpg)		pmap_pvlist_lock(mdpg, 1)
-#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)		pmap_pvlist_lock(mdpg, 0)
-#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)		pmap_pvlist_unlock(mdpg)
-#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)		pmap_pvlist_locked_p(mdpg)
-#define	VM_PAGEMD_PVLIST_GEN(mdpg)		((mdpg)->mdpg_attrs >> 16)
+#define	VM_PAGEMD_PVLIST_LOCK(mdpg)	pmap_pvlist_lock(mdpg, 1)
+#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)	pmap_pvlist_lock(mdpg, 0)
+#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)	pmap_pvlist_unlock(mdpg)
+#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)	pmap_pvlist_locked_p(mdpg)
+#define	VM_PAGEMD_PVLIST_GEN(mdpg)	((mdpg)->mdpg_attrs >> 16)
 
 #ifdef _KERNEL
 #if defined(MULTIPROCESSOR) || defined(MODULAR)



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:58:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:54:30 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Re-order _P() macros to match bit definitions.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.12 src/sys/uvm/pmap/vmpagemd.h:1.13
--- src/sys/uvm/pmap/vmpagemd.h:1.12	Fri Jul 12 10:39:12 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Sun Oct 20 07:54:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.12 2019/07/12 10:39:12 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.13 2019/10/20 07:54:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -75,14 +75,14 @@ typedef struct pv_entry {
 #define	VM_PAGEMD_UNCACHED	__BIT(4)	/* page is mapped uncached */
 #endif
 
+#define	VM_PAGEMD_REFERENCED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_REFERENCED) != 0)
+#define	VM_PAGEMD_MODIFIED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_MODIFIED) != 0)
+#define	VM_PAGEMD_POOLPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_POOLPAGE) != 0)
+#define	VM_PAGEMD_EXECPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_EXECPAGE) != 0)
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
 #define	VM_PAGEMD_CACHED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_UNCACHED) == 0)
 #define	VM_PAGEMD_UNCACHED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_UNCACHED) != 0)
 #endif
-#define	VM_PAGEMD_MODIFIED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_MODIFIED) != 0)
-#define	VM_PAGEMD_REFERENCED_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_REFERENCED) != 0)
-#define	VM_PAGEMD_POOLPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_POOLPAGE) != 0)
-#define	VM_PAGEMD_EXECPAGE_P(mdpg)	(((mdpg)->mdpg_attrs & VM_PAGEMD_EXECPAGE) != 0)
 
 #endif /* !_MODULE */
 



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:54:30 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Re-order _P() macros to match bit definitions.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:22:51 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.10 src/sys/uvm/pmap/pmap_segtab.c:1.11
--- src/sys/uvm/pmap/pmap_segtab.c:1.10	Mon Sep 23 18:20:07 2019
+++ src/sys/uvm/pmap/pmap_segtab.c	Sun Oct 20 07:22:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.11 2019/10/20 07:22:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.11 2019/10/20 07:22:51 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -139,10 +139,10 @@ pmap_check_stp(pmap_segtab_t *stp, const
 #ifdef DEBUG_NOISY
 			for (size_t j = i; j < PMAP_SEGTABSIZE; j++)
 printf("%s: pm_segtab.seg_tab[%zu] = 0x%p\n",
-   caller, j, stp->seg_tab[j]);
+caller, j, stp->seg_tab[j]);
 #endif
 			panic("%s: pm_segtab.seg_tab[%zu] != 0 (0x%p): %s",
-			  caller, i, stp->seg_tab[i], why);
+			caller, i, stp->seg_tab[i], why);
 		}
 	}
 #endif



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:22:51 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:18:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Remove KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg)) - can only assert that it
is owned


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.42 src/sys/uvm/pmap/pmap.c:1.43
--- src/sys/uvm/pmap/pmap.c:1.42	Fri Jul 12 10:39:12 2019
+++ src/sys/uvm/pmap/pmap.c	Sun Oct 20 07:18:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.43 2019/10/20 07:18:22 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1655,7 +1655,6 @@ pmap_clear_modify(struct vm_page *pg)
 	 * flush the VAC first if there is one.
 	 */
 	kpreempt_disable();
-	KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg));
 	VM_PAGEMD_PVLIST_READLOCK(mdpg);
 	pmap_pvlist_check(mdpg);
 	for (; pv != NULL; pv = pv_next) {



CVS commit: src/sys/uvm/pmap

2019-10-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 20 07:18:22 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Remove KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg)) - can only assert that it
is owned


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-09-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 23 18:20:08 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Use "segmap" for uvm_wait message in pmap_segtab_alloc


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-09-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 23 18:20:08 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Use "segmap" for uvm_wait message in pmap_segtab_alloc


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.9 src/sys/uvm/pmap/pmap_segtab.c:1.10
--- src/sys/uvm/pmap/pmap_segtab.c:1.9	Wed Sep 18 18:29:58 2019
+++ src/sys/uvm/pmap/pmap_segtab.c	Mon Sep 23 18:20:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.9 2019/09/18 18:29:58 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.9 2019/09/18 18:29:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.10 2019/09/23 18:20:07 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -299,7 +299,7 @@ pmap_segtab_alloc(void)
 			/*
 			 * XXX What else can we do?  Could we deadlock here?
 			 */
-			uvm_wait("pmap_create");
+			uvm_wait("segtab");
 			goto again;
 		}
 		SEGTAB_ADD(npage, 1);



CVS commit: src/sys/uvm/pmap

2019-09-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 18 18:29:58 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
s/pte/ptep/ in pmap_pte_process for consistency with other code.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-09-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 18 18:29:58 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
s/pte/ptep/ in pmap_pte_process for consistency with other code.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.8 src/sys/uvm/pmap/pmap_segtab.c:1.9
--- src/sys/uvm/pmap/pmap_segtab.c:1.8	Wed Sep 18 18:18:44 2019
+++ src/sys/uvm/pmap/pmap_segtab.c	Wed Sep 18 18:29:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.8 2019/09/18 18:18:44 skrll Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.9 2019/09/18 18:29:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.8 2019/09/18 18:18:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.9 2019/09/18 18:29:58 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -407,12 +407,12 @@ pmap_pte_process(pmap_t pmap, vaddr_t sv
 		 * If VA belongs to an unallocated segment,
 		 * skip to the next segment boundary.
 		 */
-		pt_entry_t * const pte = pmap_pte_lookup(pmap, sva);
-		if (pte != NULL) {
+		pt_entry_t * const ptep = pmap_pte_lookup(pmap, sva);
+		if (ptep != NULL) {
 			/*
 			 * Callback to deal with the ptes for this segment.
 			 */
-			(*callback)(pmap, sva, lastseg_va, pte, flags);
+			(*callback)(pmap, sva, lastseg_va, ptep, flags);
 		}
 		/*
 		 * In theory we could release pages with no entries,



CVS commit: src/sys/uvm/pmap

2019-09-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 18 18:18:44 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.7 src/sys/uvm/pmap/pmap_segtab.c:1.8
--- src/sys/uvm/pmap/pmap_segtab.c:1.7	Fri Mar  8 08:12:40 2019
+++ src/sys/uvm/pmap/pmap_segtab.c	Wed Sep 18 18:18:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.7 2019/03/08 08:12:40 msaitoh Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.8 2019/09/18 18:18:44 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.7 2019/03/08 08:12:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.8 2019/09/18 18:18:44 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -392,7 +392,7 @@ pmap_segtab_activate(struct pmap *pm, st
  */
 void
 pmap_pte_process(pmap_t pmap, vaddr_t sva, vaddr_t eva,
-	pte_callback_t callback, uintptr_t flags)
+pte_callback_t callback, uintptr_t flags)
 {
 #if 0
 	printf("%s: %p, %"PRIxVADDR", %"PRIxVADDR", %p, %"PRIxPTR"\n",



CVS commit: src/sys/uvm/pmap

2019-09-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 18 18:18:44 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_segtab.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/uvm/pmap/pmap_segtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-07-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 12 10:39:12 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c vmpagemd.h

Log Message:
Provide and use PV_ISKENTER_P.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.41 src/sys/uvm/pmap/pmap.c:1.42
--- src/sys/uvm/pmap/pmap.c:1.41	Wed Jun 19 09:56:17 2019
+++ src/sys/uvm/pmap/pmap.c	Fri Jul 12 10:39:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.41 2019/06/19 09:56:17 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41 2019/06/19 09:56:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.42 2019/07/12 10:39:12 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -722,7 +722,7 @@ pmap_page_remove(struct vm_page *pg)
 	for (; pv != NULL; pv = npv) {
 		npv = pv->pv_next;
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
-		if (pv->pv_va & PV_KENTER) {
+		if (PV_ISKENTER_P(pv)) {
 			UVMHIST_LOG(pmaphist, " pv %#jx pmap %#jx va %jx"
 			" skip", (uintptr_t)pv, (uintptr_t)pv->pv_pmap,
 			pv->pv_va, 0);
@@ -988,7 +988,7 @@ pmap_page_protect(struct vm_page *pg, vm
 		if (pv->pv_pmap != NULL) {
 			while (pv != NULL) {
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
-if (pv->pv_va & PV_KENTER) {
+if (PV_ISKENTER_P(pv)) {
 	pv = pv->pv_next;
 	continue;
 }
@@ -1664,7 +1664,7 @@ pmap_clear_modify(struct vm_page *pg)
 
 		pv_next = pv->pv_next;
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
-		if (pv->pv_va & PV_KENTER)
+		if (PV_ISKENTER_P(pv))
 			continue;
 #endif
 		pt_entry_t * const ptep = pmap_pte_lookup(pmap, va);

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.11 src/sys/uvm/pmap/vmpagemd.h:1.12
--- src/sys/uvm/pmap/vmpagemd.h:1.11	Wed Jun 19 12:55:01 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Fri Jul 12 10:39:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.11 2019/06/19 12:55:01 christos Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.12 2019/07/12 10:39:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -63,6 +63,8 @@ typedef struct pv_entry {
 #define	PV_KENTER		__BIT(0)
 } *pv_entry_t;
 
+#define	PV_ISKENTER_P(pv)	(((pv->pv_va) & PV_KENTER) != 0)
+
 #ifndef _MODULE
 
 #define	VM_PAGEMD_REFERENCED	__BIT(0)	/* page has been referenced */



CVS commit: src/sys/uvm/pmap

2019-07-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 12 10:39:12 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c vmpagemd.h

Log Message:
Provide and use PV_ISKENTER_P.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 19 12:55:01 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
use __nothing


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 19 12:55:01 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
use __nothing


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.10 src/sys/uvm/pmap/vmpagemd.h:1.11
--- src/sys/uvm/pmap/vmpagemd.h:1.10	Wed Jun 19 06:04:40 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Wed Jun 19 08:55:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.10 2019/06/19 10:04:40 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.11 2019/06/19 12:55:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@ struct vm_page_md {
 #if defined(MULTIPROCESSOR) || defined(MODULAR)
 #define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg) 	(mdpg)->mdpg_lock = NULL
 #else
-#define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	do { } while (/*CONSTCOND*/ 0)
+#define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	__nothing
 #endif /* MULTIPROCESSOR || MODULAR */
 
 #define	VM_PAGEMD_PVLIST_LOCK(mdpg)		pmap_pvlist_lock(mdpg, 1)



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 10:04:40 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Once more short line to unwrap


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.9 src/sys/uvm/pmap/vmpagemd.h:1.10
--- src/sys/uvm/pmap/vmpagemd.h:1.9	Wed Jun 19 10:00:19 2019
+++ src/sys/uvm/pmap/vmpagemd.h	Wed Jun 19 10:04:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.9 2019/06/19 10:00:19 skrll Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.10 2019/06/19 10:04:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -94,8 +94,7 @@ struct vm_page_md {
 
 #ifndef _MODULE
 #if defined(MULTIPROCESSOR) || defined(MODULAR)
-#define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg) 	\
-	(mdpg)->mdpg_lock = NULL
+#define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg) 	(mdpg)->mdpg_lock = NULL
 #else
 #define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	do { } while (/*CONSTCOND*/ 0)
 #endif /* MULTIPROCESSOR || MODULAR */



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 10:04:40 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Once more short line to unwrap


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 10:00:19 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Unwrap short lines.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 10:00:19 UTC 2019

Modified Files:
src/sys/uvm/pmap: vmpagemd.h

Log Message:
Unwrap short lines.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/vmpagemd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/vmpagemd.h
diff -u src/sys/uvm/pmap/vmpagemd.h:1.8 src/sys/uvm/pmap/vmpagemd.h:1.9
--- src/sys/uvm/pmap/vmpagemd.h:1.8	Thu Apr 19 21:50:10 2018
+++ src/sys/uvm/pmap/vmpagemd.h	Wed Jun 19 10:00:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmpagemd.h,v 1.8 2018/04/19 21:50:10 christos Exp $	*/
+/*	$NetBSD: vmpagemd.h,v 1.9 2019/06/19 10:00:19 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -100,16 +100,11 @@ struct vm_page_md {
 #define	VM_PAGEMD_PVLIST_LOCK_INIT(mdpg)	do { } while (/*CONSTCOND*/ 0)
 #endif /* MULTIPROCESSOR || MODULAR */
 
-#define	VM_PAGEMD_PVLIST_LOCK(mdpg)		\
-	pmap_pvlist_lock(mdpg, 1)
-#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)		\
-	pmap_pvlist_lock(mdpg, 0)
-#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)		\
-	pmap_pvlist_unlock(mdpg)
-#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)		\
-	pmap_pvlist_locked_p(mdpg)
-#define	VM_PAGEMD_PVLIST_GEN(mdpg)		\
-	((mdpg)->mdpg_attrs >> 16)
+#define	VM_PAGEMD_PVLIST_LOCK(mdpg)		pmap_pvlist_lock(mdpg, 1)
+#define	VM_PAGEMD_PVLIST_READLOCK(mdpg)		pmap_pvlist_lock(mdpg, 0)
+#define	VM_PAGEMD_PVLIST_UNLOCK(mdpg)		pmap_pvlist_unlock(mdpg)
+#define	VM_PAGEMD_PVLIST_LOCKED_P(mdpg)		pmap_pvlist_locked_p(mdpg)
+#define	VM_PAGEMD_PVLIST_GEN(mdpg)		((mdpg)->mdpg_attrs >> 16)
 
 #ifdef _KERNEL
 #if defined(MULTIPROCESSOR) || defined(MODULAR)



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 09:56:17 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Make a comment generic and not MIPS specific


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 19 09:56:17 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Make a comment generic and not MIPS specific


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.40 src/sys/uvm/pmap/pmap.c:1.41
--- src/sys/uvm/pmap/pmap.c:1.40	Mon Oct 30 03:25:14 2017
+++ src/sys/uvm/pmap/pmap.c	Wed Jun 19 09:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.40 2017/10/30 03:25:14 pgoyette Exp $	*/
+/*	$NetBSD: pmap.c,v 1.41 2019/06/19 09:56:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2017/10/30 03:25:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41 2019/06/19 09:56:17 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -434,7 +434,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
  * memory system has been bootstrapped.  After that point, either kmem_alloc
  * or malloc should be used.  This function works by stealing pages from the
  * (to be) managed page pool, then implicitly mapping the pages (by using
- * their k0seg addresses) and zeroing them.
+ * their direct mapped addresses) and zeroing them.
  *
  * It may be used once the physical memory segments have been pre-loaded
  * into the vm_physmem[] array.  Early memory allocation MUST use this



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 17:00:58 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Usee __BIT()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.10 src/sys/uvm/pmap/pmap.h:1.11
--- src/sys/uvm/pmap/pmap.h:1.10	Mon May 20 16:58:49 2019
+++ src/sys/uvm/pmap/pmap.h	Mon May 20 17:00:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.10 2019/05/20 16:58:49 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.11 2019/05/20 17:00:57 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -130,7 +130,7 @@ struct pmap {
 	pmap_segtab_t *		pm_segtab;	/* pointers to pages of PTEs */
 	u_int			pm_count;	/* pmap reference count */
 	u_int			pm_flags;
-#define	PMAP_DEFERRED_ACTIVATE	0x0001
+#define	PMAP_DEFERRED_ACTIVATE	__BIT(0)
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vaddr_t			pm_minaddr;
 	vaddr_t			pm_maxaddr;



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 17:00:58 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Usee __BIT()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 16:58:49 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 16:58:49 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap.h

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.9 src/sys/uvm/pmap/pmap.h:1.10
--- src/sys/uvm/pmap/pmap.h:1.9	Sat Jun 24 05:49:50 2017
+++ src/sys/uvm/pmap/pmap.h	Mon May 20 16:58:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.9 2017/06/24 05:49:50 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.10 2019/05/20 16:58:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -157,11 +157,11 @@ struct pmap_limits {
  */
 #ifdef MULTIPROCESSOR
 #define PMAP_SIZE	offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
-#else   
+#else
 #define PMAP_SIZE	sizeof(struct pmap)
-#endif  
+#endif
 
-/* 
+/*
  * The pools from which pmap structures and sub-structures are allocated.
  */
 extern struct pool pmap_pmap_pool;



  1   2   >