Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2002 12:37:25 +0100
From:      Robert Drehmel <robert@ferrari-electronic.de>
To:        Philip Paeps <philip@paeps.cx>
Cc:        current@FreeBSD.ORG
Subject:   Re: I'm impressed, but ...
Message-ID:  <20021126123725.A23726@alpha.develop.ferrari.net>
In-Reply-To: <20021125210423.GA617@juno.home.paeps.cx>
References:  <20021125004934.GA604@juno.home.paeps.cx> <20021125194122.GA17986@angelica.unixdaemons.com> <20021125210423.GA617@juno.home.paeps.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 25, 2002 at 10:04:23PM +0100, Philip Paeps wrote:
> Before it is a few megs of the same.  Basically Mutt reading my mailbox.
> Anything else I can do to help?

You could give the attached patch a try.

Were you by any chance using truss(1) just before mutt started
to hang?

ciao,
-robert

Index: src/sys/alpha/alpha/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/alpha/alpha/trap.c,v
retrieving revision 1.102
diff -u -r1.102 trap.c
--- src/sys/alpha/alpha/trap.c	24 Oct 2002 23:09:47 -0000	1.102
+++ src/sys/alpha/alpha/trap.c	26 Nov 2002 10:51:25 -0000
@@ -738,7 +738,8 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = 0;
 
-		STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK));
+		STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK),
+		    "syscall entry");
 
 		error = (*callp->sy_call)(td, args + hidden);
 	}
@@ -784,7 +785,7 @@
 	 * register set.  If we ever support an emulation where this
 	 * is not the case, this code will need to be revisited.
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "syscall exit");
 
 #ifdef DIAGNOSTIC
 	cred_free_thread(td);
Index: src/sys/i386/i386/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/trap.c,v
retrieving revision 1.237
diff -u -r1.237 trap.c
--- src/sys/i386/i386/trap.c	7 Nov 2002 01:34:23 -0000	1.237
+++ src/sys/i386/i386/trap.c	26 Nov 2002 10:51:26 -0000
@@ -1028,7 +1028,7 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame.tf_edx;
 
-		STOPEVENT(p, S_SCE, narg);
+		STOPEVENT(p, S_SCE, narg, "syscall entry");
 
 		error = (*callp->sy_call)(td, args);
 	}
@@ -1092,7 +1092,7 @@
 	 * register set.  If we ever support an emulation where this
 	 * is not the case, this code will need to be revisited.
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "syscall exit");
 
 #ifdef DIAGNOSTIC
 	cred_free_thread(td);
Index: src/sys/ia64/ia64/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/ia64/ia64/trap.c,v
retrieving revision 1.65
diff -u -r1.65 trap.c
--- src/sys/ia64/ia64/trap.c	24 Oct 2002 23:09:48 -0000	1.65
+++ src/sys/ia64/ia64/trap.c	26 Nov 2002 10:51:28 -0000
@@ -852,7 +852,8 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = 0;
 
-		STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK));
+		STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK),
+		    "syscall entry");
 
 		error = (*callp->sy_call)(td, args);
 	}
@@ -900,7 +901,7 @@
 	 * register set.  If we ever support an emulation where this
 	 * is not the case, this code will need to be revisited.
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "syscall exit");
 
 #ifdef DIAGNOSTIC
 	cred_free_thread(td);
@@ -1013,7 +1014,7 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = framep->tf_r[FRAME_R10]; /* edx */
 
-		STOPEVENT(p, S_SCE, narg);
+		STOPEVENT(p, S_SCE, narg, "ia32 syscall entry");
 
 		error = (*callp->sy_call)(td, args64);
 	}
@@ -1077,7 +1078,7 @@
 	 * register set.  If we ever support an emulation where this
 	 * is not the case, this code will need to be revisited.
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "ia32 syscall exit");
 
 #ifdef DIAGNOSTIC
 	cred_free_thread(td);
