]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xe: populate buffers before exporting them.
authorDave Airlie <airlied@redhat.com>
Thu, 4 Sep 2025 02:16:42 +0000 (12:16 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 11 Sep 2025 00:04:58 +0000 (10:04 +1000)
commit91494dee1091a14d91da6bcb39e12a907765c793
tree5fae149a6ca909fac7bac3e97b14b9ce07c87949
parent3629e1b22e5ba2475fe2531e59c9446c4979e2f9
xe: populate buffers before exporting them.

Before exporting a buffer, make sure it has been populated with
pages at least once.

While discussing cgroups we noticed a problem where you could export
a BO to a dma-buf without having it ever being backed or accounted for.

This meant in low memory situations or eventually with cgroups, a
lower privledged process might cause the compositor to try and allocate
a lot of memory on it's behalf and this could fail. At least make
sure the exporter has managed to allocate the RAM at least once
before exporting the object.

This only applies currently to TTM_PL_SYSTEM objects, because
GTT objects get populated on first validate, and VRAM doesn't
use TT.

Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://lore.kernel.org/r/20250904021643.2050497-4-airlied@gmail.com
drivers/gpu/drm/xe/xe_dma_buf.c