[Devel] [PATCH hci-8.1 v10 00/13] Add per-VE failcount support

Vladimir Riabchun vladimir.riabchun at virtuozzo.com
Fri Sep 25 20:10:43 MSK 2026



On 9/25/26 18:53, Konstantin Khorenko wrote:
> 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 at 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.

Will be added as a part of VSTOR-146839.

>   - 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.
> 

Thanks a lot, Kostya.
Reviewed-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>

> 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 at 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 at virtuozzo.com>
> 

-- 
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo



More information about the Devel mailing list