Subject: port-i386/3403:
To: None <gnats-bugs@gnats.netbsd.org>
From: George Navas <navas@bayarea.net>
List: netbsd-bugs
Date: 03/28/1997 16:24:38
>Number:         3403
>Category:       port-i386
>Synopsis:       
>Confidential:   yes
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 28 16:35:01 1997
>Last-Modified:
>Originator:     George Navas
>Organization:
Bay Area Internet Solutions

George E. Navas   		navas@bayarea.net
Voice: (408)260-5000  		Fax:(408)260-5003 	http://www.bayarea.net
>Release:        System: NetBSD baygate 1.2C NetBSD 1.2C March 8, 1997 NetBSD-current
>Environment:
System: NetBSD baygate 1.2C NetBSD 1.2C (ANCHOR) #6: Thu Mar 27 21:04:49 PST 1997 navas@shell2:/usr/src.12cmar8/sys/arch/i386/compile/ANCHOR i386

>Description:
fatal page fault in supervisor mode seems to occur when system is stress for a little
while. I also have a dump if you need to look at it.

>How-To-Repeat:
We have encountered this problem in our production machine as well as the test machine.
In the test machine it appears that the following program if is run for a while to 
stress the system it will eventually crash with the fatal page fault in supervisor mode.
Enclosed is our system configuration, and the program does exercise swaping quite a bit.

	
/*
 * Program to exercise the number of tasks and memory
 *
 * usage:    forks -f children -m memory_per_child [-v]  [-s sleeptime]
 *		where children is the number of children
 *		memory_per_child is memory allocated
 *		-v for verbose
 */

#include <stdlib.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

extern char     *optarg;
extern int      optind;

main(int argc, char **argv)
{
	char	*ptr, c;
	int	i, j, pid, cpuloop;
	int	vflag=0;
	int	children=10;
	int	memsize= 102400;
	int	sleeptime= 60;


        /*
         * Default
	 * 	-f 10 
	 *      -m 102400
	 *      -s 60     
         */
        while ((c = getopt(argc, argv, "s:vf:m:")) != -1)
                switch (c) {
                  case 'f': children = atoi(optarg); break;
                  case 'm': memsize= atoi(optarg); break;
                  case 's': sleeptime = atoi(optarg); break;
                  case 'v': vflag++; break;
                  default:
                  case '?':  
			printf ("Usage %s -f children -m memsize \n");
			return(1);
                }


	for ( j = 0; j < children; j++){
		if ( (pid = fork() ) == 0 ){

				if ( (ptr = (char *) malloc(memsize) )== NULL ){
					printf("Memory allocation failed for %d \n", memsize);
					return(0);
				}
				memset(ptr, 1,  memsize);
				sleep(sleeptime);
				if ( vflag) 
					printf("%d bytes zapped\n", memsize );
				return(0);
			
		}
		if ( pid == -1 ){
			perror("fork failed ");
		}
		if ( pid ) {
			printf(" pid %d started with pid number = %d\n", j, pid);
			
		}
	}
}
>Fix:
>Audit-Trail:
>Unformatted:
no
fatal page fault in supervisor mode
trap type 6 code 0 eip f81b3730 cs 8 eflags 10296 cr2 ff470068 cpl 0
panic: trap
syncing disks... fatal page fault in supervisor mode
trap type 6 code 0 eip f8131f6b cs 8 eflags 10246 cr2 18 cpl 0
panic: trap