From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 5 16:27:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF43037B401 for ; Thu, 5 Jun 2003 16:27:05 -0700 (PDT) Received: from dmlb.org (pc2-cmbg4-6-cust36.cmbg.cable.ntl.com [81.96.76.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDFC043F3F for ; Thu, 5 Jun 2003 16:27:04 -0700 (PDT) (envelope-from dmlb@dmlb.org) Received: from slave.my.domain ([192.168.200.39]) by dmlb.org with esmtp (Exim 3.36 #1) id 19O48H-0006dj-00; Fri, 06 Jun 2003 00:26:57 +0100 Received: from dmlb by slave.my.domain with local (Exim 3.36 #1) id 19O48H-0002KT-00; Fri, 06 Jun 2003 00:26:57 +0100 Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20030605.170134.132933173.imp@bsdimp.com> Date: Fri, 06 Jun 2003 00:26:57 +0100 (BST) From: Duncan Barclay To: "M. Warner Losh" Sender: Duncan Barclay cc: freebsd-hackers@freebsd.org Subject: Re: interrupt handlers in -current X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2003 23:27:06 -0000 On 05-Jun-2003 M. Warner Losh wrote: > In message: > Duncan Barclay writes: >: This is more of a confirmation of my understanding than anything else. >: In -current, should an interrupt thread be created you set up an interrupt >: handler? If so, then I'd better check my code because I haven't got one! > > No. Just because we handle interrupts in a thread doesn't mean client > devices need to create a thread. The thread is creted automatically > and the routine passed to bus_setup_intr() is then called when an > interrupt happens. Rereading what I wrote, I might have mistyped and asked the wrong question. I think what you saying is that bus_setup_intr() doesn't create the thread, (in the sense of it appear in ps -ax?) but a thread is created automatically when the first interrupt occurs? > You can create threads, taskqueues and other things, but those aren't > required. Good - bus_dma is warping my head too much...I think I've got it right. >: If a PCI device generates an interrupt and there is no handler does the >: kernel report a stary interrupt? > > You'll likely see an interrupt storm. Since the PCI device generates > a level interrupt, the ISRs are run and the level interrupt is still > high, so another interrupt is generated, etc. on 4.x this was fatal, > but on 5.x the system can continue to run in a degraded manner. > >: -current for me is 5.1-BETA1 and I'm doing a driver for the BCM 4401 NIC. >: I'm transmitting packets but my handler isn't being called to clean up the >: DMA. > > So you are doing bus_setup_intr() and that routine is never called? Yup. > What does vmstat say? I'd expect to see something like: > > % vmstat -i > uhci0 irq10 26083 1 ># cause the interrupt to happen > % vmstat -i > uhci0 irq10 26026083 2683 ># eg, a huge number all of a sudden If I load the kld for the driver and it attaches, nothing appears in vmstat -i, or ps -ax. Unfortunately, I've screwed up a lock in the ioctl hander and witness is panic'ing when I ifconfig the interface. As it is now bedtime I'll fix it tomorrow morning and report back. > It may also be the case that the interrupt for this isn't being > properly routed. 5.1-BETA has a bug that, for some laptop machines, > interrupts aren't properly routed. 5.1-RELEASE has fixed this. Okay, I'll do a reinstall. This probably won't happen until after the weekend because I'm going away. Anyway, I'm pleased with my progress as I can see arp requests hitting the wire before it panics. > Warner Thanks, Duncan -- ________________________________________________________________________ Duncan Barclay | dmlb@dmlb.org | dmlb@freebsd.org|