On Thu, May 03, 2007 at 04:10:55PM -0700, Matthew Dillon wrote:
> 
> :I've built the pkgsrc 2007Q1 thunderbird but I can't reproduce a crash on 
> :startup. If its dot dirs are available, thunderbird seems to work with 
> :libc_r, vanilla libthread_xu and libthread_xu + prio patch. However, if you 
> :remove the dot dirs and start thunderbird with the symlink pointing to 
> :libthread_xu, it gets stuck waiting for two locks (presumably two threads do 
> :the waiting, ktrace is not lwp aware so doesn't help much). Kill it, and 
> next 
> :time it starts up just fine. Given that this doesn't happen using libc_r, 
> :chances are the locking code in libthread_xu could use some debugging. This 
> :would be fun to do (especially if it turns out the bug is in the mozilla 
> :code :P), but I can't volunteer.
> :
> :That said, I think the two patches I posted can safely go in. Please commit 
> :while they still apply :)
> :
> :Thanks,
> :Aggelos
> 
>     Committed!
> 
>     I can't test the lock stuff any time soon, but if ktrace does not
>     already have a field for the LWP id and someone would like to add
>     it to the kernel and support to the userland utility, submit a patch
>     any time!

Here's my attempt.

Joe
Index: kern/kern_ktrace.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/kern_ktrace.c,v
retrieving revision 1.28
diff -u -r1.28 kern_ktrace.c
--- kern/kern_ktrace.c  12 Aug 2006 00:26:20 -0000      1.28
+++ kern/kern_ktrace.c  4 May 2007 18:28:10 -0000
@@ -66,12 +66,14 @@
 {
        struct ktr_header *kth;
        struct proc *p = curproc;       /* XXX */
+       struct lwp *lp = curthread->td_lwp;
 
        MALLOC(kth, struct ktr_header *, sizeof (struct ktr_header),
                M_KTRACE, M_WAITOK);
        kth->ktr_type = type;
        microtime(&kth->ktr_time);
        kth->ktr_pid = p->p_pid;
+       kth->ktr_tid = lp->lwp_tid;
        bcopy(p->p_comm, kth->ktr_comm, MAXCOMLEN + 1);
        return (kth);
 }
Index: sys/ktrace.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/ktrace.h,v
retrieving revision 1.8
diff -u -r1.8 ktrace.h
--- sys/ktrace.h        21 May 2006 03:43:47 -0000      1.8
+++ sys/ktrace.h        4 May 2007 18:56:49 -0000
@@ -80,6 +80,7 @@
        int     ktr_len;                /* length of buf */
        short   ktr_type;               /* trace record type */
        pid_t   ktr_pid;                /* process id */
+       lwpid_t ktr_tid;                /* lwp id */
        char    ktr_comm[MAXCOMLEN+1];  /* command name */
        struct  timeval ktr_time;       /* timestamp */
        caddr_t ktr_buf;
Index: kdump.c
===================================================================
RCS file: /home/dcvs/src/usr.bin/kdump/kdump.c,v
retrieving revision 1.7
diff -u -r1.7 kdump.c
--- kdump.c     20 Jul 2006 22:57:47 -0000      1.7
+++ kdump.c     4 May 2007 18:29:53 -0000
@@ -209,7 +209,7 @@
                type = unknown;
        }
 
-       col = printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm);
+       col = printf("%6d %6d %-8.*s ", kth->ktr_pid, kth->ktr_tid, MAXCOMLEN, 
kth->ktr_comm);
        if (timestamp) {
                if (timestamp == 2) {
                        temp = kth->ktr_time;

Reply via email to