Skip to content

Commit 0518581

Browse files
fxkamdalexdeucher
authored andcommitted
drm/amdgpu: Don't pin VRAM without DMABUF_MOVE_NOTIFY
Pinning of VRAM is for peer devices that don't support dynamic attachment and move notifiers. But it requires that all such peer devices are able to access VRAM via PCIe P2P. Any device without P2P access requires migration to GTT, which fails if the memory is already pinned for another peer device. Sharing between GPUs should not require pinning in VRAM. However, if DMABUF_MOVE_NOTIFY is disabled in the kernel build, even DMABufs shared between GPUs must be pinned, which can lead to failures and functional regressions on systems where some peer GPUs are not P2P accessible. Disable VRAM pinning if move notifiers are disabled in the kernel build to fix regressions when sharing BOs between GPUs. Signed-off-by: Felix Kuehling <[email protected]> Tested-by: Hao (Claire) Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6df7175 commit 0518581

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,21 @@ static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
8181

8282
dma_resv_assert_held(dmabuf->resv);
8383

84-
/*
85-
* Try pinning into VRAM to allow P2P with RDMA NICs without ODP
84+
/* Try pinning into VRAM to allow P2P with RDMA NICs without ODP
8685
* support if all attachments can do P2P. If any attachment can't do
8786
* P2P just pin into GTT instead.
87+
*
88+
* To avoid with conflicting pinnings between GPUs and RDMA when move
89+
* notifiers are disabled, only allow pinning in VRAM when move
90+
* notiers are enabled.
8891
*/
89-
list_for_each_entry(attach, &dmabuf->attachments, node)
90-
if (!attach->peer2peer)
91-
domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
92+
if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) {
93+
domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
94+
} else {
95+
list_for_each_entry(attach, &dmabuf->attachments, node)
96+
if (!attach->peer2peer)
97+
domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
98+
}
9299

93100
if (domains & AMDGPU_GEM_DOMAIN_VRAM)
94101
bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;

0 commit comments

Comments
 (0)