Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Nov 2009 08:45:44 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r198742 - in stable/7/sys: . amd64/include arm/include contrib/pf i386/include ia64/include kern powerpc/include sparc64/include sun4v/include sys
Message-ID:  <200911010845.nA18jice017741@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Nov  1 08:45:44 2009
New Revision: 198742
URL: http://svn.freebsd.org/changeset/base/198742

Log:
  MFC r197316
      Add a new sysctl for reporting all of the supported page sizes.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/include/param.h
  stable/7/sys/arm/include/param.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/i386/include/param.h
  stable/7/sys/ia64/include/param.h
  stable/7/sys/kern/kern_mib.c
  stable/7/sys/powerpc/include/param.h
  stable/7/sys/sparc64/include/param.h
  stable/7/sys/sun4v/include/param.h
  stable/7/sys/sys/systm.h

Modified: stable/7/sys/amd64/include/param.h
==============================================================================
--- stable/7/sys/amd64/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/amd64/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -115,6 +115,8 @@
 #define	NBPML4		(1ul<<PML4SHIFT)/* bytes/page map lev4 table */
 #define	PML4MASK	(NBPML4-1)
 
+#define	MAXPAGESIZES	3	/* maximum number of supported page sizes */
+
 #define IOPAGES	2		/* pages of i/o permission bitmap */
 
 #ifndef	KSTACK_PAGES

Modified: stable/7/sys/arm/include/param.h
==============================================================================
--- stable/7/sys/arm/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/arm/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -90,6 +90,8 @@
 #define NBPDR		(1 << PDR_SHIFT)
 #define NPDEPG          (1 << (32 - PDR_SHIFT))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES    2
 #endif /* !KSTACK_PAGES */

Modified: stable/7/sys/i386/include/param.h
==============================================================================
--- stable/7/sys/i386/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/i386/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -93,6 +93,8 @@
 #define NBPDR		(1<<PDRSHIFT)	/* bytes/page dir */
 #define PDRMASK		(NBPDR-1)
 
+#define	MAXPAGESIZES	2	/* maximum number of supported page sizes */
+
 #define IOPAGES	2		/* pages of i/o permission bitmap */
 
 #ifndef KSTACK_PAGES

Modified: stable/7/sys/ia64/include/param.h
==============================================================================
--- stable/7/sys/ia64/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/ia64/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -107,6 +107,8 @@
 #define PAGE_MASK	(PAGE_SIZE-1)
 #define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef	KSTACK_PAGES
 #define	KSTACK_PAGES	4		/* pages of kernel stack */
 #endif

Modified: stable/7/sys/kern/kern_mib.c
==============================================================================
--- stable/7/sys/kern/kern_mib.c	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/kern/kern_mib.c	Sun Nov  1 08:45:44 2009	(r198742)
@@ -203,6 +203,33 @@ SYSCTL_PROC(_hw, HW_USERMEM, usermem, CT
 
 SYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
 
+u_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE };
+
+static int
+sysctl_hw_pagesizes(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+#ifdef SCTL_MASK32
+	int i;
+	uint32_t pagesizes32[MAXPAGESIZES];
+
+	if (req->flags & SCTL_MASK32) {
+		/*
+		 * Recreate the "pagesizes" array with 32-bit elements.  Truncate
+		 * any page size greater than UINT32_MAX to zero.
+		 */
+		for (i = 0; i < MAXPAGESIZES; i++)
+			pagesizes32[i] = (uint32_t)pagesizes[i];
+
+		error = SYSCTL_OUT(req, pagesizes32, sizeof(pagesizes32));
+	} else
+#endif
+		error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes));
+	return (error);
+}
+SYSCTL_PROC(_hw, OID_AUTO, pagesizes, CTLTYPE_ULONG | CTLFLAG_RD,
+    NULL, 0, sysctl_hw_pagesizes, "LU", "Supported page sizes");
+
 static char	machine_arch[] = MACHINE_ARCH;
 SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
     machine_arch, 0, "System architecture");

Modified: stable/7/sys/powerpc/include/param.h
==============================================================================
--- stable/7/sys/powerpc/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/powerpc/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -81,6 +81,8 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define	KSTACK_PAGES		4		/* includes pcb */
 #endif

Modified: stable/7/sys/sparc64/include/param.h
==============================================================================
--- stable/7/sys/sparc64/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/sparc64/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -107,6 +107,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: stable/7/sys/sun4v/include/param.h
==============================================================================
--- stable/7/sys/sun4v/include/param.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/sun4v/include/param.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -102,6 +102,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: stable/7/sys/sys/systm.h
==============================================================================
--- stable/7/sys/sys/systm.h	Sun Nov  1 08:20:30 2009	(r198741)
+++ stable/7/sys/sys/systm.h	Sun Nov  1 08:45:44 2009	(r198742)
@@ -60,6 +60,7 @@ extern u_int nselcoll;		/* select collis
 extern struct mtx sellock;	/* select lock variable */
 extern struct cv selwait;	/* select conditional variable */
 
+extern u_long pagesizes[];	/* supported page sizes */
 extern long physmem;		/* physical memory */
 extern long realmem;		/* 'real' memory */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911010845.nA18jice017741>