Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1595424
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Question] devm_kmalloc() for DMA ? |
| Date | 2017-03-08 19:10 +0100 |
| Message-ID | <tiOc9-1K6-15@gated-at.bofh.it> (permalink) |
| References | <tiHDI-5Js-13@gated-at.bofh.it> <tiHNo-5Nf-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Robin, 2017-03-08 20:15 GMT+09:00 Robin Murphy <robin.murphy@arm.com>: > On 08/03/17 10:59, Masahiro Yamada wrote: >> Hi experts, >> >> I have a question about >> how to allocate DMA-safe buffer. >> >> >> In my understanding, kmalloc() returns >> memory with DMA safe alignment >> in order to avoid cache-sharing problem when used for DMA. >> >> The alignment is decided by ARCH_DMA_MINALIGN. >> For example, on modern ARM 32bit boards, this value is typically 64. >> So, memory returned by kmalloc() has >> at least 64 byte alignment. >> >> >> On the other hand, devm_kmalloc() does not return >> enough-aligned memory. > > How so? If anything returned by kmalloc() is guaranteed to occupy some > multiple of ARCH_DMA_MINALIGN bytes in order to avoid two allocations > falling into the same cache line, I don't see how stealing the first 16 > bytes *of a single allocation* could make it start sharing cache lines > with another? :/ I just thought of traverse of the linked list of devres_node on a different thread, but it should not happen. Please forget my stupid question. > If a particular device has a problem with: > > p = kmalloc(...); > d = dma_map_single(p + 0x10, ...); > do_something_with(d); > > that's a separate issue altogether. Right. Each device has own requirement for DMA alignment. Thanks! -- Best Regards Masahiro Yamada
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Question] devm_kmalloc() for DMA ? Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-08 12:10 +0100
Re: [Question] devm_kmalloc() for DMA ? Robin Murphy <robin.murphy@arm.com> - 2017-03-08 12:20 +0100
Re: [Question] devm_kmalloc() for DMA ? Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-08 19:10 +0100
Re: [Question] devm_kmalloc() for DMA ? Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-08 21:20 +0100
Re: [Question] devm_kmalloc() for DMA ? Lars-Peter Clausen <lars@metafoo.de> - 2017-03-08 21:50 +0100
Re: [Question] devm_kmalloc() for DMA ? Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-08 22:30 +0100
Re: [Question] devm_kmalloc() for DMA ? Lars-Peter Clausen <lars@metafoo.de> - 2017-03-09 00:10 +0100
Re: [Question] devm_kmalloc() for DMA ? Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-09 04:30 +0100
Re: [Question] devm_kmalloc() for DMA ? Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-09 10:30 +0100
Re: [Question] devm_kmalloc() for DMA ? Lars-Peter Clausen <lars@metafoo.de> - 2017-03-08 21:50 +0100
Re: [Question] devm_kmalloc() for DMA ? Robin Murphy <robin.murphy@arm.com> - 2017-03-09 12:30 +0100
csiph-web