Module Name: src Committed By: tsutsui Date: Sat Feb 1 19:41:50 UTC 2020
Modified Files: src/distrib/sets/lists/comp: ad.m68k src/sys/arch/amiga/include: vmparam.h src/sys/arch/atari/include: vmparam.h src/sys/arch/cesfic/include: vmparam.h src/sys/arch/hp300/include: vmparam.h src/sys/arch/luna68k/include: vmparam.h src/sys/arch/m68k/include: Makefile src/sys/arch/mac68k/include: vmparam.h src/sys/arch/mvme68k/include: vmparam.h src/sys/arch/news68k/include: vmparam.h src/sys/arch/next68k/include: vmparam.h src/sys/arch/sun3/include: vmparam.h src/sys/arch/x68k/include: vmparam.h Added Files: src/sys/arch/m68k/include: vmparam.h Log Message: Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3). Background: - All m68k ports have fixed PAGE_SIZE value in their kernels, but each port uses different PAGE_SIZE value (4096 or 8192) due to historical reasons. - Currently module(7) binaries are built per each port so all m68k kernel sources don't support run-time variable PAGE_SIZE. - MI <uvm/uvm_param.h> assumes that the port supports a variable PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE are defined and they have different values. - On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h for internal optimization. - m68k ports share userland binaries (especially pkgsrc binaries) among all ports, so we need to define MAX_PAGE_SHIFT as 13 to support m68k ports where PAGE_SIZE==8192. (though this would affect only if static binaries built on 4k page hosts are executed on 8k page hosts) To solve these inconsistency on PAGE_SIZE definitions, we should have an independent PAGE_SIZE related definitions for userland, but it requires major reorganization. For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case. Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@: https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035 https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954 Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/comp/ad.m68k cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amiga/include/vmparam.h cvs rdiff -u -r1.33 -r1.34 src/sys/arch/atari/include/vmparam.h cvs rdiff -u -r1.18 -r1.19 src/sys/arch/cesfic/include/vmparam.h cvs rdiff -u -r1.40 -r1.41 src/sys/arch/hp300/include/vmparam.h cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/include/vmparam.h cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/Makefile cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vmparam.h cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mac68k/include/vmparam.h cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mvme68k/include/vmparam.h cvs rdiff -u -r1.22 -r1.23 src/sys/arch/news68k/include/vmparam.h cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/include/vmparam.h cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sun3/include/vmparam.h cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x68k/include/vmparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/ad.m68k diff -u src/distrib/sets/lists/comp/ad.m68k:1.62 src/distrib/sets/lists/comp/ad.m68k:1.63 --- src/distrib/sets/lists/comp/ad.m68k:1.62 Thu Oct 3 00:59:50 2019 +++ src/distrib/sets/lists/comp/ad.m68k Sat Feb 1 19:41:48 2020 @@ -1,4 +1,4 @@ -# $NetBSD: ad.m68k,v 1.62 2019/10/03 00:59:50 mrg Exp $ +# $NetBSD: ad.m68k,v 1.63 2020/02/01 19:41:48 tsutsui Exp $ ./usr/bin/elf2aout comp-sysutil-bin ./usr/include/gcc-4.5/math-68881.h comp-c-include obsolete ./usr/include/gcc-4.5/tgmath.h comp-c-include obsolete @@ -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: src/sys/arch/amiga/include/vmparam.h diff -u src/sys/arch/amiga/include/vmparam.h:1.47 src/sys/arch/amiga/include/vmparam.h:1.48 --- src/sys/arch/amiga/include/vmparam.h:1.47 Wed Mar 27 17:15:29 2019 +++ src/sys/arch/amiga/include/vmparam.h Sat Feb 1 19:41:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.47 2019/03/27 17:15:29 christos Exp $ */ +/* $NetBSD: vmparam.h,v 1.48 2020/02/01 19:41:48 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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: src/sys/arch/atari/include/vmparam.h diff -u src/sys/arch/atari/include/vmparam.h:1.33 src/sys/arch/atari/include/vmparam.h:1.34 --- src/sys/arch/atari/include/vmparam.h:1.33 Wed Mar 27 17:15:29 2019 +++ src/sys/arch/atari/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.33 2019/03/27 17:15:29 christos Exp $ */ +/* $NetBSD: vmparam.h,v 1.34 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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: src/sys/arch/cesfic/include/vmparam.h diff -u src/sys/arch/cesfic/include/vmparam.h:1.18 src/sys/arch/cesfic/include/vmparam.h:1.19 --- src/sys/arch/cesfic/include/vmparam.h:1.18 Fri Jun 28 15:17:43 2019 +++ src/sys/arch/cesfic/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.18 2019/06/28 15:17:43 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.19 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/hp300/include/vmparam.h diff -u src/sys/arch/hp300/include/vmparam.h:1.40 src/sys/arch/hp300/include/vmparam.h:1.41 --- src/sys/arch/hp300/include/vmparam.h:1.40 Fri Jun 28 15:17:43 2019 +++ src/sys/arch/hp300/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.40 2019/06/28 15:17:43 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.41 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/luna68k/include/vmparam.h diff -u src/sys/arch/luna68k/include/vmparam.h:1.22 src/sys/arch/luna68k/include/vmparam.h:1.23 --- src/sys/arch/luna68k/include/vmparam.h:1.22 Fri Jun 28 15:17:43 2019 +++ src/sys/arch/luna68k/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.22 2019/06/28 15:17:43 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.23 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/m68k/include/Makefile diff -u src/sys/arch/m68k/include/Makefile:1.31 src/sys/arch/m68k/include/Makefile:1.32 --- src/sys/arch/m68k/include/Makefile:1.31 Wed Aug 22 01:05:22 2018 +++ src/sys/arch/m68k/include/Makefile Sat Feb 1 19:41:48 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.31 2018/08/22 01:05:22 msaitoh Exp $ +# $NetBSD: Makefile,v 1.32 2020/02/01 19:41:48 tsutsui Exp $ INCSDIR= /usr/include/m68k @@ -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: src/sys/arch/mac68k/include/vmparam.h diff -u src/sys/arch/mac68k/include/vmparam.h:1.45 src/sys/arch/mac68k/include/vmparam.h:1.46 --- src/sys/arch/mac68k/include/vmparam.h:1.45 Fri Jun 28 15:17:43 2019 +++ src/sys/arch/mac68k/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.45 2019/06/28 15:17:43 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.46 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/mvme68k/include/vmparam.h diff -u src/sys/arch/mvme68k/include/vmparam.h:1.37 src/sys/arch/mvme68k/include/vmparam.h:1.38 --- src/sys/arch/mvme68k/include/vmparam.h:1.37 Fri Jun 28 15:17:44 2019 +++ src/sys/arch/mvme68k/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.37 2019/06/28 15:17:44 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.38 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/news68k/include/vmparam.h diff -u src/sys/arch/news68k/include/vmparam.h:1.22 src/sys/arch/news68k/include/vmparam.h:1.23 --- src/sys/arch/news68k/include/vmparam.h:1.22 Fri Jun 28 15:17:44 2019 +++ src/sys/arch/news68k/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.22 2019/06/28 15:17:44 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.23 2020/02/01 19:41:49 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/next68k/include/vmparam.h diff -u src/sys/arch/next68k/include/vmparam.h:1.26 src/sys/arch/next68k/include/vmparam.h:1.27 --- src/sys/arch/next68k/include/vmparam.h:1.26 Fri Jun 28 15:17:44 2019 +++ src/sys/arch/next68k/include/vmparam.h Sat Feb 1 19:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.26 2019/06/28 15:17:44 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.27 2020/02/01 19:41:49 tsutsui Exp $ */ /* * This file was taken from from mvme68k/include/vmparam.h and @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Index: src/sys/arch/sun3/include/vmparam.h diff -u src/sys/arch/sun3/include/vmparam.h:1.37 src/sys/arch/sun3/include/vmparam.h:1.38 --- src/sys/arch/sun3/include/vmparam.h:1.37 Mon Jan 7 16:58:09 2013 +++ src/sys/arch/sun3/include/vmparam.h Sat Feb 1 19:41:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.37 2013/01/07 16:58:09 chs Exp $ */ +/* $NetBSD: vmparam.h,v 1.38 2020/02/01 19:41:50 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -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: src/sys/arch/x68k/include/vmparam.h diff -u src/sys/arch/x68k/include/vmparam.h:1.39 src/sys/arch/x68k/include/vmparam.h:1.40 --- src/sys/arch/x68k/include/vmparam.h:1.39 Fri Jun 28 15:17:44 2019 +++ src/sys/arch/x68k/include/vmparam.h Sat Feb 1 19:41:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.39 2019/06/28 15:17:44 tsutsui Exp $ */ +/* $NetBSD: vmparam.h,v 1.40 2020/02/01 19:41:50 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -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. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) + * Use common m68k definitions to define PAGE_SIZE and related constants. + */ +#include <m68k/vmparam.h> /* * USRSTACK is the top (end) of the user stack. Added files: Index: src/sys/arch/m68k/include/vmparam.h diff -u /dev/null src/sys/arch/m68k/include/vmparam.h:1.1 --- /dev/null Sat Feb 1 19:41:50 2020 +++ src/sys/arch/m68k/include/vmparam.h Sat Feb 1 19:41:48 2020 @@ -0,0 +1,74 @@ +/* $NetBSD: vmparam.h,v 1.1 2020/02/01 19:41:48 tsutsui Exp $ */ + +/* + * 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_ */