OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 0/6] cgroup/dmem: backport fixes and apply a lower dmem.max at once
Date: Mon,  2 Nov 2026 03:51:42 +0400	[thread overview]
Message-ID: <20261101235155.124059-1-mirian.shilakadze@virtuozzo.com> (raw)

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(-)

-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

             reply	other threads:[~2026-11-01 23:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 23:51 Mirian Shilakadze [this message]
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 1/6] ms/cgroup/dmem: fix NULL pointer dereference when setting max Mirian Shilakadze
2026-11-01 23:54   ` no-reply
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 2/6] ms/cgroup/dmem: avoid rcu warning when unregister region Mirian Shilakadze
2026-11-01 23:55   ` no-reply
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 3/6] ms/cgroup/dmem: avoid pool UAF Mirian Shilakadze
2026-11-01 23:56   ` no-reply
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 4/6] ms/cgroup/dmem: Return -ENOMEM on failed pool preallocation Mirian Shilakadze
2026-11-01 23:55   ` no-reply
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 5/6] ms/drm/ttm: Convert -EAGAIN from dmem_cgroup_try_charge to -ENOSPC Mirian Shilakadze
2026-11-01 23:56   ` no-reply
2026-11-01 23:51 ` [Devel] [PATCH hci-8.1 6/6] ms/cgroup/dmem: Add reclaim callback for lowering max below current usage Mirian Shilakadze
2026-11-01 23:57   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261101235155.124059-1-mirian.shilakadze@virtuozzo.com \
    --to=mirian.shilakadze@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox