Subject: Re: Still problems getting VMware running under -current.
To: None <johani@autonomica.se>
From: Atsushi Onoe <onoe@sm.sony.co.jp>
List: port-i386
Date: 06/27/2001 03:18:36
> starting vmnetif
> /dev/vmnet1: Bad file descriptor

Recent current requires FILE_SET_MATURE(fp) to duplicate fd.

Attached is the complete diff against vmware-netbsd-1.0.tgz
for NetBSD current after 2001/6/14.

Atsushi Onoe

diff -u -r ../../netbsd-org/source/vmmon/netbsd/drv.c ./vmmon/netbsd/drv.c
--- ../../netbsd-org/source/vmmon/netbsd/drv.c	Tue Apr  3 07:41:32 2001
+++ ./vmmon/netbsd/drv.c	Mon Jun 14 18:57:20 2001
@@ -280,6 +280,9 @@
 	fp->f_type = DTYPE_VNODE;
 	fp->f_ops = &vnops;
 	fp->f_data = (caddr_t)vp;
+#ifdef FILE_SET_MATURE
+	FILE_SET_MATURE(fp);
+#endif
 	FILE_UNUSE(fp, p);
 
 	p->p_dupfd = fd;
diff -u -r ../../netbsd-org/source/vmmon/netbsd/host.c ./vmmon/netbsd/host.c
--- ../../netbsd-org/source/vmmon/netbsd/host.c	Tue Apr  3 21:23:08 2001
+++ ./vmmon/netbsd/host.c	Thu Jun 14 23:46:11 2001
@@ -315,9 +315,16 @@
 
 		/*
 		 * now locate it and write the results back to the pmap
+		 *
+		 * Under extreme memory pressure, the page may be gone again.
+		 * Just fail the lock in that case.
+		 * (It was ASSERT_BUG(6339, mpn).)
+		 * -- edward
 		 */
 		mpn = FindMPN(vpn);
-		ASSERT(mpn);
+		if (mpn == 0) {
+			return 0;
+		}
      	 
 		/*
 		 * XXX SMP.
@@ -628,6 +635,7 @@
 	if (vm->crossvaddr != NULL)
 		Warning("KernelAddr already allocated\n");
 
+	PHOLD(curproc);
 	uvm_vslock(curproc, addr, PAGE_SIZE,
 	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
 
@@ -636,6 +644,7 @@
 	pmap_extract(vm_map_pmap(&curproc->p_vmspace->vm_map), uaddr, &paddr);
 	pmap_kenter_pa(kvaddr, paddr,
 	    VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
+	PRELE(curproc);
 	vm->crossvaddr = (void *)kvaddr;
 	vm->crossuaddr = addr;
 #ifdef DEBUG
diff -u -r ../../netbsd-org/source/vmnet/if_hubvar.h ./vmnet/if_hubvar.h
--- ../../netbsd-org/source/vmnet/if_hubvar.h	Tue Apr  3 07:57:57 2001
+++ ./vmnet/if_hubvar.h	Thu Jun 14 18:06:51 2001
@@ -76,4 +76,4 @@
 #define MAKEHUBDEV(d,u)  MAKEPORTDEV(d,0,-1)
 
 #define HUBMINPKT	ETHER_HDR_LEN
-#define HUBMAXPKT	(ETHER_MAX_FRAME(ETHERTYPE_VLAN, 1))
+#define	HUBMAXPKT	ETHER_MAX_LEN