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

2020-01-13 Thread Christos Zoulas
In article <20200113163830.e7a6317f...@rebar.astron.com>,
Christos Zoulas  wrote:
>| 
>| Probably this is the same reason of recent arm build failures:
>|  https://releng.netbsd.org/builds/HEAD/202001130720Z/
>|  https://releng.netbsd.org/builds/HEAD/202001130720Z/evbarm-earm.build.failed
>| ---
>| /tmp/genassym.Lq8h9d/assym.c:57:1: error: asm operand 0 probably
>doesn't match constraints [-Werror]
>|  __asm("XYZZY VM_MIN_ADDRESS %0" : : "n" (VM_MIN_ADDRESS));
>|  ^
>| /tmp/genassym.Lq8h9d/assym.c:58:1: error: asm operand 0 probably
>doesn't match constraints [-Werror]
>|  __asm("XYZZY VM_MAXUSER_ADDRESS %0" : : "n" (VM_MAXUSER_ADDRESS));
>|  ^
>| /tmp/genassym.Lq8h9d/assym.c:97:1: error: asm operand 0 probably
>doesn't match constraints [-Werror]
>|  __asm("XYZZY PAGE_MASK %0" : : "n" (PAGE_MASK));
>|  ^
>| /tmp/genassym.Lq8h9d/assym.c:98:1: error: asm operand 0 probably
>doesn't match constraints [-Werror]
>|  __asm("XYZZY PAGE_SIZE %0" : : "n" (PAGE_SIZE));
>|  ^
>| ---
>| 
>| Should we prepare independent constant for
>| "possible pagesize value among different MACHINE with the same MACHINE_ARCH"
>| for jemalloc(3)?
>
>Ouch, this hurts. Sure, perhaps MALLOC_PAGE_SIZE?

Talking to myself:

The arm PAGE_SIZE_{MIN,MAX} should go away after nick eliminates the
need for the 8K pages. This leaves us with m68k to deal with...
Do modules work on m68k? Should modules be shared between kernels with
different page sizes? Then perhaps we don't need a new constant?

christos



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

2020-01-13 Thread Jason Thorpe



> On Jan 13, 2020, at 8:15 AM, Izumi Tsutsui  wrote:
> 
> christos@ wrote:
> 
>>> Now I get the following erro during local tests of
>>> "build.sh -U -m hp300 release" on NetBSD/i386 9.0_RC1 host:
>>> 
>>> ---
>>> #create  compat_util/compat_exec.d
> :
>>> In file included from /s/cvs/src/sys/sys/param.h:149:0,
>>>from /s/cvs/src/sys/compat/common/compat_exec.c:41:
>>> ./m68k/pmap_motorola.h:165:5: error: operator '*' has no left operand
>>> #if PAGE_SIZE == 8192 /* NBPG / (SG4_LEV1SIZE * sizeof(st_entry_t)) */
>>>^
>>> nbmkdep: compile failed.
>>> *** [compat_exec.d] Error code 1
>> 
>> try cc -E?
> 
> It turns out the problem is more complicated.
> 
>  has the following definitions:
> 
> https://nxr.netbsd.org/xref/src/sys/uvm/uvm_param.h?r=1.38#135

I would suggest a possible workaround for this could be to define an additional:

#define __HAVE_FIXED_PAGE_SIZE

...at could also be tested here... the kernel truly does have a fixed page 
size, but userland not necessarily so.