Index: src/sys/kern/kern_exec.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.201
diff -u -r1.201 kern_exec.c
--- src/sys/kern/kern_exec.c	25 Nov 2002 04:37:44 -0000	1.201
+++ src/sys/kern/kern_exec.c	26 Nov 2002 10:51:29 -0000
@@ -563,12 +563,6 @@
 	KNOTE(&p->p_klist, NOTE_EXEC);
 	p->p_flag &= ~P_INEXEC;
 
-	/*
-	 * If tracing the process, trap to debugger so breakpoints
-	 * can be set before the program executes.
-	 */
-	_STOPEVENT(p, S_EXEC, 0);
-
 	if (p->p_flag & P_TRACED)
 		psignal(p, SIGTRAP);
 
@@ -640,8 +634,14 @@
 	if (imgp->object)
 		vm_object_deallocate(imgp->object);
 
-	if (error == 0)
+	if (error == 0) {
+		/*
+		 * If tracing the process, trap to debugger so breakpoints
+		 * can be set before the program executes.
+		 */
+		STOPEVENT(p, S_EXEC, 0, "exec");
 		goto done2;
+	}
 
 exec_fail:
 	/* we're done here, clear P_INEXEC */
Index: src/sys/kern/kern_exit.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exit.c,v
retrieving revision 1.186
diff -u -r1.186 kern_exit.c
--- src/sys/kern/kern_exit.c	25 Nov 2002 04:37:44 -0000	1.186
+++ src/sys/kern/kern_exit.c	26 Nov 2002 10:51:29 -0000
@@ -227,7 +227,7 @@
 #ifdef PGINPROF
 	vmsizmon();
 #endif
-	STOPEVENT(p, S_EXIT, rv);
+	STOPEVENT(p, S_EXIT, rv, "exit");
 	wakeup(&p->p_stype);	/* Wakeup anyone in procfs' PIOCWAIT */
 
 	/* 
Index: src/sys/kern/kern_sig.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.197
diff -u -r1.197 kern_sig.c
--- src/sys/kern/kern_sig.c	25 Oct 2002 19:10:57 -0000	1.197
+++ src/sys/kern/kern_sig.c	26 Nov 2002 10:51:32 -0000
@@ -1687,7 +1687,7 @@
 		sig = sig_ffs(&mask);
 		prop = sigprop(sig);
 
-		_STOPEVENT(p, S_SIG, sig);
+		_STOPEVENT(p, S_SIG, sig, "issignal");
 
 		/*
 		 * We should see pending but ignored signals
@@ -1876,7 +1876,7 @@
 		ktrpsig(sig, action, p->p_flag & P_OLDMASK ?
 		    &p->p_oldsigmask : &p->p_sigmask, 0);
 #endif
-	_STOPEVENT(p, S_SIG, sig);
+	_STOPEVENT(p, S_SIG, sig, "postsig");
 
 	if (action == SIG_DFL) {
 		/*
@@ -2097,7 +2097,7 @@
 	off_t limit;
 
 	PROC_LOCK(p);
-	_STOPEVENT(p, S_CORE, 0);
+	_STOPEVENT(p, S_CORE, 0, "coredump");
 
 	if (((sugid_coredump == 0) && p->p_flag & P_SUGID) || do_coredump == 0) {
 		PROC_UNLOCK(p);
Index: src/sys/kern/sys_process.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/sys_process.c,v
retrieving revision 1.104
diff -u -r1.104 sys_process.c
--- src/sys/kern/sys_process.c	16 Oct 2002 16:28:33 -0000	1.104
+++ src/sys/kern/sys_process.c	26 Nov 2002 10:51:32 -0000
@@ -740,7 +740,8 @@
  * (cleared by PIOCCONT in procfs).
  */
 void
