Subject: VM_TOPDOWN
To: None <port-amd64@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: port-amd64
Date: 01/02/2006 15:00:24
--qZLFzaLf2KECwqmh
Content-Type: multipart/mixed; boundary="UkJByDtiyhV6M6Gk"
Content-Disposition: inline
--UkJByDtiyhV6M6Gk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi,
I've just noticed that VM_TOPDOWN isn't used on amd64. Is it an
overlook or is there a compelling reason for it?
In any case, it seems to jsut work. The patch I'm including also adds
code to make netbsd32 binaries use the topdown layout, and sync a few
VM parameters with their i386 counterparts.
I'd like to commit it unless someone objects. Notice the huge available
VM space for netbsd32 binaries on an amd64 system:
% /mnt/netbsd32/bin/sh
$ /../usr/bin/pmap
0000000008048000 104K read/exec /mnt/netbsd32 -?-
0000000008062000 4K read/write [ anon ]
0000000008063000 24K read/write [ anon ]
00000000FBEFF000 4K read/write [ anon ]
00000000FBF00000 724K read/exec /mnt/netbsd32 -?-
[...]
amd64 binaries look like this:
$ pmap
0000000000400000 116K read/exec / -?-
000000000051C000 16K read/write / -?-
0000000000520000 32K read/write [ anon ]
00007F7FFD800000 800K read/exec / -?-
00007F7FFD8C8000 1024K / -?-
00007F7FFD9C8000 116K read/write / -?-
00007F7FFD9E5000 68K read/write [ anon ]
[...]
--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.
--UkJByDtiyhV6M6Gk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amd64.topdown.diff"
Content-Transfer-Encoding: quoted-printable
? conf/AAYLA
Index: amd64/netbsd32_machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/amd64/amd64/netbsd32_machdep.c,v
retrieving revision 1.18
diff -u -r1.18 netbsd32_machdep.c
--- amd64/netbsd32_machdep.c 11 Dec 2005 12:16:21 -0000 1.18
+++ amd64/netbsd32_machdep.c 2 Jan 2006 13:52:47 -0000
@@ -873,5 +873,5 @@
vaddr_t
netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t size)
{
- return round_page((vaddr_t)(base) + (vsize_t)MAXDSIZ32);
+ return VM_DEFAULT_ADDRESS32(base, size);
}
Index: include/vmparam.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/amd64/include/vmparam.h,v
retrieving revision 1.10
diff -u -r1.10 vmparam.h
--- include/vmparam.h 11 Dec 2005 12:16:25 -0000 1.10
+++ include/vmparam.h 2 Jan 2006 13:52:48 -0000
@@ -89,13 +89,13 @@
#define DFLDSIZ32 (256*1024*1024) /* initial data size limit */
#endif
#ifndef MAXDSIZ32
-#define MAXDSIZ32 (2L*1024*1024*1024) /* max data size */
+#define MAXDSIZ32 (3U*1024*1024*1024) /* max data size */
#endif
#ifndef DFLSSIZ32
#define DFLSSIZ32 (2*1024*1024) /* initial stack size limit */
#endif
#ifndef MAXSSIZ32
-#define MAXSSIZ32 (32*1024*1024) /* max stack size */
+#define MAXSSIZ32 (64*1024*1024) /* max stack size */
#endif
=20
/*
@@ -124,6 +124,18 @@
#define VM_MAXUSER_ADDRESS32 0xfffff000
=20
/*
+ * The address to which unspecified mapping requests default
+ */
+#ifdef _KERNEL_OPT
+#include "opt_uvm.h"
+#endif
+#define __USE_TOPDOWN_VM
+#define VM_DEFAULT_ADDRESS(da, sz) \
+ trunc_page(USRSTACK - MAXSSIZ - (sz))
+#define VM_DEFAULT_ADDRESS32(da, sz) \
+ trunc_page(USRSTACK32 - MAXSSIZ32 - (sz))
+
+/*
* XXXfvdl we have plenty of KVM now, remove this.
*/
#ifndef VM_MAX_KERNEL_BUF
--UkJByDtiyhV6M6Gk--
--qZLFzaLf2KECwqmh
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iQEVAwUBQ7kx+NgoQloHrPnoAQIP0QgAszJiC6d54+1W9fFara/0QyFO4Q812cmm
NJWtD7aFwjKL63reKVgm+gMV/jf1aTtCQ3hpucgj8Snm6Cq1u/4viXC3RWztMlkL
ld+rWP5ptLfEknpXfvdATzCc0Afrp1yCUn7C+x8VGHwsTHOIXtj/YqAC8o5r1fs2
6CMbNYaXAl7bFGTmGWC0zd8u3bul+6IQZq0kRP173FxQgPl6+w0hkIiIGsn1tTtP
EFkH4IEsqwrLAzX0ZSaa3/D44ZEq7Z0x7WvkffuPm1fHpARXTHfk4z19N2kSHdn+
XRkuzb9NMDPaDPXfso+dWoa8B6q47m9m64jQ4toe1KShOx8ijLUTcQ==
=BVWe
-----END PGP SIGNATURE-----
--qZLFzaLf2KECwqmh--