Subject: Re: Big Amiga panic: (most of) real solution found
To: Ignatios Souvatzis <is@jocelyn.rhein.de>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: port-amiga
Date: 02/20/1998 00:43:03
This is version 2 of the patch.
Apply to clean tree, from /sys/arch, then re-config and make.
PLEASE TEST THIS IF YOU HAD THE "can't get KPT page" PANIC, and report.

	Ignatios

Index: amiga/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/conf/GENERIC,v
retrieving revision 1.100
diff -u -r1.100 GENERIC
--- GENERIC	1998/02/17 19:42:38	1.100
+++ GENERIC	1998/02/19 23:41:51
@@ -119,9 +119,15 @@
 #
 # Amiga specific options
 #
-options 	LIMITMEM=24	# dont use more than LIMITMEM MB of RAM.
+#options 	LIMITMEM=24	# dont use more than LIMITMEM MB of RAM.
 				# remove this line to use more than 24 MB, and
 				# increase NKMEMCLUSTERS
+#options	NKPTADD=4	# set this for 4 additional KPT pages
+#options	NKPTADDSHIFT=24	# set this for 1 additional KPT page
+				# per 16 MB (1<<24 bytes) of RAM
+                                # define and decrease this, or define and
+                                # increase NKPTADD if you get "out of PT pages"
+                                # panics.
 
 options 	MACHINE_NONCONTIG # Non-contiguous memory support
 # ATTENTION: There is NO WARRANTY AT ALL that the sync will be complete
Index: amiga/conf/DRACO
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/conf/DRACO,v
retrieving revision 1.21
diff -u -r1.21 DRACO
--- DRACO	1998/02/05 20:07:17	1.21
+++ DRACO	1998/02/19 23:41:54
@@ -97,6 +97,16 @@
 #
 # Amiga specific options
 #
+#options        LIMITMEM=24     # dont use more than LIMITMEM MB of RAM.
+                                # remove this line to use more than 24 MB, and
+				# increase NKMEMCLUSTERS
+#options        NKPTADD=4       # set this for 4 additional KPT pages
+#options        NKPTADDSHIFT=24 # set this for 1 additional KPT page
+				# per 16 MB (1<<24 bytes) of RAM (default)
+				# define and decrease this, or define and
+				# increase NKPTADD if you get "out of PT pages"
+				# panics.
+
 options 	MACHINE_NONCONTIG # Non-contiguous memory support 
 				  # higly recommended for DraCo
 
Index: amiga/amiga/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/amiga/pmap.c,v
retrieving revision 1.44
diff -u -r1.44 pmap.c
--- pmap.c	1998/01/22 23:13:40	1.44
+++ pmap.c	1998/02/19 23:42:13
@@ -554,7 +554,24 @@
 	 * plus some slop.
 	 */
 	npg = howmany(((maxproc + 16) * AMIGA_UPTSIZE / NPTEPG), NBPG);
-	npg = min(atop(AMIGA_MAX_KPTSIZE), npg);
+	/*
+	 * One page of KPT allows for 16 MB of virtual buffer cache.
+	 * A GENERIC kernel allocates this for 2 MB of real buffer cache,
+	 * which in turn is allocated for 38 MB of RAM.
+	 */
+#ifdef NKPTADD
+	npg += NKPTADD;
+#else
+#ifdef NKPTADDSHIFT
+	npg += mem_size >> NKPTADDSHIFT;
+#else
+	npg += mem_size >> 24;
+#endif
+#endif
+#if 1/*def DEBUG*/
+	printf("Maxproc %d, mem_size %ld MB: allocating %ld KPT pages\n",
+	    maxproc, mem_size>>20, npg);
+#endif
 	s = ptoa(npg) + round_page(npg * sizeof(struct kpt_page));
 
 	/*