interrupt handlers in -current
Duncan Barclay
dmlb at dmlb.org
Thu Jun 5 16:27:06 PDT 2003
On 05-Jun-2003 M. Warner Losh wrote:
> In message: <XFMail.20030605220236.dmlb at dmlb.org>
> Duncan Barclay <dmlb at dmlb.org> 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 at dmlb.org |
dmlb at freebsd.org|
More information about the freebsd-hackers
mailing list