Reviewed-by: Pavel Tikhomirov <[email protected]> First 5 are clean cherry-pick, 6 has reasonable rework as reclaim logic is excess in our kernel. All fixes are from stable and look needed for proper dmem.max functioning.
On 11/2/26 00:51, Mirian Shilakadze wrote: > Per-container GPU memory limits (VSTOR-135023) enable the dmem cgroup > controller for Containers. Our dmem.c is upstream as of 8821f36333e2 > (6.14) and lacks four upstream fixes tagged for stable. The first one > matters most: with dmem enabled for Containers, root in a Container can > write a region name without a value to dmem.max of its own child > cgroup, which dereferences NULL and, with CONFIG_PANIC_ON_OOPS=y, > panics the node. > > Patch 6 is an adapted 747c4bb450ad: a dmem.max below the current usage > takes effect at once, as upstream, instead of being dropped while the > write reports success. Its reclaim callback is left out, see the rebase > note. For the NVIDIA driver this is the same as upstream. For amdgpu > and xe a lower limit evicts at their next allocation instead of at the > write. Patch 5 is the stable TTM fix that lets that eviction go on past > the first buffer, upstream has it before 747c4bb450ad. > > Tested on bg-sdc2-e18-04 (H200, NVIDIA 615.71.10 open modules) with the > koji 211.52.1.22.14 SRPM plus this series, normal and debug kernels: > - a region without a value in dmem.max returns -EINVAL, from the host > and from Container root > - a lower dmem.max takes effect at once: while usage is above it a new > CUDA context fails, after release allocations stop at the new limit. > The stock kernel keeps the old limit and lets both through. > - NVIDIA driver unload with lockdep active no longer warns about RCU in > dmem_cgroup_unregister_region(), as the stock debug kernel did, and > reload cycles give no KASAN reports > - a failed pool preallocation (failslab, debug kernel) makes the write > return -ENOMEM > Patch 5 and the amdgpu and xe paths are build-tested only, the host has > no such GPU. > > https://virtuozzo.atlassian.net/browse/VSTOR-152813 > > Chen Ridong (3): > ms/cgroup/dmem: fix NULL pointer dereference when setting max > ms/cgroup/dmem: avoid rcu warning when unregister region > ms/cgroup/dmem: avoid pool UAF > > Guopeng Zhang (1): > ms/cgroup/dmem: Return -ENOMEM on failed pool preallocation > > Thomas Hellström (2): > ms/drm/ttm: Convert -EAGAIN from dmem_cgroup_try_charge to -ENOSPC > ms/cgroup/dmem: Add reclaim callback for lowering max below current > usage > > drivers/gpu/drm/ttm/ttm_bo.c | 2 +- > drivers/gpu/drm/ttm/ttm_resource.c | 5 +- > kernel/cgroup/dmem.c | 76 ++++++++++++++++++++++++++---- > 3 files changed, 73 insertions(+), 10 deletions(-) > -- Best regards, Pavel Tikhomirov Senior Software Developer, Virtuozzo. _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
