From owner-freebsd-current Thu Sep 14 16: 1:48 2000 Delivered-To: freebsd-current@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id CE5EC37B423; Thu, 14 Sep 2000 16:01:41 -0700 (PDT) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=root) by scientia.demon.co.uk with esmtp (Exim 3.16 #1) id 13ZhYW-0007Fi-00; Thu, 14 Sep 2000 23:32:32 +0100 Received: (from ben@localhost) by strontium.scientia.demon.co.uk (8.9.3/8.9.3) id XAA65575; Thu, 14 Sep 2000 23:32:32 +0100 (BST) (envelope-from ben) Date: Thu, 14 Sep 2000 23:32:31 +0100 From: Ben Smithurst To: Bruce Evans Cc: current@FreeBSD.ORG, jasone@FreeBSD.org, jhb@FreeBSD.org Subject: Re: page fault in sched_ithd Message-ID: <20000914233231.N77593@strontium.scientia.demon.co.uk> References: <20000909210619.F77593@strontium.scientia.demon.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Ls2Gy6y7jbHLe9Od" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --Ls2Gy6y7jbHLe9Od Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Bruce Evans wrote: > On Sat, 9 Sep 2000, Ben Smithurst wrote: > >> After poking around a bit with remote GDB, this seems to be caused by a >> stray IRQ 7, since irq == 7, ir == ithds[irq] == NULL, ir->foo == BOOM. >> >> The attached rather crude patch has "fixed" the problem for now, but >> does anyone have any suggestions for a real fix? > > The stray interrupt handler needs to have a thread, or stray interrupts > need to be handled as traps. Stray interrupts are more like NMIs than > normal interrupts, and NMIs are already (mis)handled as traps. OK, but would you or anyone else object to the attached patch as a temporary fix, at least? Page-faulting almost immediately is not particularly good. The patch doesn't seem to have had any negative effects so far. Who are the main people responsible for the SMPng stuff anyway? jasone and jhb seem to have been involved a bit, so I cc'd them as well. -- Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D --Ls2Gy6y7jbHLe9Od Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ithread.diff" Index: ithread.c =================================================================== RCS file: /usr/cvs/src/sys/i386/isa/ithread.c,v retrieving revision 1.3 diff -u -r1.3 ithread.c --- ithread.c 2000/09/13 18:33:23 1.3 +++ ithread.c 2000/09/14 22:06:44 @@ -95,6 +95,8 @@ SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) +#define MAX_STRAY_LOG 5 + /* * Schedule a heavyweight interrupt process. This function is called * from the interrupt handlers Xintr. @@ -103,6 +105,7 @@ sched_ithd(void *cookie) { int irq = (int) cookie; /* IRQ we're handling */ + static int straycount[NHWI]; /* count of stray IRQs */ struct ithd *ir = ithds[irq]; /* and the process that does it */ /* This used to be in icu_vector.s */ @@ -144,6 +147,21 @@ } #endif + /* XXX: quick fix to avoid page fault until this is done properly. */ + if (ir == NULL) { + if (irq < NHWI) { + if (straycount[irq] < MAX_STRAY_LOG) { + printf("stray irq %d\n", irq); + if (++straycount[irq] == MAX_STRAY_LOG) + printf("got %d stray irq %d's: " + "not logging anymore\n", + MAX_STRAY_LOG, irq); + } + return; + } + panic("sched_ithd: ithds[%d] == NULL", irq); + } + /* * Set it_need so that if the thread is already running but close * to done, it will do another go-round. Then get the sched lock --Ls2Gy6y7jbHLe9Od-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message