> ---
>135  * If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
>136  * non-constant PAGE_SIZE, et al for LKMs.
>137  */
>138 #if (MIN_PAGE_SIZE != MAX_PAGE_SIZE)
>139 #define__uvmexp_pagesize
>140 #if defined(_LKM) || defined(_MODULE)
>141 #undef PAGE_SIZE
>142 #undef PAGE_MASK
>143 #undef PAGE_SHIFT
>144 #endif
>145 #endif
>146 
>147 /*
>148  * Now provide PAGE_SIZE, PAGE_MASK, and PAGE_SHIFT if we do not
>149  * have ones that are compile-time constants.
>150  */
>151 #if !defined(PAGE_SIZE)
>152 extern const int *const uvmexp_pagesize;
>153 extern const int *const uvmexp_pagemask;
>154 extern const int *const uvmexp_pageshift;
>155 #definePAGE_SIZE   (*uvmexp_pagesize)  /* size of page 
> */
>156 #definePAGE_MASK   (*uvmexp_pagemask)  /* size of page 
> - 1 */
>157 #definePAGE_SHIFT  (*uvmexp_pageshift) /* bits to 
> shift for pages */
>158 #endif /* PAGE_SIZE */
> ---
> 
> I.e.  assumes PAGE_SIZE is not compile time constant
> for MODULEs if (MIN_PAGE_SIZE != MAX_PAGE_SIZE).
> 
> Probably this is the same reason of recent arm build failures:
> https://releng.netbsd.org/builds/HEAD/202001130720Z/
> https://releng.netbsd.org/builds/HEAD/202001130720Z/evbarm-earm.build.failed
> ---
> /tmp/genassym.Lq8h9d/assym.c:57:1: error: asm operand 0 probably doesn't 
> match constraints [-Werror]
> __asm("XYZZY VM_MIN_ADDRESS %0" : : "n" (VM_MIN_ADDRESS));
> ^
> /tmp/genassym.Lq8h9d/assym.c:58:1: error: asm operand 0 probably doesn't 
> match constraints [-Werror]
> __asm("XYZZY VM_MAXUSER_ADDRESS %0" : : "n" (VM_MAXUSER_ADDRESS));
> ^
> /tmp/genassym.Lq8h9d/assym.c:97:1: error: asm operand 0 probably doesn't 
> match constraints [-Werror]
> __asm("XYZZY PAGE_MASK %0" : : "n" (PAGE_MASK));
> ^
> /tmp/genassym.Lq8h9d/assym.c:98:1: error: asm operand 0 probably doesn't 
> match constraints [-Werror]
> __asm("XYZZY PAGE_SIZE %0" : : "n" (PAGE_SIZE));
> ^
> ---
> 
> Should we prepare independent constant for
> "possible pagesize value among different MACHINE with the same MACHINE_ARCH"
> for jemalloc(3)?
> 
> ---
> Izumi Tsutsui

-- thorpej



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

