I have a kernel list that is accessible by both ISR (top half) and bottom half (workqueue in my case). Originally I was using spin_lock_irqsave()/spin_unlock_irqstore() to disable interrupts inside both ISR and bottom half.
The program works fine except a warning because I am calling dma_alloc_coherent() inside spin_lock_irqsave()/spin_lock_irqstore(). I have checked the code looks like this function is not supposed to be called when interrupt is disabled... After switching to use spin_lock() inside workqueue but keep spin_lock_irqsave() inside ISR and the warning goes away...
I have to use spin_lock() inside the workqueue because limitation of the project. So is this program really safe after the compromise?
PS: I was using GFP_KERNEL with dma_alloc_coherent() earlier, not sure if GFP_ATOMIC is the right flag to use instead?