svn commit: r201961 - in user/kmacy/releng_8_fcs_buf_xen/sys/i386: include xen

Kip Macy kmacy at FreeBSD.org
Sat Jan 9 23:40:46 UTC 2010


Author: kmacy
Date: Sat Jan  9 23:40:45 2010
New Revision: 201961
URL: http://svn.freebsd.org/changeset/base/201961

Log:
  make QUEUE_MACRO_DEBUG work with Peter's PV chunk changes

Modified:
  user/kmacy/releng_8_fcs_buf_xen/sys/i386/include/pmap.h
  user/kmacy/releng_8_fcs_buf_xen/sys/i386/xen/pmap.c

Modified: user/kmacy/releng_8_fcs_buf_xen/sys/i386/include/pmap.h
==============================================================================
--- user/kmacy/releng_8_fcs_buf_xen/sys/i386/include/pmap.h	Sat Jan  9 23:37:29 2010	(r201960)
+++ user/kmacy/releng_8_fcs_buf_xen/sys/i386/include/pmap.h	Sat Jan  9 23:40:45 2010	(r201961)
@@ -441,14 +441,21 @@ typedef struct pv_entry {
  * pv_entries are allocated in chunks per-process.  This avoids the
  * need to track per-pmap assignments.
  */
+#ifdef QUEUE_MACRO_DEBUG
+#define	_NPCM	5
+#define	_NPCPV	144
+#define _NSPARE	((PAGE_SIZE - (4 + 24 + _NPCM*4 + _NPCPV*28))>>2)
+#else
 #define	_NPCM	11
 #define	_NPCPV	336
+#define _NSPARE 2
+#endif
 struct pv_chunk {
-	pmap_t			pc_pmap;
-	TAILQ_ENTRY(pv_chunk)	pc_list;
-	uint32_t		pc_map[_NPCM];	/* bitmap; 1 = free */
-	uint32_t		pc_spare[2];
-	struct pv_entry		pc_pventry[_NPCPV];
+	pmap_t			pc_pmap; 	/* 4 */
+	TAILQ_ENTRY(pv_chunk)	pc_list;	/* 8 | 24 */ 
+	uint32_t		pc_map[_NPCM];	/* _NPCM*4 - bitmap; 1 = free */
+	uint32_t		pc_spare[_NSPARE]; /* _NSPARE*4 */
+	struct pv_entry		pc_pventry[_NPCPV]; /* _NPCPV * 12 | 28 */
 };
 
 #ifdef	_KERNEL

Modified: user/kmacy/releng_8_fcs_buf_xen/sys/i386/xen/pmap.c
==============================================================================
--- user/kmacy/releng_8_fcs_buf_xen/sys/i386/xen/pmap.c	Sat Jan  9 23:37:29 2010	(r201960)
+++ user/kmacy/releng_8_fcs_buf_xen/sys/i386/xen/pmap.c	Sat Jan  9 23:40:45 2010	(r201961)
@@ -1339,15 +1339,16 @@ pmap_qenter_prot(vm_offset_t sva, vm_pag
 #else
 	uint32_t flags = 0;
 #endif
-
 	if (prot & VM_PROT_WRITE)
 		flags |= PG_RW;
+	if (prot & VM_PROT_READ)
+		flags |= PG_V;
 
 	CTR2(KTR_PMAP, "pmap_qenter:sva=0x%x count=%d", va, count);
 	pte = vtopte(sva);
 	endpte = pte + count;
 	while (pte < endpte) {
-		pa = xpmap_ptom(VM_PAGE_TO_PHYS(*ma)) | pgeflag | flags | PG_V | PG_M | PG_A;
+		pa = xpmap_ptom(VM_PAGE_TO_PHYS(*ma)) | pgeflag | flags;
 
 		mclp->op = __HYPERVISOR_update_va_mapping;
 		mclp->args[0] = va;
@@ -1980,16 +1981,19 @@ pmap_growkernel(vm_offset_t addr)
  ***************************************************/
 
 CTASSERT(sizeof(struct pv_chunk) == PAGE_SIZE);
-CTASSERT(_NPCM == 11);
+#ifdef QUEUE_MACRO_DEBUG
+CTASSERT(_NPCM == 5);
 
-static __inline struct pv_chunk *
-pv_to_chunk(pv_entry_t pv)
-{
+#define	PC_FREE0_3	0xfffffffful	/* Free values for index 0 through 9 */
+#define	PC_FREE5	0x0000fffful	/* Free values for index 10 */
 
-	return (struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK);
-}
+static uint32_t pc_freemask[5] = {
+	PC_FREE0_3, PC_FREE0_3, PC_FREE0_3,
+	PC_FREE0_3, PC_FREE5
+};
 
-#define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap)
+#else
+CTASSERT(_NPCM == 11);
 
 #define	PC_FREE0_9	0xfffffffful	/* Free values for index 0 through 9 */
 #define	PC_FREE10	0x0000fffful	/* Free values for index 10 */
@@ -2001,6 +2005,18 @@ static uint32_t pc_freemask[11] = {
 	PC_FREE0_9, PC_FREE10
 };
 
+#endif
+static __inline struct pv_chunk *
+pv_to_chunk(pv_entry_t pv)
+{
+
+	return (struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK);
+}
+
+#define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap)
+
+
+
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0,
 	"Current number of pv entries");
 


More information about the svn-src-user mailing list