OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	cover.1789491989.git.vladimir.riabchun@virtuozzo.com,
	Konstantin Khorenko <khorenko@virtuozzo.com>,
	devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v10 00/13] Add per-VE failcount support
Date: Fri, 25 Sep 2026 18:53:21 +0200	[thread overview]
Message-ID: <20260925-b4-kh-ve_fail-v10-0-77a6b6ea4205@virtuozzo.com> (raw)

This patchset introduces per-VE failcount support.
We have several resources that have per-VE limits, the users might
want to know what limit hits make operations fail.

- Patch 1 is cosmetic, nothing special.
- Patches 2-4 change mount number and limit processing, unifying it
  with other resources. VE selftest is updated in patch 3.
- Patch 5 removes copy-pasted resource accessors by generating them
  with macros.
- Patch 6 is a split-out fix: ve0 was left without aio defaults when
  aio_nr/aio_max_nr moved into ve_struct.
- Patch 7 adds the ve.failcount file and the helpers.
- Patches 8-12 add one failcounter each: netns, mnt, netif,
  bpf_prog, aio.
- Patch 13 introduces new VE selftest that checks mounts accounting,
  limits and failcount updates.

NOTE: for running the new selftest this series should be applied on
top of "[PATCH VZ10 v3 0/3] Improvements for ve selftests".

https://virtuozzo.atlassian.net/browse/VSTOR-135520

v9: <cover.1789491989.git.vladimir.riabchun@virtuozzo.com>

Changes since v9 (respin by khorenko@):
 - Dropped v9 patch 7 "ve/printk: Don't use ve log outside task
   context": get_exec_env() being unreliable in interrupt context is
   a pre-existing problem, it will be fixed properly in a separate
   series under VSTOR-146839.
 - Dropped the neigh_tbl failcounter: neigh_alloc() can run in
   softirq, and ve_failcount_inc() writes to the ve log, which must
   not be used outside task context. Without the dropped printk
   patch this would leak messages to an unrelated CT dmesg. The
   counter will be added together with the ve_printk fix.
 - Split "ve: Introduce per-VE failcount" into a patch adding the
   infrastructure and one patch per counter, so each counter can be
   reviewed and reverted on its own.
 - Made the ve0 aio initialization a separate fix with a Fixes tag:
   the host has been running with aio_max_nr == 0 since
   aio_nr/aio_max_nr became per-VE, so io_setup() on the host fails
   until fs.aio-max-nr is raised by hand.
 - Patch 1 no longer moves the umh_running_helpers/umh_helpers_waitq
   ve0 initializers under #ifdef CONFIG_X86: the fields and their
   users are arch-independent, and a whitespace patch must not
   change the generated code.
 - Dropped the old mount limit warning in alloc_vfsmnt(), otherwise
   every failed mount would be reported twice; the message printed
   by ve_failcount_inc() also names the counter to look at.
 - Fixed wait_on_mnt_avail() in the selftest: the delay was kept in
   tv_nsec, and nanosleep() rejects values of 1s and above with
   EINVAL, so the wait gave up early with a misleading error instead
   of using the whole timeout. The delay is now normalized into
   tv_sec/tv_nsec.
 - Moved ve_failcount_inc() in ioctx_alloc() out of aio_nr_lock:
   the counter is an atomic and does not need the lock, no point in
   printing to two log buffers under it.
 - Reworded several subjects and commit messages.

Changes since v8:
 - Added new patch 7 to fix logs leakage from interrupts.
   We are fine if we miss some failure logs in container
   dmesg - CT can check failcounts anyway, and bringing
   new ratelimited printks with specified VE is too hard
   for such a small thing.
 - Selftest in patch 8 got major rework:
   1. Correct mmap error handling.
   2. Dropped mnt_cost value. Let's force 1, it is expected
      value in fresh mount+VE namespaces.
   3. Proper solution for pending mount destructions. It used
      to be just sleep(1) which may not be enoght on loaded
      machines. Instead, issue rcu_barrier and wait on mnt_avail_nr.
      Since we forced mnt_cost == 1, it know precisely what the
      new value should be.

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>

---
Vladimir Riabchun (13):
      ve/ve.{h, c}: farewell to spaces as indents
      ve/fs: count available mounts instead of used ones
      selftests/ve: update ve_ns_owner_test
      ve: make mount limit configurable per VE
      ve/ve.c: generate VE resource accessors using macros
      ve/aio: initialize aio fields in ve0
      ve: introduce per-VE failcounter infrastructure
      ve: add netns failcounter
      ve: add mnt failcounter
      ve: add netif failcounter
      ve: add bpf_prog failcounter
      ve: add aio failcounter
      selftests/ve: add mount accounting selftest

 fs/aio.c                                           |   1 +
 fs/namespace.c                                     |  82 +--
 include/linux/ve.h                                 |  34 +-
 kernel/bpf/syscall.c                               |   1 +
 kernel/ve/ve.c                                     | 274 +++++-----
 kernel/ve/veowner.c                                |  19 -
 net/core/dev.c                                     |  10 +-
 net/core/net_namespace.c                           |   4 +-
 tools/testing/selftests/ve/.gitignore              |   1 +
 tools/testing/selftests/ve/Makefile                |   1 +
 .../selftests/ve/ve_mount_accounting_test.c        | 554 +++++++++++++++++++++
 tools/testing/selftests/ve/ve_ns_owner_test.c      |  37 +-
 tools/testing/selftests/ve/ve_selftest.h           |  21 +
 13 files changed, 816 insertions(+), 223 deletions(-)
---
base-commit: 03a6f36081f7055a2e41f9b79306a3ab0103d883
change-id: 20260925-b4-kh-ve_fail-6271523cb384

Best regards,
--  
Konstantin Khorenko <khorenko@virtuozzo.com>

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

             reply	other threads:[~2026-09-25 16:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 16:53 Konstantin Khorenko [this message]
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 01/13] ve/ve.{h, c}: farewell to spaces as indents Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 02/13] ve/fs: count available mounts instead of used ones Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 03/13] selftests/ve: update ve_ns_owner_test Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 04/13] ve: make mount limit configurable per VE Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 05/13] ve/ve.c: generate VE resource accessors using macros Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 06/13] ve/aio: initialize aio fields in ve0 Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 07/13] ve: introduce per-VE failcounter infrastructure Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 08/13] ve: add netns failcounter Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 09/13] ve: add mnt failcounter Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 10/13] ve: add netif failcounter Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 11/13] ve: add bpf_prog failcounter Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 12/13] ve: add aio failcounter Konstantin Khorenko
2026-09-25 16:53 ` [Devel] [PATCH hci-8.1 v10 13/13] selftests/ve: add mount accounting selftest Konstantin Khorenko
2026-09-25 17:10 ` [Devel] [PATCH hci-8.1 v10 00/13] Add per-VE failcount support Vladimir Riabchun
2026-09-25 17:33 ` Konstantin Khorenko

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=20260925-b4-kh-ve_fail-v10-0-77a6b6ea4205@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=cover.1789491989.git.vladimir.riabchun@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=vasileios.almpanis@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