Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MAX_PAGE_SIZE for m68k (Re: CVScommit:src/sys/arch/arm/include/arm32)



> > So what's the short term solution?
> > 
> > - Don't define {MIN,MAX}_PAGE_SIZE on m68k?
> > - Define a different constant?
> > - Add a define to tell uvm to ignore {MIN,MAX}_PAGE_SIZE?
> 
> #ifdef _KERNEL, define {MIN,MAX}_PAGE_SIZE to a constant that matches the system.  For !_KERNEL, define MIN_PAGE_SIZE as 4096 and MAX_PAGE_SIZE as 8192.
> 
> Seems like that would do the trick.

I'm testing updated one as suggested.

Note {MIN,MAX}_PAGE_SIZE will be defined as PAGE_SIZE in <uvm/uvm_param.h>
if they are undefined.

---
--- /dev/null	2020-01-16 02:16:06.295795035 +0900
+++ sys/arch/m68k/include/vmparam.h	2020-01-16 00:56:11.210433358 +0900
@@ -0,0 +1,74 @@
+/*	$NetBSD$	*/
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
+ *
+ *	@(#)vmparam.h	8.2 (Berkeley) 4/19/94
+ */
+
+#ifndef _M68K_VMPARAM_H_
+#define	_M68K_VMPARAM_H_
+
+/*
+ * Common constants for m68k ports
+ */
+
+/*
+ * hp300 pmap derived m68k ports can use 4K or 8K pages.
+ * (except HPMMU machines, that support only 4K page)
+ * sun3 and sun3x use 8K pages.
+ * The page size is specified by PGSHIFT in <machine/param.h>.
+ * Override the PAGE_* definitions to be compile-time constants.
+ */
+#define	PAGE_SHIFT	PGSHIFT
+#define	PAGE_SIZE	(1 << PAGE_SHIFT)
+#define	PAGE_MASK	(PAGE_SIZE - 1)
+
+/* Some implemantations like jemalloc(3) require physical page size details. */
+/*
+ * XXX:
+ * <uvm/uvm_param.h> assumes PAGE_SIZE is not a constant macro
+ * but a variable (*uvmexp_pagesize) on MODULE builds in case of
+ * (MIN_PAGE_SIZE != MAX_PAGE_SIZE).  For now we define these macros
+ * for m68k ports only on !_KERNEL (currently just for jemalloc) builds.
+ */
+#if !defined(_KERNEL)
+#define	MIN_PAGE_SHIFT	12
+#define	MAX_PAGE_SHIFT	13
+#define	MIN_PAGE_SIZE	(1 << MIN_PAGE_SHIFT)
+#define	MAX_PAGE_SIZE	(1 << MAX_PAGE_SHIFT)
+#endif /* !_KERNEL */
+
+#endif /* _M68K_VMPARAM_H_ */
Index: distrib/sets/lists/comp/ad.m68k
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/comp/ad.m68k,v
retrieving revision 1.62
diff -u -p -d -r1.62 ad.m68k
--- distrib/sets/lists/comp/ad.m68k	3 Oct 2019 00:59:50 -0000	1.62
+++ distrib/sets/lists/comp/ad.m68k	15 Jan 2020 17:12:40 -0000
@@ -70,6 +70,7 @@
 ./usr/include/m68k/trap.h			comp-c-include
 ./usr/include/m68k/types.h			comp-c-include
 ./usr/include/m68k/varargs.h			comp-obsolete		obsolete
+./usr/include/m68k/vmparam.h			comp-c-include
 ./usr/include/m68k/wchar_limits.h		comp-c-include
 ./usr/lib/libm68k.a				comp-c-lib
 ./usr/lib/libm68k_p.a				comp-c-lib		profile
Index: sys/arch/amiga/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/include/vmparam.h,v
retrieving revision 1.47
diff -u -p -d -r1.47 vmparam.h
--- sys/arch/amiga/include/vmparam.h	27 Mar 2019 17:15:29 -0000	1.47
+++ sys/arch/amiga/include/vmparam.h	15 Jan 2020 17:13:00 -0000
@@ -46,12 +46,9 @@
  */
 
 /*
- * We use 8K pages on the Amiga.  Override the PAGE_* definitions
- * to be compie-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/atari/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/include/vmparam.h,v
retrieving revision 1.33
diff -u -p -d -r1.33 vmparam.h
--- sys/arch/atari/include/vmparam.h	27 Mar 2019 17:15:29 -0000	1.33
+++ sys/arch/atari/include/vmparam.h	15 Jan 2020 17:13:00 -0000
@@ -46,12 +46,9 @@
  */
 
 /*
- * We use 8K pages on the Atari.  Override the PAGE_* definitions
- * to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/cesfic/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/cesfic/include/vmparam.h,v
retrieving revision 1.18
diff -u -p -d -r1.18 vmparam.h
--- sys/arch/cesfic/include/vmparam.h	28 Jun 2019 15:17:43 -0000	1.18
+++ sys/arch/cesfic/include/vmparam.h	15 Jan 2020 17:13:01 -0000
@@ -46,13 +46,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/hp300/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/include/vmparam.h,v
retrieving revision 1.40
diff -u -p -d -r1.40 vmparam.h
--- sys/arch/hp300/include/vmparam.h	28 Jun 2019 15:17:43 -0000	1.40
+++ sys/arch/hp300/include/vmparam.h	15 Jan 2020 17:13:01 -0000
@@ -46,14 +46,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * (except HPMMU machines)
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/luna68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/luna68k/include/vmparam.h,v
retrieving revision 1.22
diff -u -p -d -r1.22 vmparam.h
--- sys/arch/luna68k/include/vmparam.h	28 Jun 2019 15:17:43 -0000	1.22
+++ sys/arch/luna68k/include/vmparam.h	15 Jan 2020 17:13:02 -0000
@@ -42,13 +42,9 @@
 #define _MACHINE_VMPARAM_H_
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/m68k/include/Makefile
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/include/Makefile,v
retrieving revision 1.31
diff -u -p -d -r1.31 Makefile
--- sys/arch/m68k/include/Makefile	22 Aug 2018 01:05:22 -0000	1.31
+++ sys/arch/m68k/include/Makefile	15 Jan 2020 17:13:02 -0000
@@ -17,6 +17,7 @@ INCS=	ansi.h aout_machdep.h asm.h asm_si
 	psl.h pte_motorola.h ptrace.h \
 	reg.h rwlock.h setjmp.h signal.h sync_icache.h \
 	trap.h types.h \
+	vmparam.h \
 	wchar_limits.h
 
 .include <bsd.kinc.mk>
Index: sys/arch/mac68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/include/vmparam.h,v
retrieving revision 1.45
diff -u -p -d -r1.45 vmparam.h
--- sys/arch/mac68k/include/vmparam.h	28 Jun 2019 15:17:43 -0000	1.45
+++ sys/arch/mac68k/include/vmparam.h	15 Jan 2020 17:13:02 -0000
@@ -81,13 +81,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/mvme68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/include/vmparam.h,v
retrieving revision 1.37
diff -u -p -d -r1.37 vmparam.h
--- sys/arch/mvme68k/include/vmparam.h	28 Jun 2019 15:17:44 -0000	1.37
+++ sys/arch/mvme68k/include/vmparam.h	15 Jan 2020 17:13:02 -0000
@@ -46,13 +46,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/news68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/news68k/include/vmparam.h,v
retrieving revision 1.22
diff -u -p -d -r1.22 vmparam.h
--- sys/arch/news68k/include/vmparam.h	28 Jun 2019 15:17:44 -0000	1.22
+++ sys/arch/news68k/include/vmparam.h	15 Jan 2020 17:13:02 -0000
@@ -46,13 +46,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/next68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/next68k/include/vmparam.h,v
retrieving revision 1.26
diff -u -p -d -r1.26 vmparam.h
--- sys/arch/next68k/include/vmparam.h	28 Jun 2019 15:17:44 -0000	1.26
+++ sys/arch/next68k/include/vmparam.h	15 Jan 2020 17:13:02 -0000
@@ -53,13 +53,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.
Index: sys/arch/sun3/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/include/vmparam.h,v
retrieving revision 1.37
diff -u -p -d -r1.37 vmparam.h
--- sys/arch/sun3/include/vmparam.h	7 Jan 2013 16:58:09 -0000	1.37
+++ sys/arch/sun3/include/vmparam.h	15 Jan 2020 17:13:03 -0000
@@ -32,12 +32,9 @@
 #define __USE_TOPDOWN_VM
 
 /*
- * We use 8K pages on both the sun3 and sun3x.  Override PAGE_*
- * to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	13
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 #define	USRSTACK	kernbase	/* for modules */
 #define	USRSTACK3	KERNBASE3	/* for asm not in modules */
Index: sys/arch/x68k/include/vmparam.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/include/vmparam.h,v
retrieving revision 1.39
diff -u -p -d -r1.39 vmparam.h
--- sys/arch/x68k/include/vmparam.h	28 Jun 2019 15:17:44 -0000	1.39
+++ sys/arch/x68k/include/vmparam.h	15 Jan 2020 17:13:03 -0000
@@ -46,13 +46,9 @@
  */
 
 /*
- * hp300 pmap derived m68k ports can use 4K or 8K pages.
- * The page size is specified by PGSHIFT in <machine/param.h>.
- * Override the PAGE_* definitions to be compile-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	PAGE_SIZE	(1 << PAGE_SHIFT)
-#define	PAGE_MASK	(PAGE_SIZE - 1)
+#include <m68k/vmparam.h>
 
 /*
  * USRSTACK is the top (end) of the user stack.

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index