From nobody Sat Sep 26 19:13:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1790254746; cv=none; d=zohomail.com; s=zohoarc; b=ScCGKOGgrouEYW8c93u420T4RawdMaJhbfcsEW4fZa/ZvsXE0ikRdFzgF3nSzjaB1OeJZmG3Mgk5GdQZVtHU+fmjbupggs4x/CSUrwLg+8aqqc4YYM4iAwa+SWlSTDb1kNOco+Y97Fhs9HPwzULYr22A4FO9x1PAM1ueAF+TXWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790254746; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eQ2jaUXxCLt695OCVjTC/hWwemBJGhyhOsi1Vj4dN3c=; b=HeyUANZLg8gAXTEKp+A9f4Wf/sX6U2T7r3U7zpGcGCyzLCgRfR5D14CEAQIquXTb+mP/yw1xNKsSXLTfAh06eGmJ9BZL7YxSJ1rXGegpLzWLpe6l0bHpPO/qpOJmheYbuxFla7MKKK60S1nUwDE6GROpVK83DiMyupt1L8y4ZqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790254745995470.6765352421868; Thu, 24 Sep 2026 05:59:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x9j1o-0005dz-DY; Thu, 24 Sep 2026 08:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x9j1e-0005bV-Bj for qemu-devel@nongnu.org; Thu, 24 Sep 2026 08:58:11 -0400 Received: from mail-wr2-x10.google.com ([2a00:1450:4864:30::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x9j1b-00025n-9W for qemu-devel@nongnu.org; Thu, 24 Sep 2026 08:58:10 -0400 Received: by mail-wr2-x10.google.com with SMTP id ffacd0b85a97d-486e1a044c5so1659990f8f.3 for ; Thu, 24 Sep 2026 05:58:06 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:f9ec:9c2f:7d67:4ad8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48868486408sm13260821f8f.9.2026.09.24.05.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 05:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1790254685; x=1790859485; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eQ2jaUXxCLt695OCVjTC/hWwemBJGhyhOsi1Vj4dN3c=; b=lOf9ysU9ctT3PzyN1IqjlWjCZf2eVKxvRYO+kQXVLjvNOVmx9NYSZNE8WjuVgzU/dL zUvLYnqvUQnkZDgBrImiHXoRIWpMxskoTaRTkwhnS6zA9IKq9o/kvWkch3eYA+Xd4Kim m4UIepOKrDkk3bhLw4H2VWbSsda1AnqNXOtcn3mRq1ZX7KXOEE9QQoyKzAw3a95kTUnF xT742bO8Mxl+xA4cRJMbaE0TTJoKcB+V/+ZfUe6L4uKnaR5ljCRm/BeFTrvxbfkS/46K TndDvOofylOv8kxf1+d/Hqgx4w9dFp1ncBHErv0vBuyh79UvI8K6CqC+ejVvuafLKO8D lBgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790254685; x=1790859485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=eQ2jaUXxCLt695OCVjTC/hWwemBJGhyhOsi1Vj4dN3c=; b=SaEZybmx5FDNrfbiOwgOgsA+bhRldAiLpoggprdKoHXU+CWEcx097BAPwQjdxMuwkX rYBjVfQtB0f+r6IxVL92WXvZozXGrPpzJGRuMqSh0KESzE6Z8/HT1Tinj1NvXaZDVj9T yG8uOfjxhimcUFbVh8Ihm5ewWQ9+4KlC5xEKJVqsL6iuTiWO/bSijivr+SKEcGIEOGOH vEZbCMQQPvfyLEUZbO/mEQzC04Cq1s4q/czxqAQItlttDQfMq2rSRG10PoWCp836Fta1 0JI8CaSwz4vCGlpZyDG8cO+3Cczjxlws6Fhl/8ndp+8I2631zaCcCKQl9vgrPW9lrkRH rz8g== X-Gm-Message-State: AFuF++nmgykuig7dv6eWOMHPBkdEiWWcJUYnuqz74gWfm3D1L4/Qg8nT 0IWC6RyFEsh9Agn8I8LyvczLZ14Fhcp6jd5hl2l5Pbu8kM5dUUS2akJqEduUBj2L12ToDxZaAqP Xe+zg X-Gm-Gg: AYBFou3d0WUfKMJ9BlRKzu47ZxNNPz2EAy4ZD//ruiskNW5zvv7jNLA0VwCiZRmFeBz YwP+crbQCSgi5tto+IWU0vSy8WXNkJGQRzl1DTlTjxBYUk8hi6viQ1GJ1wHB9iq3munZ44a1z0R L/NP/iB0M1guMoUt43HAVxDoY0O98r7PvxbxAJrowGRO0TbLyfghrrBL7nN6ivL1edA7+WIqdX/ E6sxCh1ay8VEwR+5y4lg9tbCC38YI3h8sZ2lPHlheCDsOYTuclL/NZ9K7eJLpLQwiQQo7kikeuR 9Dxj2J8G5Fpur8BO68QIhDplY9QevmTlhkBACzHNxcohGvV8E8CZAociOCe2P6ZebdS3HBiPUwu 8ZerMGp1fOluD1LVeMjqzO/v1hNLukwQ1nZKGDj16A/Bkruul+nV0bMIyEYmboAbezLfIw24i3z JHjGmtMRG31b5Q4cVGCOxXPyVlcHwCxKGh0l1ZUof6JafJAucLm4ENAzzRsQQMrPrxamk= X-Received: by 2002:a05:6000:3102:b0:488:64d8:bf24 with SMTP id ffacd0b85a97d-48871725c6bmr4183256f8f.21.1790254685167; Thu, 24 Sep 2026 05:58:05 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: den@openvz.org, Andrey Drobyshev , David Hildenbrand , Igor Mammedov , "Maciej S. Szmigiero" , Peter Xu , Fabiano Rosas , Mark Kanda , Ben Chaney , Steve Sistare , qemu-stable@nongnu.org Subject: [PATCH 1/2] hostmem: fix cpr-exec of VMs with bound guest memory Date: Thu, 24 Sep 2026 14:57:59 +0200 Message-ID: <20260924125800.4188406-2-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260924125800.4188406-1-den@openvz.org> References: <20260924125800.4188406-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:30::10; envelope-from=den@openvz.org; helo=mail-wr2-x10.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @openvz.org) X-ZM-MESSAGEID: 1790254749168158500 Content-Type: text/plain; charset="utf-8" From: Denis V. Lunev cpr-exec kills a VM whose memory backend has host-nodes when the cgroup no longer allows those nodes. The old QEMU saves its state, the new one exits during startup with cannot bind memory to host NUMA nodes: Invalid argument and the guest is lost. Guest RAM survives CPR: its fd is passed to the new QEMU or its backing file is reopened, and the pages stay where they are. For shmem-backed memory the policy set by mbind() lives in the shared object and survives as well. host_memory_backend_memory_complete() treats the memory as fresh anyway: it calls mbind() with MPOL_MF_STRICT | MPOL_MF_MOVE and preallocates again. cpr-exec keeps the PID and the cgroup, so if cpuset.mems has been changed to nodes outside host-nodes since the VM started, mbind() returns EINVAL and QEMU exits. Where it succeeds, it only walks or migrates pages that are already in place, while the guest is stopped. Skip the NUMA binding and preallocation on incoming CPR. The source blocks CPR while any RAM block cannot be preserved, so every backend created in this mode is an inherited one. This covers cpr-transfer too, where the new process may be placed in a cgroup that does not allow the original nodes. For a file backend outside shmem the VMA policy is not restored, which affects only pages first touched after the update. Memory added after the incoming migration completes is back on the normal path. Fixes: 2b7e9739fad8 ("physmem: preserve ram blocks for cpr") Suggested-by: Andrey Drobyshev Signed-off-by: Denis V. Lunev Cc: David Hildenbrand Cc: Igor Mammedov Cc: "Maciej S. Szmigiero" Cc: Peter Xu Cc: Fabiano Rosas Cc: Mark Kanda Cc: Ben Chaney Cc: Steve Sistare Cc: qemu-stable@nongnu.org --- backends/hostmem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backends/hostmem.c b/backends/hostmem.c index 02846b597d..26c7fce1cb 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -24,6 +24,7 @@ #include "qemu/madvise.h" #include "qemu/cutils.h" #include "hw/core/qdev.h" +#include "migration/cpr.h" =20 #ifdef CONFIG_NUMA #include @@ -365,6 +366,10 @@ host_memory_backend_memory_complete(UserCreatable *uc,= Error **errp) if (!backend->dump) { qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP); } + /* Memory inherited over CPR already has its pages and policy */ + if (cpr_is_incoming()) { + return; + } #ifdef CONFIG_NUMA unsigned long lastbit =3D find_last_bit(backend->host_nodes, MAX_NODES= ); /* lastbit =3D=3D MAX_NODES means maxnode =3D 0 */ --=20 2.53.0 From nobody Sat Sep 26 19:13:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1790254746; cv=none; d=zohomail.com; s=zohoarc; b=D5mCZXHfDTbYirXtppnKcWkrmRL+ZkckweGwi1NenXOtOrnf2TIaPeobrkc6ixScjiWLbGp9CEJi0CVrQtt2pfk9gbEJvFFcUv89iVpQQ+WOlGr05qBkTDb51EqncUHsllpj5Pp79/KzFppe7jjrYx0+Fo5na1rbmDYvb67ngbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790254746; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kTl/s+CabqsH7RAws9IcJ4z7WxUGXogCHXB1u6FofjA=; b=NJGWOr5uwHLqxFNnnGZdyi+ED2A7DyU6KI2umnlwu7UzWUcFIFZIHTDuzv8rsfOSRmMsztHZsDUu+ia+Y6A05MdwlfxmwF9ZhBj/dmQNDuNcoKjfD6XCj+k28u3AVSqmtMwgs+QgFiedPno4yrxd6kgogW7gzyp9qiMhQlpWFo4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790254745794510.6353676499376; Thu, 24 Sep 2026 05:59:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x9j1h-0005cZ-Qt; Thu, 24 Sep 2026 08:58:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x9j1e-0005bX-LM for qemu-devel@nongnu.org; Thu, 24 Sep 2026 08:58:11 -0400 Received: from mail-wm2-x11.google.com ([2a00:1450:4864:31::11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x9j1c-00025v-3g for qemu-devel@nongnu.org; Thu, 24 Sep 2026 08:58:10 -0400 Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49e83a388f8so12552565e9.1 for ; Thu, 24 Sep 2026 05:58:07 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:f9ec:9c2f:7d67:4ad8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48868486408sm13260821f8f.9.2026.09.24.05.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 05:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1790254687; x=1790859487; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kTl/s+CabqsH7RAws9IcJ4z7WxUGXogCHXB1u6FofjA=; b=K07wjqfBHVn2cF4HAvQPlpvjPMb65XFYPbNzxclGHfVV4Ok2W+HRspLrnYuexIW3Wz 7baBhbloTHs3+vZXRCh85jbV6DDVRpJk7b7R8XLCC9BzH9FSUNaEOc2cyxF1OhQzsqD8 96CYUe0mruzkhknqrgl8t8oZHH4IKpKQb9j73RSHmz9feTnXCfErs1V4J+M3jtqmOj70 svzzw1XiKmwLefUIla1T7kOnBmTAPAPDjprJ2GK2kKKqDQYnPdjOogg+nkY8ZRPPdWJE 6FhMtnLXJX3Mc5o21LPFXgIP3CfdWgWhgh8gG1e/rGo+kJfwdniTQYf9Ji6mLHngTOPx UkyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790254687; x=1790859487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=kTl/s+CabqsH7RAws9IcJ4z7WxUGXogCHXB1u6FofjA=; b=KEKsCi2WMDMN+7iy5FEvrAdrcdmJtt/XLh1KPbJvXJTlLFn44xV7x2kpwUWB5ielmm CRBdtWK47Kv9mQNr0awfmxdQJusUN1H8Ut4JYps3sMxz6LdWZ1STDernOMtOAz4WjhEz N/Mbkhh9XFtrkbpBkcA9QWHq/Mn0tB1X34Pg05tYvTWCR9r9cfja3Zt4+iPlWcfg63ua J52EAFMamlOjAsOLSwagkajkZBhi8Cy+mjm96I4CUtqO1c+HcbAn7hO8w0sp4k5SMZt8 dv8cAf60x1QVauMgz2N35/Loe4DMGvZ5eIZ/M1MECPJxeejgN/fbRNP/1Xb3/i66WOxN vz3Q== X-Gm-Message-State: AFuF++m7rm98GA1YAErHOYSrLhnSTInteh2wPXoLDqCaihvtCFRYM8+e hJImxRYxP/wvOjiYJiROHkKuElkXqXYiPdnehnlhVoAnwVEA/JdIDuMX2JMeshSZKK3oey1u8DV 7Myuo X-Gm-Gg: AYBFou35hw+XtWI6uzNbktkqiSR8eV1qSivxPWm+Av57ZaccMMG7O0f+FnzHCz0i1oH K8kfePmhpeXaLClugXMd1+h0rIJzIcJyCXxYPw4v4y57xwMAlHR0Ut51p2D9eJHdIEOlwY+kw1J bpXwoJsM1Ura3AHiAbSDZbRE/DBl/vCFp96Hkk4CY6o7S771PVJxNoGV/xwnb9cj9JRUiGoXsKz X3+JyCxMrnjVbTkpBn+XRPXkJ8ZM4LM27jRQgmEQo458FcmYhFEaxhch9xEiYrIg61mvMXDUO9D aNn81/G1vkRFDtFMVnNTVNe1hzcyZLjvMpVGvKpR/M7ucXAOBMuoyyRX1zPB5DtZqPoYIFv4Uze K18J+TqwwaDCbTt2DE/XmHx/8Ylovf7RdKB5TZzDJXLJ9s1n6OzPeKXmD7E9tmxw07epV0MMVN0 KsxiNY/JpC5V8+FHt8d/3GRAOiKB3VFoFcnJeOOtZcBivluev0XbBzYdbokLFknqMiWmI= X-Received: by 2002:a05:600c:1c08:b0:49f:e0f4:1aac with SMTP id 5b1f17b1804b1-49fe66fd431mr46282415e9.25.1790254686603; Thu, 24 Sep 2026 05:58:06 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: den@openvz.org, "Maciej S. Szmigiero" , Peter Xu , Fabiano Rosas , Mark Kanda , Ben Chaney , Steve Sistare , Laurent Vivier , Paolo Bonzini Subject: [PATCH 2/2] tests/qtest/migration: add a cpr-exec test for bound guest memory Date: Thu, 24 Sep 2026 14:58:00 +0200 Message-ID: <20260924125800.4188406-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260924125800.4188406-1-den@openvz.org> References: <20260924125800.4188406-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:31::11; envelope-from=den@openvz.org; helo=mail-wm2-x11.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @openvz.org) X-ZM-MESSAGEID: 1790254747400158500 Content-Type: text/plain; charset="utf-8" From: Denis V. Lunev Add /migration/mode/exec/numa. The source VM has a memory backend bound to host node 0 and the exec'd QEMU asks for host node 127 on the same backend. mbind() rejects that node just as it rejects one the cpuset dropped while the VM ran, so the new QEMU survives only if it leaves the inherited memory alone. This reproduces the failure without root or a cgroup. set_cpr_exec_args() now uses opts_target, unused by cpr-exec tests so far, as the options of the exec'd QEMU. Signed-off-by: Denis V. Lunev Cc: "Maciej S. Szmigiero" Cc: Peter Xu Cc: Fabiano Rosas Cc: Mark Kanda Cc: Ben Chaney Cc: Steve Sistare Cc: Laurent Vivier Cc: Paolo Bonzini --- tests/qtest/migration/cpr-tests.c | 38 ++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 0bec753b4a..9217783659 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -169,6 +169,7 @@ static void set_cpr_exec_args(QTestState *who, MigrateC= ommon *args) g_autofree char *to_args =3D NULL; g_autofree char *exec_args =3D NULL; g_auto(GStrv) argv =3D NULL; + MigrateStart start =3D args->start; char *from_str, *src, *dst; int ret; =20 @@ -179,7 +180,11 @@ static void set_cpr_exec_args(QTestState *who, Migrate= Common *args) */ g_assert(args->start.hide_stderr =3D=3D false); =20 - ret =3D migrate_args(&from_args, &to_args, &args->start); + /* opts_target, if set, replaces opts_source for the exec'd QEMU */ + if (start.opts_target) { + start.opts_source =3D start.opts_target; + } + ret =3D migrate_args(&from_args, &to_args, &start); g_assert(!ret); qtest_from_args =3D qtest_qemu_args(from_args); =20 @@ -276,7 +281,8 @@ static void *test_mode_exec_start(QTestState *from, QTe= stState *to) return NULL; } =20 -static void test_mode_exec(char *name, MigrateCommon *args) +static void test_mode_exec_common(MigrateCommon *args, const char *opts_so= urce, + const char *opts_target) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); @@ -284,12 +290,35 @@ static void test_mode_exec(char *name, MigrateCommon = *args) args->start_hook =3D test_mode_exec_start; =20 args->start.only_source =3D true; - args->start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults"; + args->start.opts_source =3D opts_source; + args->start.opts_target =3D opts_target; args->start.mem_type =3D MEM_TYPE_MEMFD; =20 test_cpr_exec(args); } =20 +static void test_mode_exec(char *name, MigrateCommon *args) +{ + test_mode_exec_common(args, "-machine aux-ram-share=3Don -nodefaults",= NULL); +} + +#ifdef CONFIG_NUMA +/* + * mbind() rejects host node 127 as it would a node the cpuset dropped + * while the VM ran. + */ +static void test_mode_exec_numa(char *name, MigrateCommon *args) +{ + test_mode_exec_common(args, + "-machine aux-ram-share=3Don -nodefaults " + "-object memory-backend-memfd,id=3Dnuma0,size=3D= 2M," + "policy=3Dbind,host-nodes=3D0", + "-machine aux-ram-share=3Don -nodefaults " + "-object memory-backend-memfd,id=3Dnuma0,size=3D= 2M," + "policy=3Dbind,host-nodes=3D127"); +} +#endif + void migration_test_add_cpr(MigrationTestEnv *env) { tmpfs =3D env->tmpfs; @@ -313,5 +342,8 @@ void migration_test_add_cpr(MigrationTestEnv *env) migration_test_add("/migration/mode/transfer/defer", test_mode_transfer_defer); migration_test_add("/migration/mode/exec", test_mode_exec); +#ifdef CONFIG_NUMA + migration_test_add("/migration/mode/exec/numa", test_mode_exec_num= a); +#endif } } --=20 2.53.0