lkml.org 
[lkml]   [2010]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: USB: free coherent buffer into atomic context
From
CC linux-kernel

2010/9/18 Wolfgang Mües <wolfgang@iksw-muees.de>:
> 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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-09-18 10:53    [W:0.055 / U:26.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site