Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 May 2001 10:03:53 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.ORG>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-current@FreeBSD.ORG, David Taylor <davidt@yadt.co.uk>
Subject:   Re: gcc -pg causes 'kernel trap 12 with interrupts disabled' & p
Message-ID:  <XFMail.010531100353.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.21.0105312300070.25846-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 31-May-01 Bruce Evans wrote:
> On Wed, 30 May 2001, David Taylor wrote:
> 
>> When trying to profile ircd-hybrid-7 on -CURRENT (I tried using a pre-vm
>> madness version first, then tried a version cvsuped today), I reliably get
>> lots of:
>> 
>>      kernel trap 12 with interrupts disabled
>> 
>> messages on the console (one every 5-10 seconds, when the ircd is reasonably
>> loaded).
> 
> This is because ast() calls addupc_task() with sched_lock held.
> addupc_task() calls copyin() and copyin() sometimes traps to fault in the
> profiling buffer.
> 
> This seems to be just a bug in ast().  userret() is missing the bug.
> Untested fix:

I think I have some comments in my local code about that sched_lock being
bogus. :-/  I'll commit a fix for all platforms today.

> ---
> Index: trap.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/i386/i386/trap.c,v
> retrieving revision 1.189
> diff -u -1 -r1.189 trap.c
> --- trap.c    2001/05/23 22:58:09     1.189
> +++ trap.c    2001/05/31 13:09:02
> @@ -1285,5 +1341,6 @@
>               mtx_lock(&Giant);
> -             mtx_lock_spin(&sched_lock);
>               addupc_task(p, p->p_stats->p_prof.pr_addr,
>                           p->p_stats->p_prof.pr_ticks);
> +             mtx_lock_spin(&sched_lock);
> +             /* XXX why not unlock Giant? */

To avoid releasing it just to possibly grab it again afterwards I think, but
I'll have to look at this again.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.Baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

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?XFMail.010531100353.jhb>