-stopevent(struct proc *p, unsigned int event, unsigned int val)
+stopevent(struct proc *p, unsigned int event, unsigned int val,
+    const char *tag)
 {
 
 	PROC_LOCK_ASSERT(p, MA_OWNED | MA_NOTRECURSED);
@@ -750,6 +751,6 @@
 		p->p_xstat = val;
 		p->p_stype = event;	/* Which event caused the stop? */
 		wakeup(&p->p_stype);	/* Wake up any PIOCWAIT'ing procs */
-		msleep(&p->p_step, &p->p_mtx, PWAIT, "stopevent", 0);
+		msleep(&p->p_step, &p->p_mtx, PWAIT, tag, 0);
 	} while (p->p_step);
 }
Index: src/sys/powerpc/powerpc/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/powerpc/powerpc/trap.c,v
retrieving revision 1.34
diff -u -r1.34 trap.c
--- src/sys/powerpc/powerpc/trap.c	4 Oct 2002 01:19:18 -0000	1.34
+++ src/sys/powerpc/powerpc/trap.c	26 Nov 2002 10:51:33 -0000
@@ -417,7 +417,7 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame->fixreg[FIRSTARG + 1];
 
-		STOPEVENT(p, S_SCE, narg);
+		STOPEVENT(p, S_SCE, narg, "syscall entry");
 
 		error = (*callp->sy_call)(td, params);
 	}
@@ -471,7 +471,7 @@
 	/*
 	 * Does the comment in the i386 code about errno apply here?
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "syscall exit");
 
 #ifdef WITNESS
 	if (witness_list(td)) {
Index: src/sys/sparc64/sparc64/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/sparc64/sparc64/trap.c,v
retrieving revision 1.51
diff -u -r1.51 trap.c
--- src/sys/sparc64/sparc64/trap.c	26 Oct 2002 17:38:20 -0000	1.51
+++ src/sys/sparc64/sparc64/trap.c	26 Nov 2002 10:51:33 -0000
@@ -563,7 +563,7 @@
 		td->td_retval[0] = 0;
 		td->td_retval[1] = 0;
 
-		STOPEVENT(p, S_SCE, narg);	/* MP aware */
+		STOPEVENT(p, S_SCE, narg, "syscall entry");	/* MP aware */
 
 		error = (*callp->sy_call)(td, argp);
 
@@ -627,7 +627,7 @@
 	 * register set.  If we ever support an emulation where this
 	 * is not the case, this code will need to be revisited.
 	 */
-	STOPEVENT(p, S_SCX, code);
+	STOPEVENT(p, S_SCX, code, "syscall exit");
 
 #ifdef DIAGNOSTIC
 	cred_free_thread(td);
Index: src/sys/sys/proc.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/proc.h,v
retrieving revision 1.283
diff -u -r1.283 proc.h
--- src/sys/sys/proc.h	22 Nov 2002 23:57:01 -0000	1.283
+++ src/sys/sys/proc.h	26 Nov 2002 10:51:33 -0000
@@ -733,15 +733,15 @@
 		FREE(s, M_SESSION);					\
 }
 
-#define	STOPEVENT(p, e, v) do {						\
+#define	STOPEVENT(p, e, v, s) do {					\
 	PROC_LOCK(p);							\
-	_STOPEVENT((p), (e), (v));					\
+	_STOPEVENT((p), (e), (v), s);					\
 	PROC_UNLOCK(p);							\
 } while (0)
-#define	_STOPEVENT(p, e, v) do {					\
+#define	_STOPEVENT(p, e, v, s) do {					\
 	PROC_LOCK_ASSERT(p, MA_OWNED);					\
 	if ((p)->p_stops & (e)) {					\
-		stopevent((p), (e), (v));				\
+		stopevent((p), (e), (v), "stopevent (" s ")");		\
 	}								\
 } while (0)
 
@@ -882,7 +882,7 @@
 void	setrunqueue(struct thread *);
 void	setsugid(struct proc *p);
 void	sleepinit(void);
-void	stopevent(struct proc *, u_int, u_int);
+void	stopevent(struct proc *, u_int, u_int, const char *);
 void	cpu_idle(void);
 void	cpu_switch(void);
 void	cpu_throw(void) __dead2;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021126123725.A23726>