fixing irq latency from spin_lock_irqsave
Hello developers,
Hopefully this is the right list. I'm trying to improve interrupt latency on my 1ghz Marvell ARM platform. I used the irqsoff tracer to check drivers one-by-one and characterize my system. My max latency is 80-500 uS at idle and certain drivers are hotspots: ath9k (3000 uS), sata disk (2000 uS), and 8250 serial (9000+ uS).
In each case it looks like the latency was caused by spin_lock_irqsave() around something that waited for I/O. For example function ath9k_ps_wakeup holds a spin lock for a 10ms timeout while the card powers up. Or function serial8250_console_write holds a spin lock waiting for bytes to transmit at 115.2 kBaud.
My plan was to change any of these hotspots to a threaded IRQ handler, change spin locks to mutex, and retest. That worked in some simple cases but ath9k has 10+ spinlocks, tasklets, etc. Can anybody recommend a general approach for improving spin_lock_irqsave() without completely reworking each driver's locking strategy? Are there any documents that I should start with?
-joey