DMA랑 cache 관련 커널 문서 문의
안녕하세요
커널 문서를 읽다 궁금한게 있어서 문의 드립니다
#1. scatter list
dma를 하려면 물리적으로 선형 주소의 메모리가 필요하잖아요
그런데 그게 힘들 경우 scatter list를 구성해서 불연속을 마치 연속적인 것 처럼 에뮬레이션 해주는 것 같은데요
요게 하드웨어적으로 IOMMU가 해주는건가요?
or DMA를 짧게...끊어서 하는 개념인가요?(DMA streaming?)
#2. kmalloc 메모리 할당할 때 cache size에 align하는거랑 coherent한거랑 뭔 상관이 있나요??
2) ARCH_DMA_MINALIGN
Architectures must ensure that kmalloc'ed buffer is
DMA-safe. Drivers and subsystems depend on it. If an architecture
isn't fully DMA-coherent (i.e. hardware doesn't ensure that data in
the CPU cache is identical to data in main memory),
ARCH_DMA_MINALIGN must be set so that the memory allocator
makes sure that kmalloc'ed buffer doesn't share a cache line with
the others. See arch/arm/include/asm/cache.h as an example.
Note that ARCH_DMA_MINALIGN is about DMA memory alignment
constraints. You don't need to worry about the architecture data
alignment constraints (e.g. the alignment constraints about 64-bit
objects).
dma 할 때 할당된 메모리가 cache 내용이랑 다른 충돌이 발생할 수 있다는건 이해가 되는데
ARCH_DMA_MINALIGN을 설정해서 메모리가 cache align 되면 충돌이 발생하지 않고 매번 update가 된다는건가요?
그럼 반대로 메모리가 cache 사이즈보다 작으면(예를 들어 1KB) cache가 update되지 않나요??
댓글 달기