kernel panic
Quoted 6 lines
I have attached the panic output and the symbol table again.
Thanks for the help!
- Ryan
OK, the problem is that you are getting into a interrupt loop. I see the following repeated sequence on the stack:
intr_extint <-----------+ do_irq_mask | do_irq | dino_isr | sym53c8xx_intr | scsi_old_done | rw_intr | scsi_io_completion | __scsi_end_request | scsi_queue_next_request | scsi_request_fn | scsi_dispatch_cmd | <NEXT INTERRUPT> >-----------+
I still was not able to get to the base of the stack. I believe you are crossing many 16K blocks of memory, and die when the next timer interrupt comes in.
Note that there is a path from scsi_dispatch_cmd that eventually calls ccio_map_sg, i.e. I believe scsi_dispatch_cmd had already called ccio_map_sg (indirectly) before the interupt came in. Since the interrupt always comes in at the exact same instruction in scsi_dispatch_cmd, it probably is happening at some point where the driver reenables interrupts.
So, it looks like the printk in ccio_map_sg is causing the isr to take long enough that the previous scsi command completes and the card interrupts before the isr returns. This shouldn't happen. I talked to Richard Hirst, and he said a later version of the sym53c8xx driver processes things differently (using scsi_done instead of scsi_old_done) so that this shouldn't happen. However, I believe it shouldn't be happening anyway, because we should be preventing the isr from being re-entered in the general irq handling code.
The bad news is that since this problem is being "caused" by the printk, it probably does not explain your original bug (hopefully the scsi isr normally takes much less time to complete than the actual scsi request does!). However, if this interrupt loop is fixed, you would then be able to use printk to help debug the real problem.
I can't remember if your original problem crashed the system or just caused data corruption. If the machine stays up, a debugging workaround might be to store data in an internal array instead of using printk. You could then dump this array after the problem occured. One possible hack to dump the array would be to add code to dump it via the proc fs code that already exists in the ccio_dma code.
John
Quoted 6 lines · John Marvin
I can't remember if your original problem crashed the system or just caused data corruption. If the machine stays up, a debugging workaround might be to store data in an internal array instead of using printk. You could then dump this array after the problem occured. One possible hack to dump the array would be to add code to dump it via the proc fs code that already exists in the
ccio_dmacode.
or just use printk(KERN_DEBUG "foo"); since this won't output to console.
Signature · 1 line
Revolutions do not require corporate support.
John Marvin wrote:
...
Quoted 16 lines
OK, the problem is that you are getting into a interrupt loop. I see the following repeated sequence on the stack:
intr_extint <-----------+ do_irq_mask | do_irq | dino_isr | sym53c8xx_intr | scsi_old_done | rw_intr | scsi_io_completion | __scsi_end_request | scsi_queue_next_request | scsi_request_fn | scsi_dispatch_cmd | <NEXT INTERRUPT> >-----------+
Uh oh. that's a bug. From irq.c:do_irq_mask()
...
mask_irq(irq_num);
do_irq(®ion->action[irq], irq_num, regs);
unmask_irq(irq_num);...
So it shouldn't be possible to take another interrupt while in do_irq().
...
Quoted 5 lines
to Richard Hirst, and he said a later version of the sym53c8xx driver processes things differently (using
scsi_doneinstead ofscsi_old_done) so that this shouldn't happen. However, I believe it shouldn't be happening anyway, because we should be preventing the isr from being re-entered in the general irq handling code.
Exactly. But if the driver is mucking with IRQ enable/disable, does that mean the enable/disable code has to keep reference counts? Don't recall any archs doing that when we did the initial implementation.
grant
Grant Grundler
parisc-linux {PCI|IOMMU|SMP} hacker
+1.408.447.7253
Quoted 3 lines · Grant Grundler
Exactly. But if the driver is mucking with IRQ enable/disable, does that mean the enable/disable code has to keep reference counts? Don't recall any archs doing that when we did the initial implementation.
cli -> disables irqs on all processors__cli -> disables irqs on local processor
sti -> enables irqs on all processors__sti -> enable irqs on local processor
spin_lock_irqsave -> disables interrupts locally, puts the previous state into the state variable you supplied and acquires the spinlock spin_lock_irqrestore -> releases the spinlock and restores previous state from state variable
no need to keep enable/disable counts, the previous state gets stored for you. if you're using cli and sti inappropriately, you lose.
Signature · 1 line
Revolutions do not require corporate support.
Quoted 10 lines · Matthew Wilcox
Quoted 3 lines · Grant Grundler
Exactly. But if the driver is mucking with IRQ enable/disable, does that mean the enable/disable code has to keep reference counts? Don't recall any archs doing that when we did the initial implementation.
cli -> disables irqs on all processors
__cli-> disables irqs on local processor
sti -> enables irqs on all processors__sti-> enable irqs on local processor
Quoted 7 lines
spin_lock_irqsave-> disables interrupts locally, puts the previous state into the state variable you supplied and acquires the spinlockspin_lock_irqrestore-> releases the spinlock and restores previous state from state variableno need to keep enable/disable counts, the previous state gets stored for you. if you're using cli and sti inappropriately, you lose.
You mean like scsi_request_fn() calling spin_unlock_irq(&io_request_lock); when called at interrupt level?
Quoted 16 lines
OK, the problem is that you are getting into a interrupt loop. I see the following repeated sequence on the stack:
intr_extint <-----------+ do_irq_mask | do_irq | dino_isr | sym53c8xx_intr | scsi_old_done | rw_intr | scsi_io_completion | __scsi_end_request | scsi_queue_next_request | scsi_request_fn | <<<< re-enables interrupts scsi_dispatch_cmd | <NEXT INTERRUPT> >-----------+
I also found
spin_lock(&lock) can also be used in your interrupt handler if your device only uses one interrupt: the kernel guarantees that a interrupt handler is never reentered, even if the interrupt handler runs with enabled interrupts.
in <http://kt.zork.net/kernel-traffic/kt20000703_74.txt>
Richard
Quoted 2 lines · Richard Hirst
You mean like
scsi_request_fn()callingspin_unlock_irq(&io_request_lock); when called at interrupt level?
spin_unlock_irq() can only twiddle the I-bit (PSW) since it's not told which irq to save/restore state for. But the EIEM bit in CR15 should remain masked. So I don't think this code should be a problem.
*Someone* is unmasking the CPU EIEM bit for dino_isr(). And that's a bug since only do_irq_mask() should be unmasking it when the ISR completes. This is orthogonal to the I-bit state.
...
Quoted 8 lines
I also found
spin_lock(&lock)can also be used in your interrupt handler if your device only uses one interrupt: the kernel guarantees that a interrupt handler is never reentered, even if the interrupt handler runs with enabled interrupts.
I read the kt summary. The wording is somewhat ambiguous.
Each device instance will typically use one interrupt.
The above statement suggests to me the driver ISR gets called serially to handle each device instance. That's certainly not the case for anything with IO APIC or SAPIC.
I think he meant the ISR won't get re-entered for a given instance of a device. And the kernel does that by masking the particular IRQ assigned to that device instance.
For some reason that doesn't appear to be working for dino.
grant
Grant Grundler
parisc-linux {PCI|IOMMU|SMP} hacker
+1.408.447.7253