Subject: Re: hard lockups with -current and Netscape
To: Mark White <mark.white@st-edmund-hall.oxford.ac.uk>
From: Jaromír <jdolecek@netbsd.org>
List: current-users
Date: 03/20/2001 22:07:36
--ELM985122456-613-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

Can you please try out attached patch and tell if it helped ?

Jaromir


Mark White wrote:
[ Charset ISO-8859-1 unsupported, converting... ]
> Jarom_r Dolecek writes:
> > Paul Dokas wrote:
> > > I've been experiencing random lockups on two of my NetBSD machines.
> > > They're both running -current, one from 03/16 and the other from 03/18.
> > > One is a Gateway laptop (PII 366MHz) and the other is a Pentium 133.
> > Backing off sys/compat/linux/common/linux_exec.c to rev. 1.45
> > and sys/compat/linux/common/linux_misc.c to rev. 1.83 might also
> > fix the problem.
> 
> Data point: I'm running a -current with 1.45 and 1.83
> respectively, and haven't had any problem running any of my
> linux emulated apps (including StarOffice, Netscape, and
> Acrobat).
> 
> Mark <><
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
 ***  Wanna a real operating system ? Go and get NetBSD, dammit!  ***

--ELM985122456-613-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-2
Content-Disposition: attachment; filename=linuxemul.diff

Index: linux_exec.c
===================================================================
RCS file: /cvsroot/syssrc/sys/compat/linux/common/linux_exec.c,v
retrieving revision 1.46
diff -u -p -r1.46 linux_exec.c
--- linux_exec.c	2001/03/15 19:18:20	1.46
+++ linux_exec.c	2001/03/20 21:04:16
@@ -76,6 +76,7 @@ void syscall __P((void));
 static void linux_e_proc_exec __P((struct proc *, struct exec_package *));
 static void linux_e_proc_fork __P((struct proc *, struct proc *));
 static void linux_e_proc_exit __P((struct proc *));
+static void linux_e_proc_init __P((struct proc *, struct vmspace *));
 
 /*
  * Execve(2). Just check the alternate emulation path, and pass it on
@@ -132,15 +133,10 @@ const struct emul emul_linux = {
 #endif
 };
 
-/*
- * Allocate per-process structures. Called when executing Linux
- * process. We can re-used the old emuldata - if it's not null,
- * the executed process is of same emulation as original forked one.
- */
 static void
-linux_e_proc_exec(p, epp)
+linux_e_proc_init(p, vmspace)
 	struct proc *p;
-	struct exec_package *epp;
+	struct vmspace *vmspace;
 {
 	if (!p->p_emuldata) {
 		/* allocate new Linux emuldata */
@@ -152,7 +148,21 @@ linux_e_proc_exec(p, epp)
 	
 	/* Set the process idea of the break to the real value */
 	((struct linux_emuldata*)(p->p_emuldata))->p_break = 
-	    p->p_vmspace->vm_daddr + ctob(p->p_vmspace->vm_dsize);
+	    vmspace->vm_daddr + ctob(vmspace->vm_dsize);
+}
+
+/*
+ * Allocate per-process structures. Called when executing Linux
+ * process. We can reuse the old emuldata - if it's not null,
+ * the executed process is of same emulation as original forked one.
+ */
+static void
+linux_e_proc_exec(p, epp)
+	struct proc *p;
+	struct exec_package *epp;
+{
+	/* exec, use our vmspace */
+	linux_e_proc_init(p, p->p_vmspace);
 }
 
 /*
@@ -180,5 +190,7 @@ linux_e_proc_fork(p, parent)
 	 * So just allocate new emuldata for the new process.
 	 */
 	p->p_emuldata = NULL;
-	linux_e_proc_exec(p, NULL);
+
+	/* fork, use parent's vmspace (our vmspace may not be setup yet) */
+	linux_e_proc_init(p, parent->p_vmspace);
 }

--ELM985122456-613-0_--