CC linux-kernel 2010/9/18 Wolfgang Mües <wolfgang@xxxxxxxxxxxxx>: > Hi, Thanks for your reply. > > Am Freitag, 17. September 2010 16:59:25 schrieb Ming Lei: >> The warning only means dma_free_coherent is called with irq disabled. >> It is not very difficult to fix the warning in usb hcd, but I need to know >> why the WARN_ON below is added into dma_free_coherent. >> >> WARN_ON(irqs_disabled()); >> >> Anyone know the reason? > > Hmm... Coherent buffers are ment to be kept for the whole time a driver Documentation/DMA_API.txt Consistent memory is memory for which a write by either the device or the processor can immediately be read by the processor or device without having to worry about caching effects. IMO, it is not necessary for a coherent buffer to be kept for the whole time a driver operates on a device. Also, coherent buffer is very limited in some arch(such as ARM), maybe we should use it more dynamically, instead of keeping it for long time. > operates on a device. If such a buffer is freed in an interrupt context (== a irqs_disabled() doesn't mean the buffer is freed in an interrupt context. > momentary action), this is most likely a bug in the driver. At least it is a > misuse of the concept of coherent buffers. If it is only a misuse, seems WARN_ON can be removed. Sorry, I still don't get the real reason why WARN_ON(irqs_disabled()) is added in dma_free_coherent. -- Lei Ming -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html