Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
	sys/arch/mac68k/include/vmparam.h: revision 1.46
	sys/arch/sun3/include/vmparam.h: revision 1.38
	sys/arch/m68k/include/vmparam.h: revision 1.1
	sys/arch/hp300/include/vmparam.h: revision 1.41
	sys/arch/m68k/include/Makefile: revision 1.32
	sys/arch/amiga/include/vmparam.h: revision 1.48
	distrib/sets/lists/comp/ad.m68k: revision 1.63
	sys/arch/x68k/include/vmparam.h: revision 1.40
	sys/arch/mvme68k/include/vmparam.h: revision 1.38
	sys/arch/luna68k/include/vmparam.h: revision 1.23
	sys/arch/news68k/include/vmparam.h: revision 1.23
	sys/arch/atari/include/vmparam.h: revision 1.34
	sys/arch/cesfic/include/vmparam.h: revision 1.19

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.
This commit is contained in:
martin 2020-02-10 18:46:39 +00:00
parent 84b36f9374
commit 2487336d6c
14 changed files with 111 additions and 77 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: ad.m68k,v 1.61 2019/01/19 13:06:50 mrg Exp $
# $NetBSD: ad.m68k,v 1.61.2.1 2020/02/10 18:46:40 martin 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
@ -68,6 +68,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.47 2019/03/27 17:15:29 christos Exp $ */
/* $NetBSD: vmparam.h,v 1.47.4.1 2020/02/10 18:46:40 martin 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.33 2019/03/27 17:15:29 christos Exp $ */
/* $NetBSD: vmparam.h,v 1.33.4.1 2020/02/10 18:46:40 martin 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.18 2019/06/28 15:17:43 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.18.2.1 2020/02/10 18:46:41 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.40 2019/06/28 15:17:43 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.40.2.1 2020/02/10 18:46:40 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.22 2019/06/28 15:17:43 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.22.2.1 2020/02/10 18:46:40 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.31 2018/08/22 01:05:22 msaitoh Exp $
# $NetBSD: Makefile,v 1.31.4.1 2020/02/10 18:46:40 martin Exp $
INCSDIR= /usr/include/m68k
@ -17,6 +17,7 @@ INCS= ansi.h aout_machdep.h asm.h asm_single.h \
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>

View File

@ -0,0 +1,74 @@
/* $NetBSD: vmparam.h,v 1.1.2.2 2020/02/10 18:46:40 martin 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_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.45 2019/06/28 15:17:43 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.45.2.1 2020/02/10 18:46:39 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.37 2019/06/28 15:17:44 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.37.2.1 2020/02/10 18:46:40 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.22 2019/06/28 15:17:44 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.22.2.1 2020/02/10 18:46:40 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.26 2019/06/28 15:17:44 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.26.2.1 2020/02/10 18:46:39 martin 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.
* 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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.37 2013/01/07 16:58:09 chs Exp $ */
/* $NetBSD: vmparam.h,v 1.37.42.1 2020/02/10 18:46:39 martin 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 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.39 2019/06/28 15:17:44 tsutsui Exp $ */
/* $NetBSD: vmparam.h,v 1.39.2.1 2020/02/10 18:46:40 martin 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.
* 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.