Re: kernel panic with pccard insert on recent 7.0 CURRENT

From: John Baldwin <jhb_at_freebsd.org>
Date: Mon, 16 Jul 2007 12:51:08 -0400
On Monday 16 July 2007 11:13:15 am M. Warner Losh wrote:
> In message: <200707160850.46259.jhb_at_freebsd.org>
>             John Baldwin <jhb_at_freebsd.org> writes:
> : On Sunday 17 June 2007 01:56:59 am M. Warner Losh wrote:
> : > In message: <20070617053746.GV4602_at_funkthat.com>
> : >             John-Mark Gurney <gurney_j_at_resnet.uoregon.edu> writes:
> : > : Warner Losh wrote this message on Sat, Jun 16, 2007 at 21:12 -0600:
> : > : > In message: <20070617024935.GU4602_at_funkthat.com>
> : > : >             John-Mark Gurney <gurney_j_at_resnet.uoregon.edu> writes:
> : > : > : Warner Losh wrote this message on Sat, Jun 16, 2007 at 
17:33 -0600:
> : > : > : > Also, I'm unclear on the difference between FILTER_STRAY and
> : > : > : > FILTER_HANDLED.
> : > : > : 
> : > : > : The interrupt filter is suppose to return one of FILTER_STRAY or
> : > : > : FILTER_HANDLED...  If you _HANDLED it return that, otherwise 
return
> : > : > : _STRAY...  If you need to schedule the ithread, return _HANDLED 
or'd
> : > : > : with _SCHEDULE_THREAD...
> : > : > 
> : > : > Will _HANDLED cause all the other handlers to not get called, or 
just
> : > : > the stray interrupt code from not happening?
> : > : 
> : > : It will cause the remaining (not yet called) handlers not to get 
called...
> : > 
> : > I'm not sure that's right, especially for edge triggered devices.\
> : 
> : They shouldn't share interrupts then.  Do we support shared interrupts on 
edge 
> : triggered devices?
> 
> We support sharing interrupts on edge triggered devices.  At least it
> has worked on FreeBSD 2.2.1 through 6.2.  We have to continue to
> support it, and to do that, we can't have HANDLED stop processing.
> 
> It is a sad fact of life, but we have to continue to support that.
> 
> As an aside, some ISA hardware cannot support sharing of interrupts,
> but simple modification of the drivers allows one to share ISA
> interrupts.  My company has been doing this successfully for about 12
> years, and using FreeBSD to do it for at least the past 10 years.

Are there any edge triggered interrupts that aren't hooked up to an edge 
triggered interrupt pin (like a pin on an 8259A that is set to be edge 
triggered in the ELCR)?  We know if an interrupt source is edge or level and 
can act appropriately in the low-level code.
 
> : > : intr_event_handle calls intr_filter_loop which will return on the 
first
> : > : non-_STRAY handler and return it...  Which intr_event_handle eoi's...
> : > :
> : > : It looks like this code is designed for level triggered interrupts and
> : > : not edge triggered...
> : > 
> : > Yes.  I'm pretty sure that's wrong.  All ISA and PC Card devices use
> : > edge triggered interrupts.  Also, it is inefficient for level
> : > triggered interrupts, since two interrupt sources on the same
> : > interrupt may trigger at about the same time...
> : 
> : It works fine since the second device will interrupt again and we will 
fall 
> : through to its routine on the second interrupt.  The idea is that 
> : simultaneous interrupts are rare enough that it is worth optimizing the 
> : common case.
> 
> Actually, PC Card devices aren't necessarily edge triggered, but can
> be either edge triggered or level triggered.  They can live in bridges
> that are either Edge triggered or level triggered depending on the
> topology of the bus they live on.
> 
> In any event, the current code is incorrect and needs to be fixed.

It's a perfectly fine optimization for machines where level interrupts are 
shared and so I'd rather think about this and not just throw it out.  So what 
happens when you stick a pccard in a PCI bridge whose upstream interrupt is a 
level-triggered PCI interrupt.  Is the interrupt that the OS sees edge or 
level?

-- 
John Baldwin
Received on Mon Jul 16 2007 - 15:16:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC