We lost several production VMs during an in-place QEMU update. Each had
its guest memory bound to a host node with host-nodes. The new QEMU
re-ran mbind() on the inherited RAM, got EINVAL and exited, taking the
guest with it. The likely trigger is the host's memory manager moving
the emulator cgroup's cpuset.mems to other nodes while the VMs ran;
doing exactly that reproduces the failure.
Patch 1 stops the new QEMU from rebinding and preallocating memory it
inherited over CPR. Patch 2 adds a qtest that reproduces the failure
without root: the exec'd QEMU asks for a host node mbind() rejects,
which is what a narrowed cpuset looks like to it.
Tested with migration-test on x86_64: mode/exec/numa fails without
patch 1 and passes with it, the rest of the suite passes. A standalone
reproducer that moves a real cgroup v2 cpuset.mems between nodes while
the VM runs shows the same before and after on a four-node host.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>
Cc: Mark Kanda <mark.kanda@oracle.com>
Cc: Ben Chaney <bchaney@akamai.com>
Cc: Steve Sistare <steven.sistare@oracle.com>
Cc: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Denis V. Lunev (2):
hostmem: fix cpr-exec of VMs with bound guest memory
tests/qtest/migration: add a cpr-exec test for bound guest memory
backends/hostmem.c | 5 ++++
tests/qtest/migration/cpr-tests.c | 38 ++++++++++++++++++++++++++++---
2 files changed, 40 insertions(+), 3 deletions(-)
base-commit: 942229961efea74b153c44c59188eb08375f10f1
--
2.53.0