Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-buf: Always build with DMABUF_MOVE_NOTIFY

DMABUF_MOVE_NOTIFY was introduced in 2018 and has been marked as
experimental and disabled by default ever since. Six years later,
all new importers implement this callback.

It is therefore reasonable to drop CONFIG_DMABUF_MOVE_NOTIFY and
always build DMABUF with support for it enabled.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20260124-dmabuf-revoke-v5-3-f98fca917e96@nvidia.com
Signed-off-by: Christian König <christian.koenig@amd.com>

authored by

Leon Romanovsky and committed by
Christian König
609fc876 95308225

+10 -32
-12
drivers/dma-buf/Kconfig
··· 40 40 A driver to let userspace turn memfd regions into dma-bufs. 41 41 Qemu can use this to create host dmabufs for guest framebuffers. 42 42 43 - config DMABUF_MOVE_NOTIFY 44 - bool "Move notify between drivers (EXPERIMENTAL)" 45 - default n 46 - depends on DMA_SHARED_BUFFER 47 - help 48 - Don't pin buffers if the dynamic DMA-buf interface is available on 49 - both the exporter as well as the importer. This fixes a security 50 - problem where userspace is able to pin unrestricted amounts of memory 51 - through DMA-buf. 52 - This is marked experimental because we don't yet have a consistent 53 - execution context and memory management between drivers. 54 - 55 43 config DMABUF_DEBUG 56 44 bool "DMA-BUF debug checks" 57 45 depends on DMA_SHARED_BUFFER
+1 -2
drivers/dma-buf/dma-buf.c
··· 916 916 dma_buf_pin_on_map(struct dma_buf_attachment *attach) 917 917 { 918 918 return attach->dmabuf->ops->pin && 919 - (!dma_buf_attachment_is_dynamic(attach) || 920 - !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)); 919 + !dma_buf_attachment_is_dynamic(attach); 921 920 } 922 921 923 922 /**
+3 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
··· 145 145 * notifiers are disabled, only allow pinning in VRAM when move 146 146 * notiers are enabled. 147 147 */ 148 - if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) { 149 - domains &= ~AMDGPU_GEM_DOMAIN_VRAM; 150 - } else { 151 - list_for_each_entry(attach, &dmabuf->attachments, node) 152 - if (!attach->peer2peer) 153 - domains &= ~AMDGPU_GEM_DOMAIN_VRAM; 154 - } 148 + list_for_each_entry(attach, &dmabuf->attachments, node) 149 + if (!attach->peer2peer) 150 + domains &= ~AMDGPU_GEM_DOMAIN_VRAM; 155 151 156 152 if (domains & AMDGPU_GEM_DOMAIN_VRAM) 157 153 bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+1 -1
drivers/gpu/drm/amd/amdkfd/Kconfig
··· 27 27 28 28 config HSA_AMD_P2P 29 29 bool "HSA kernel driver support for peer-to-peer for AMD GPU devices" 30 - depends on HSA_AMD && PCI_P2PDMA && DMABUF_MOVE_NOTIFY 30 + depends on HSA_AMD && PCI_P2PDMA 31 31 help 32 32 Enable peer-to-peer (P2P) communication between AMD GPUs over 33 33 the PCIe bus. This can improve performance of multi-GPU compute
+1 -2
drivers/gpu/drm/xe/tests/xe_dma_buf.c
··· 22 22 23 23 static bool is_dynamic(struct dma_buf_test_params *params) 24 24 { 25 - return IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY) && params->attach_ops && 26 - params->attach_ops->invalidate_mappings; 25 + return params->attach_ops && params->attach_ops->invalidate_mappings; 27 26 } 28 27 29 28 static void check_residency(struct kunit *test, struct xe_bo *exported,
+4 -8
drivers/gpu/drm/xe/xe_dma_buf.c
··· 56 56 bool allow_vram = true; 57 57 int ret; 58 58 59 - if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) { 60 - allow_vram = false; 61 - } else { 62 - list_for_each_entry(attach, &dmabuf->attachments, node) { 63 - if (!attach->peer2peer) { 64 - allow_vram = false; 65 - break; 66 - } 59 + list_for_each_entry(attach, &dmabuf->attachments, node) { 60 + if (!attach->peer2peer) { 61 + allow_vram = false; 62 + break; 67 63 } 68 64 } 69 65