2020-01-13 Thread Christos Zoulas
On Jan 14,  1:15am, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: MAX_PAGE_SIZE for m68k (Re: CVS commit: src/sys/arch/arm/incl

| christos@ wrote:
| 
| > >Now I get the following erro during local tests of
| > >"build.sh -U -m hp300 release" on NetBSD/i386 9.0_RC1 host:
| > >
| > >---
| > >#create  compat_util/compat_exec.d
|  :
| > >In file included from /s/cvs/src/sys/sys/param.h:149:0,
| > > from /s/cvs/src/sys/compat/common/compat_exec.c:41:
| > >./m68k/pmap_motorola.h:165:5: error: operator '*' has no left operand
| > > #if PAGE_SIZE == 8192 /* NBPG / (SG4_LEV1SIZE * sizeof(st_entry_t)) */
| > > ^
| > >nbmkdep: compile failed.
| > >*** [compat_exec.d] Error code 1
| > 
| > try cc -E?
| 
| It turns out the problem is more complicated.
| 
|  has the following definitions:
| 
| https://nxr.netbsd.org/xref/src/sys/uvm/uvm_param.h?r=1.38#135
| ---
| 135  * If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
| 136  * non-constant PAGE_SIZE, et al for LKMs.
| 137  */
| 138 #if (MIN_PAGE_SIZE != MAX_PAGE_SIZE)
| 139 #define   __uvmexp_pagesize
| 140 #if defined(_LKM) || defined(_MODULE)
| 141 #undef PAGE_SIZE
| 142 #undef PAGE_MASK
| 143 #undef PAGE_SHIFT
| 144 #endif
| 145 #endif
| 146 
| 147 /*
| 148  * Now provide PAGE_SIZE, PAGE_MASK, and PAGE_SHIFT if we do not
| 149  * have ones that are compile-time constants.
| 150  */
| 151 #if !defined(PAGE_SIZE)
| 152 extern const int *const uvmexp_pagesize;
| 153 extern const int *const uvmexp_pagemask;
| 154 extern const int *const uvmexp_pageshift;
| 155 #define   PAGE_SIZE   (*uvmexp_pagesize)  /* size of page 
*/
| 156 #define   PAGE_MASK   (*uvmexp_pagemask)  /* size of page 
- 1 */
| 157 #define   PAGE_SHIFT  (*uvmexp_pageshift) /* bits to 
shift for pages */
| 158 #endif /* PAGE_SIZE */
| ---
| 
| I.e.  assumes PAGE_SIZE is not compile time constant
| for MODULEs if (MIN_PAGE_SIZE != MAX_PAGE_SIZE).
| 
| Probably this is the same reason of recent arm build failures:
|  https://releng.netbsd.org/builds/HEAD/202001130720Z/
|  https://releng.netbsd.org/builds/HEAD/202001130720Z/evbarm-earm.build.failed
| ---
| /tmp/genassym.Lq8h9d/assym.c:57:1: error: asm operand 0 probably doesn't 
match constraints [-Werror]
|  __asm("XYZZY VM_MIN_ADDRESS %0" : : "n" (VM_MIN_ADDRESS));
|  ^
| /tmp/genassym.Lq8h9d/assym.c:58:1: error: asm operand 0 probably doesn't 
match constraints [-Werror]
|  __asm("XYZZY VM_MAXUSER_ADDRESS %0" : : "n" (VM_MAXUSER_ADDRESS));
|  ^
| /tmp/genassym.Lq8h9d/assym.c:97:1: error: asm operand 0 probably doesn't 
match constraints [-Werror]
|  __asm("XYZZY PAGE_MASK %0" : : "n" (PAGE_MASK));
|  ^
| /tmp/genassym.Lq8h9d/assym.c:98:1: error: asm operand 0 probably doesn't 
match constraints [-Werror]
|  __asm("XYZZY PAGE_SIZE %0" : : "n" (PAGE_SIZE));
|  ^
| ---
| 
| Should we prepare independent constant for
| "possible pagesize value among different MACHINE with the same MACHINE_ARCH"
| for jemalloc(3)?

Ouch, this hurts. Sure, perhaps MALLOC_PAGE_SIZE?

christos


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

2020-01-13 Thread Izumi Tsutsui
christos@ wrote:

> >Now I get the following erro during local tests of
> >"build.sh -U -m hp300 release" on NetBSD/i386 9.0_RC1 host:
> >
> >---
> >#create  compat_util/compat_exec.d
 :
> >In file included from /s/cvs/src/sys/sys/param.h:149:0,
> > from /s/cvs/src/sys/compat/common/compat_exec.c:41:
> >./m68k/pmap_motorola.h:165:5: error: operator '*' has no left operand
> > #if PAGE_SIZE == 8192 /* NBPG / (SG4_LEV1SIZE * sizeof(st_entry_t)) */
> > ^
> >nbmkdep: compile failed.
> >*** [compat_exec.d] Error code 1
> 
> try cc -E?

It turns out the problem is more complicated.

 has the following definitions:

https://nxr.netbsd.org/xref/src/sys/uvm/uvm_param.h?r=1.38#135
---
135  * If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
136  * non-constant PAGE_SIZE, et al for LKMs.
137  */
138 #if (MIN_PAGE_SIZE != MAX_PAGE_SIZE)
139 #define __uvmexp_pagesize
140 #if defined(_LKM) || defined(_MODULE)
141 #undef PAGE_SIZE
142 #undef PAGE_MASK
143 #undef PAGE_SHIFT
144 #endif
145 #endif
146 
147 /*
148  * Now provide PAGE_SIZE, PAGE_MASK, and PAGE_SHIFT if we do not
149  * have ones that are compile-time constants.
150  */
151 #if !defined(PAGE_SIZE)
152 extern const int *const uvmexp_pagesize;
153 extern const int *const uvmexp_pagemask;
154 extern const int *const uvmexp_pageshift;
155 #define PAGE_SIZE   (*uvmexp_pagesize)  /* size of page */
156 #define PAGE_MASK   (*uvmexp_pagemask)  /* size of page - 1 */
157 #define PAGE_SHIFT  (*uvmexp_pageshift) /* bits to shift for 
pages */
158 #endif /* PAGE_SIZE */
---

I.e.  assumes PAGE_SIZE is not compile time constant
for MODULEs if (MIN_PAGE_SIZE != MAX_PAGE_SIZE).

Probably this is the same reason of recent arm build failures:
 https://releng.netbsd.org/builds/HEAD/202001130720Z/
 https://releng.netbsd.org/builds/HEAD/202001130720Z/evbarm-earm.build.failed
---
/tmp/genassym.Lq8h9d/assym.c:57:1: error: asm operand 0 probably doesn't match 
constraints [-Werror]
 __asm("XYZZY VM_MIN_ADDRESS %0" : : "n" (VM_MIN_ADDRESS));
 ^
/tmp/genassym.Lq8h9d/assym.c:58:1: error: asm operand 0 probably doesn't match 
constraints [-Werror]
 __asm("XYZZY VM_MAXUSER_ADDRESS %0" : : "n" (VM_MAXUSER_ADDRESS));
 ^
/tmp/genassym.Lq8h9d/assym.c:97:1: error: asm operand 0 probably doesn't match 
constraints [-Werror]
 __asm("XYZZY PAGE_MASK %0" : : "n" (PAGE_MASK));
 ^
/tmp/genassym.Lq8h9d/assym.c:98:1: error: asm operand 0 probably doesn't match 
constraints [-Werror]
 __asm("XYZZY PAGE_SIZE %0" : : "n" (PAGE_SIZE));
 ^
---

Should we prepare independent constant for
"possible pagesize value among different MACHINE with the same MACHINE_ARCH"
for jemalloc(3)?

---
Izumi Tsutsui


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

2020-01-13 Thread Christos Zoulas
In article <200114002918.m0108...@mirage.ceres.dti.ne.jp>,
Izumi Tsutsui   wrote:
>christos@ wrote:
>
>> LGTM too.
>
>> >> thorpej@ wrote:
> :
>> >> How about the attached diff? (untested, just for review)
>> > 
>> > This looks good to me.
>
>Now I get the following erro during local tests of
>"build.sh -U -m hp300 release" on NetBSD/i386 9.0_RC1 host:
>
>---
>#create  compat_util/compat_exec.d
>CC=/s/cvs/src/obj.hp300/tooldir.NetBSD-9.0_RC1-i386/bin/m68k--netbsdelf-gcc
>/s/cvs/src/obj.hp300/tooldir.NetBSD-9.0_RC1-i386/bin/nbmkdep -f
>compat_exec.d.tmp  --   -std=gnu99   -I/s/cvs/src/common/include
>-DDIAGNOSTIC --sysroot=/s/cvs/src/obj.hp300/destdir.hp300
>-I/s/cvs/src/common/include -DDIAGNOSTIC -nostdinc -I.
>-I/s/cvs/src/sys/modules/compat_util -isystem /s/cvs/src/sys -isystem
>/s/cvs/src/sys/arch -isystem /s/cvs/src/sys/../common/include -D_KERNEL
>-D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR
>/s/cvs/src/sys/compat/common/compat_exec.c &&  mv -f compat_exec.d.tmp
>compat_exec.d
>In file included from /s/cvs/src/sys/sys/param.h:149:0,
> from /s/cvs/src/sys/compat/common/compat_exec.c:41:
>./m68k/pmap_motorola.h:165:5: error: operator '*' has no left operand
> #if PAGE_SIZE == 8192 /* NBPG / (SG4_LEV1SIZE * sizeof(st_entry_t)) */
> ^
>nbmkdep: compile failed.
>*** [compat_exec.d] Error code 1
>
>---
>
>I'm not sure why my  change causes this error,
>but I also wonder if we should use "PGSHIFT == 13" rather than
>"PAGE_SIZE == 8192" in ..

try cc -E?

christos



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

2020-01-13 Thread Izumi Tsutsui
christos@ wrote:

> LGTM too.

> >> thorpej@ wrote:
 :
> >> How about the attached diff? (untested, just for review)
> > 
> > This looks good to me.

Now I get the following erro during local tests of
"build.sh -U -m hp300 release" on NetBSD/i386 9.0_RC1 host:

---
#create  compat_util/compat_exec.d
CC=/s/cvs/src/obj.hp300/tooldir.NetBSD-9.0_RC1-i386/bin/m68k--netbsdelf-gcc 
/s/cvs/src/obj.hp300/tooldir.NetBSD-9.0_RC1-i386/bin/nbmkdep -f 
compat_exec.d.tmp  --   -std=gnu99   -I/s/cvs/src/common/include -DDIAGNOSTIC 
--sysroot=/s/cvs/src/obj.hp300/destdir.hp300 -I/s/cvs/src/common/include 
-DDIAGNOSTIC -nostdinc -I. -I/s/cvs/src/sys/modules/compat_util -isystem 
/s/cvs/src/sys -isystem /s/cvs/src/sys/arch -isystem 
/s/cvs/src/sys/../common/include -D_KERNEL -D_LKM -D_MODULE 
-DSYSCTL_INCLUDE_DESCR /s/cvs/src/sys/compat/common/compat_exec.c &&  mv -f 
compat_exec.d.tmp compat_exec.d
In file included from /s/cvs/src/sys/sys/param.h:149:0,
 from /s/cvs/src/sys/compat/common/compat_exec.c:41:
./m68k/pmap_motorola.h:165:5: error: operator '*' has no left operand
 #if PAGE_SIZE == 8192 /* NBPG / (SG4_LEV1SIZE * sizeof(st_entry_t)) */
 ^
nbmkdep: compile failed.
*** [compat_exec.d] Error code 1

---

I'm not sure why my  change causes this error,
but I also wonder if we should use "PGSHIFT == 13" rather than
"PAGE_SIZE == 8192" in ..

---
Izumi Tsutsui


Re: CVS commit: src/sys

2020-01-13 Thread Andrew Doran
On Mon, Jan 13, 2020 at 06:54:33AM -0800, Jason Thorpe wrote:

> > On Jan 12, 2020, at 10:20 PM, Kamil Rytarowski  wrote:
> > 
> > While there, could we garbage collect unused defines from sys/param.h?
> > 
> > I'm thinking in particular about:
> 
> As long as we still have tsleep(9) and friends, we can't rid ourselves of 
> these historical defines.
> 
> Perhaps we should make a push to rid ourselves of those legacy interfaces?

Agree.  They could probably be wrapped in _KERNEL for now though.  Any user
program still relying could do with catching up.

Andrew


Re: CVS commit: src/sys

2020-01-13 Thread Jason Thorpe


> On Jan 12, 2020, at 10:20 PM, Kamil Rytarowski  wrote:
> 
> While there, could we garbage collect unused defines from sys/param.h?
> 
> I'm thinking in particular about:

As long as we still have tsleep(9) and friends, we can't rid ourselves of these 
historical defines.

Perhaps we should make a push to rid ourselves of those legacy interfaces?


> 
> /*
> * Historic priority levels.  These are meaningless and remain only
> * for source compatibility.  Do not use in new code.
> */
> #define PSWP0
> #define PVM 4
> #define PINOD   8
> #define PRIBIO  16
> #define PVFS20
> #define PZERO   22
> #define PSOCK   24
> #define PWAIT   32
> #define PLOCK   36
> #define PPAUSE  40
> #define PUSER   50
> #define MAXPRI  127
> 
> These symbols from time to time conflict with external loadable kernel
> modules. My immediate offender is VirtualBox and PVM symbol name conflict.
> 

-- thorpej