[rfc v2 0/6] unencrypted atomic DMA pools with dynamic expansion
From: David Rientjes
Date: Wed Apr 08 2020 - 17:21:08 EST
set_memory_decrypted() may block so it is not possible to do non-blocking
allocations through the DMA API for devices that required unencrypted
memory.
The solution is to expand the atomic DMA pools for the various possible
gfp requirements as a means to prevent an unnecessary depletion of lowmem.
These atomic pools are separated from the remap code and can be selected
for configurations that need them outside the scope of
CONFIG_DMA_DIRECT_REMAP, such as CONFIG_AMD_MEM_ENCRYPT.
These atomic DMA pools are kept unencrypted so they can immediately be
used for non-blocking allocations. Since the need for this type of memory
depends on the kernel config and devices being used, these pools are also
dynamically expandable.
There are a number of changes to v1 of the patchset based on Christoph's
feedback and the separation of the atomic pools out into the new
kernel/dma/pool.c.
NOTE! I'd like eyes from Christoph specifically on patch 4 in the series
where we handle the coherent pools differently depending on
CONFIG_DMA_COHERENT_POOL and/or CONFIG_DMA_DIRECT_REMAP and from Thomas
on the requirement for set_memory_decrypted() for all DMA coherent pools.
Why still an RFC? We are starting to aggressively test this series but
since there were a number of changes that were requested for the first
RFC, it would be better to have feedback and factor that into the series
earlier rather than later so testing can be focused on a series that
could be merged upstream.
This patchset is based on latest Linus HEAD:
commit ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
Author: Hillf Danton <hdanton@xxxxxxxx>
Date: Wed Apr 8 11:59:24 2020 -0400
mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal
---
arch/x86/Kconfig | 1 +
drivers/iommu/dma-iommu.c | 5 +-
include/linux/dma-direct.h | 2 +
include/linux/dma-mapping.h | 6 +-
kernel/dma/Kconfig | 6 +-
kernel/dma/Makefile | 1 +
kernel/dma/direct.c | 28 ++++-
kernel/dma/pool.c | 224 ++++++++++++++++++++++++++++++++++++
kernel/dma/remap.c | 114 ------------------
9 files changed, 261 insertions(+), 126 deletions(-)
create mode 100644 kernel/dma/pool.c