Subject: Callout table troubles, maybe? Panic, yes.
To: None <port-macppc@netbsd.org, tech-kern@netbsd.org>
From: Donald Lee <donlee_ppc@icompute.com>
List: tech-kern
Date: 02/24/2001 14:38:48
Dear list,

My panics appear to be solved, and I'm a little embarrased.

Around the first of the year, I posted some stuff about do_pending_int()
and the posted a copy of extintr.c on my ftp server.  This was
all fine.

I went one step further, and added a slightly more "aggressive" bit
of code for my "test" machine, and screwed it up.  This appears to
be my problem.

The code excerpt at the end of this message is what I was running, and
the "again" loop seems to be causing the problem by
allowing the handling of soft interrupts that are masked.
(note that it does not check the mask - just that they are newly
pending)

When I took out the "again" construct, it seems to have fixed the problem.

The extintr.c that I posted is running on my production machine, and
has had no problems. (one reboot for network fiddling on 2/2/01
but otherwise up since 1/14/01)

My apologies for the waste of bandwidth.

-dgl-


Bad code:
About line 657 in arch/macppc/macppc/extintr.c:

        /*out32rb(INT_ENABLE_REG, ~imen);*/
again:
        if (softpend & (1 << SIR_CLOCK)) {
                ipending &= ~(1 << SIR_CLOCK);
                softclock();
                intrcnt[CNT_SOFTCLOCK]++;
        }
        if (softpend & (1 << SIR_NET)) {
                ipending &= ~(1 << SIR_NET);
                softnet();
                intrcnt[CNT_SOFTNET]++;
        }
        if (softpend & (1 << SIR_SERIAL)) {
                ipending &= ~(1 << SIR_SERIAL);
                softserial();
                intrcnt[CNT_SOFTSERIAL]++;
        }
/*
 *      If new pending "soft" ints have come up, handle them now.
 */
        softmask = (1 << SIR_CLOCK) | (1 << SIR_NET) | (1 << SIR_SERIAL);
        softpend = ipending & softmask;
        if (softmask & softpend) goto again; <<<<< bad idea - check mask! <<<<<<

        cpl = pcpl;     /* Don't use splx... we are here already! */
        asm volatile("mtmsr %0" :: "r"(emsr));
        processing = 0;
}