All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH VZ10 v2 0/4] connector: do not lose exit events for in-CT listeners
@ 2026-08-18 15:10 Vasileios Almpanis
  2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 1/4] connector: annotate ve->cn with __rcu Vasileios Almpanis
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Vasileios Almpanis @ 2026-08-18 15:10 UTC (permalink / raw)


The proc connector reports the exit event after exit_notify(), so the
parent may already have reaped the exiting task. release_task() ->
exit_ve_namespace() then resets tsk->task_ve to ve0, and if that wins
the race the event is delivered to the host listeners only. A listener
inside the container never sees the exit event. LTP catches this as the
flaky cn_pec exit-test failure causing the test to hang for as long as 8
hours on GCOV kernels.

Patch 4 fixes this by pinning the task's VE for the exit notification
before exit_notify(). This means the delivery path can now run against
a VE whose last task is already reaped, i.e. concurrently with the
per-VE connector teardown, which was impossible before. Patches 1-3
prepare for that: annotate ve->cn with __rcu, free the per-VE connector
state only after an RCU grace period, and deliver per-VE events under
rcu_read_lock().

Testing:
KASAN, PROVE_LOCKING/PROVE_RCU, DEBUG_OBJECTS, kmemleak=on; HCI VM with one
container):
 - LTP cn_pec inside a CT: unpatched kernel loses exit events in 3 of
   10 runs (-n 50); patched kernel passes 30 of 30 runs.
 - Teardown stress: 15 cycles of an active in-CT pec_listener plus a
   200-process exit storm with vzctl stop/start while events are in
   flight: no KASAN/lockdep/RCU splats, kmemleak scans report 0
   unreferenced objects.

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

---
Changes in v2:
- Turned the single patch into a series: with the exit event now
  delivered for a possibly already-reaped task, the per-VE delivery
  path can race with the connector teardown in cn_fini_ve(). New
  patches 1-3 make that safe: annotate ve->cn with __rcu, free the
  per-VE connector state only after an RCU grace period, and run the
  delivery under rcu_read_lock().
- cn_proc.h: forward-declare struct ve_struct instead of including
  linux/ve.h.
- Link to v1: https://lists.openvz.org/pipermail/devel/2026-August/084581.html

---
Vasileios Almpanis (4):
      connector: annotate ve->cn with __rcu
      connector: free the per-VE connector state after an RCU grace period
      connector: deliver per-VE proc events under an RCU read lock
      proc connector: pin task VE for the exit event notification

 drivers/connector/cn_proc.c   | 105 ++++++++++++++++++++++++++++++++++--------
 drivers/connector/connector.c |  47 +++++++++++++------
 include/linux/cn_proc.h       |   8 +++-
 include/linux/ve.h            |   2 +-
 kernel/exit.c                 |   5 +-
 5 files changed, 131 insertions(+), 36 deletions(-)
---
base-commit: 209f11f2c454a88761fb8f0a820fa22b6feae720
change-id: 20260813-connectors-3571be4ae57b

-- 
Best regards, Vasileios Almpanis
Software Developer, Virtuozzo.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-25 12:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-18 15:10 [Devel] [PATCH VZ10 v2 0/4] connector: do not lose exit events for in-CT listeners Vasileios Almpanis
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 1/4] connector: annotate ve->cn with __rcu Vasileios Almpanis
2026-08-25 11:58   ` Konstantin Khorenko
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 2/4] connector: free the per-VE connector state after an RCU grace period Vasileios Almpanis
2026-08-25 11:47   ` Konstantin Khorenko
2026-08-25 12:43     ` Vasileios Almpanis
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 3/4] connector: deliver per-VE proc events under an RCU read lock Vasileios Almpanis
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 4/4] proc connector: pin task VE for the exit event notification Vasileios Almpanis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.