From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763786443; cv=none; d=zohomail.com; s=zohoarc; b=b1sDqwp1dJc7j21S0SwBInY33Mb8Iayw3NVdMMnhgt1fYS50fXXwhYdteicLB/nszqob2St/NUpC7kvgK1LpGdPX8B8mlNEfI567iNza/zu4vy7f4kC0n3/pgdYpWyd7GUhi2FxSJYv9jm3eookBX13nD/nQl1GOQX6A4aQz3Wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763786443; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zMyNYRaZIbZKePdD41f98ajmZ0H3U11uYcSXUx13bYo=; b=VYfGSC2wKLtAi5TqGqF1Dy87a7iuc07TVd3PGOM7VgqRBfbPy1+lc6Ri6tE8cyX8y02bdzh+CQItSkq2qwijL+ywePhs5pE1jKCMEdlBcMrD8VFGNb3epHDYuUH4B4SmumR8/Cmgxf0C1+OOuJL2dYHf95zSqtkLubgf+J+jCb4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763786443579693.0723956949228; Fri, 21 Nov 2025 20:40:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcm1-0002Y8-8U; Fri, 21 Nov 2025 20:50:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTL-0006Yd-FR for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTB-0003dG-5M for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:25 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-OQgdZ32lMySUMV4vliOu0w-1; Fri, 21 Nov 2025 19:27:01 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4ed74e6c468so35395191cf.3 for ; Fri, 21 Nov 2025 16:27:01 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zMyNYRaZIbZKePdD41f98ajmZ0H3U11uYcSXUx13bYo=; b=fhY9UOersFqun0PKPj5+KKZqsM0fg4tZuQHx1vOgr8gjRE9bvfQDyN9E9O91arAeOQD8yU Zdyxjb0VCogQ9mv/uTMkpLy+4Cu3nlqSa3fF9ogFzEy5/olgJfxFmOkDArUDPff6n+Ww0Z ObfFS+stwbZwe25cuW9ZjXdcxTA/nBQ= X-MC-Unique: OQgdZ32lMySUMV4vliOu0w-1 X-Mimecast-MFC-AGG-ID: OQgdZ32lMySUMV4vliOu0w_1763771221 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771220; x=1764376020; 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; bh=zMyNYRaZIbZKePdD41f98ajmZ0H3U11uYcSXUx13bYo=; b=tDRwzz6iQoS78VOopH+N/yuaaKeKO/i1xJzu5eHm/wcfWoKNtowRhn0QW7QgsT5ZlP vNM9COhAiGwHJnljPj5AGka7lLWbV8XHNasUUkLD9J1umwHc3hRUsg40i+k9PdpL1y4x GMBIbteMZFlq5813h7vCdEEz6MOfBCcjSxYUNsjpZHIaGWPvMwAgDmMRjG0aMavv6mix 8L4X0zpYK7GtEZNURnr1kjE+VtlZk50/U3iEsoRMLJ4OXRs79rNnYh+MZWvATpzX2AiS GBiuMxQhb9Xjcu7KxsLvNz5ePBNQcWmyp+OSOlplQ6flkhS7nAVOhklbf7uLKc4UfM10 Okkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771220; x=1764376020; 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; bh=zMyNYRaZIbZKePdD41f98ajmZ0H3U11uYcSXUx13bYo=; b=siaFctH8mjAKZpClbCn2v9lOR4YHms8FARSUHXVDh/Ojugy6nKeoBc/IAh5WeHRflP cusATgH+qcV4yJ0Igyh14YQPjQoJzCTHl2BqzgRfQV1FX4X8Eu/7JYUQeB1w6nptlG+c v9S+qqCKeoBZ7u0bOICT4jYSS8DUKmrMlUfYGRn9CV+h8/ynTOX8nLgLgQkRyjUiG1I5 nCIKy7zduMJTA8jd3ord5oGAHxvnOkPxxbnJLGjPOC9jdPYWqsxJlWXeZRSuDGEi0NRL 9MbW3Zv7ECLGXhzWjOxt6syNl8UKCGYMgkSf1VCDBJhTaIOd41HLLlDyvewgP0bWVrsb QZXg== X-Gm-Message-State: AOJu0YwNhkTaVwieNkFNmvOuvTKnktfyxmyBh5WSeE00c85ysBu3zZsx 84d7BsbyCMglO37k1XNQKZ9wTsbwztsYd+ENLvQfrx55o1wV4MkLREcPHtArs4/CUscCVD4YMFz qX5J5Cu2MBH0Su+CGwLUl3/deNjC+Qxb5bmEigGBbgSn5zicA4Lxq96g1oBr1lHn9sDDEDlLzuq /Du57QCNUnMt6mwq98ACEC3Mt3bmZcvr4rFyUH/A== X-Gm-Gg: ASbGnctUUlVRbtzWiMshZ87ByNHQ7OE30AceFKpozrRXOO4B/l/FVaJS9dMYrMf9nIv gIO96ScIwi/qNoVEKA/6D7ILZhBVkXiPB+C88eNgYS6hYxbclwzCbCfhQdPcGU8qqKbABuNtOKn MFD5RO+Dlrkawsaa54+ZlhrAOlizlJaSJxQsRkQtknQwS6ekfPpHdxkp9d5IwpVPdT0uwAG6WzP adjVdwv7VTEndRTN17Wkek/u8LjU80evUINyzrGwTAGffK+mxLYnOMRvcvQ8RyVLyS0irJy73/n fgG/H9sQ5DVqrZRIFnSIEXcoYcSWem5EYSIE7z5hymfLf/fEWOtFKC736S2pjuB+HK7FzyJ6d8w X X-Received: by 2002:ac8:5e0e:0:b0:4e5:6c5e:430a with SMTP id d75a77b69052e-4ee58932460mr55183961cf.64.1763771220314; Fri, 21 Nov 2025 16:27:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsAxxZ6lPhW7AKm6qQs9J/qNuICvvvyNfe+7ht35UB0QBm1LpAz08XIdOoie8r+fxf87hX9w== X-Received: by 2002:ac8:5e0e:0:b0:4e5:6c5e:430a with SMTP id d75a77b69052e-4ee58932460mr55183611cf.64.1763771219702; Fri, 21 Nov 2025 16:26:59 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Li Zhijian , qemu-stable , Zhang Chen Subject: [PULL 1/9] migration: Fix transition to COLO state from precopy Date: Fri, 21 Nov 2025 19:26:47 -0500 Message-ID: <20251122002656.687350-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763786445902018900 Content-Type: text/plain; charset="utf-8" From: Li Zhijian Commit 4881411136 ("migration: Always set DEVICE state") set a new DEVICE state before completed during migration, which broke the original transition to COLO. The migration flow for precopy has changed to: active -> pre-switchover -> device -> completed. This patch updates the transition state to ensure that the Pre-COLO state corresponds to DEVICE state correctly. Cc: qemu-stable Fixes: 4881411136 ("migration: Always set DEVICE state") Signed-off-by: Li Zhijian Reviewed-by: Zhang Chen Tested-by: Zhang Chen Link: https://lore.kernel.org/r/20251104013606.1937764-1-lizhijian@fujitsu.= com Signed-off-by: Peter Xu --- migration/migration.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c2daab6bdd..1b2c02d7fa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3081,9 +3081,9 @@ static void migration_completion(MigrationState *s) goto fail; } =20 - if (migrate_colo() && s->state =3D=3D MIGRATION_STATUS_ACTIVE) { + if (migrate_colo() && s->state =3D=3D MIGRATION_STATUS_DEVICE) { /* COLO does not support postcopy */ - migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, + migrate_set_state(&s->state, MIGRATION_STATUS_DEVICE, MIGRATION_STATUS_COLO); } else { migration_completion_end(s); --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763784257; cv=none; d=zohomail.com; s=zohoarc; b=debb1Kw74YKaHeHP0oRKc/iBsKfV7TRs/SpkqWHhiSb8PnknSVxo8X1TRqbotx8wu+lUFaIZSQgnvMrVUMrJwzAREhQBlBsjld9RG8VObSB9F/PD2jyAq33mlB0d6IaclCis1Zl/5wYRHxXdpiPAkoiLEdCbNEWSrNnHxblX8ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763784257; h=Content-Type: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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QQqUtJS6s4eQNmQ6rnbU7MPx5N969oxd9HmJpVpakkI=; b=lTSrr4B5fXhuU/fAHTuE6x//14yGKM9POs6Sd8+GuTj5wYpGQiVNPR1eGTk6NsAyE1tcSwEWp/jwp25x5/e3NQzJgjKE4ayZ2jL/Bw02fIlB9PpzQaQg+uRodyrP2EVzaqbE4DG3q4ldYKuiT0otxEjMZCy5gmKkt+/upgH4Ep8= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763784257581834.1421647862221; Fri, 21 Nov 2025 20:04:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcjZ-0000US-Ox; Fri, 21 Nov 2025 20:48:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTQ-0006c9-CF for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTG-0003du-1Q for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:30 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-Hvuxbo81OHa3Jn8-xd5Ncw-1; Fri, 21 Nov 2025 19:27:02 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4ee41b07099so28309491cf.2 for ; Fri, 21 Nov 2025 16:27:02 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QQqUtJS6s4eQNmQ6rnbU7MPx5N969oxd9HmJpVpakkI=; b=NnUT6wxlxAzw2Tu7lmNrxna3SaeI9QI/dKQwYZEBx/tmZ0n0XC8S8jG25uz7HumuQbj/d2 pq//d2wgWR65JhW+VhAQw/GWXpV92koIFGOFKp6wwzUSvvnKxuNvXhBGryol0GR8xJKcck tkECyJ/blHsPQSf3BRUuy0ezO2THaPU= X-MC-Unique: Hvuxbo81OHa3Jn8-xd5Ncw-1 X-Mimecast-MFC-AGG-ID: Hvuxbo81OHa3Jn8-xd5Ncw_1763771222 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771222; x=1764376022; 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; bh=QQqUtJS6s4eQNmQ6rnbU7MPx5N969oxd9HmJpVpakkI=; b=MzSTRVhXPpk+0e1eKNuZVi+M/hk5kt9hMCB90TF3cVHOGGY5kMDd1cOPqOK4Uuwl4/ HGvH5+zBg4mRqArfPj0hxSEqF/AZ6cQE7bTjMzPJlbteRG2MgipHCQa/jl1VFBSGn9nj 5YRxTCGbdNOWs9pT3CVp1uvRDaia2vbSF7C6BBlxJh9lRnR/Ph+x87x2EwtcZhzq6rc+ z0XQyXMRnpsqPmkJ2FzkPHH6X+lI+5WKEmDkeQM1FZ+tyzd+WMAlyJv9D8hBrSlLP/93 DFd16947NHoea+8kTP2yYrYF3mJd3loICfMVR9yyI2vjcEh45s8bcSvSbcCI5lyI03un dm2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771222; x=1764376022; 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; bh=QQqUtJS6s4eQNmQ6rnbU7MPx5N969oxd9HmJpVpakkI=; b=mhhs1KsYNK+1F9KOEMz5Gwbg6D8/s9PXgd+dxNx/y69TqMBip+4cC2YIsENnRKr5IS Tb1/HUffyXDr4wJpXNHBGVgTueLEJqCzdRmV0Sb67ZJzt6n14BxpPU2yZhWSPQY8SQxU tkheWelntaPjlLdczKvAPaaWURR8NFVBmkOa2lNMNJNpkfSlrCRsAbyOZz0bUflZ+FFQ dGd6TIyeF3+9IRcH+dp++EIJrCjK7UFHUk/UxWbJkvYBZKNcvgt4rS14EGR6B9GYCZFi WvuxHxVKinOcuP93atpqZNDFYOXvXJilEZyFf2sUwIz1u+Gdv9RvSFPhuZWbcWmyezJ3 rhhg== X-Gm-Message-State: AOJu0YyIa6mGWfiEHgaJqWG0GKTWWFkxiMBH2zt3kIKTHI/1mfeh7BRB GLH+laeIkFGv1d+TfAg/L3JDwJcu8caJBvTG6YVTbDtVt/Sq6+EspMRW/xJNWmm+Y161Onc5Npy ONYN8lefU0eppczeOaoc+zT42OM3zPVhghB/6slIMXfL93K1TaukSrnbpzFpDPLUUVh0nLBTX9J DS/cUcvLYgIQYjnvRuV3cDO4zCgmN+/lZG9pwx9Q== X-Gm-Gg: ASbGncssI9dPgmltj9ttFtN0uvxwVMt0VMoZu2etP72gqDBzpGkTjvdoy3ZlS6EbdW8 1Ypqq6lb5nI0WTn0DWW3oocnk+yzKJe3iLqEVDHnfAE17+gbcxagTrMEiRh6PSzFrdlmQLY0jbQ Eo/3SbTwRxzKockd9oarbfznU/yZBcSiKtIEAK2UI9sKEJ70glr6VJDni7sJ1hxCXy0OI062B4J fzJo54qIy0bcDbIkxLsqLgAozvV2YwOA+4Q3A20Pjnuj/5Ls4igH39syR/4qwCXMlDbKul4gQHF oKJK1qYaKczam2rAwLiO6m9B2ZpDVqeMdCpD3IoyNYT9oK3g+8iXHZ719UGbN1/QF6h/a5psM0h D X-Received: by 2002:ac8:5e0e:0:b0:4ed:b47d:8f68 with SMTP id d75a77b69052e-4ee58841a89mr50437661cf.15.1763771221821; Fri, 21 Nov 2025 16:27:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/UemtddXhN4vBrN899zt+bLX9Lwt5VAvY8p62EQ+z4AMiHCqhLYebivk3p5tj+9iLXOOezQ== X-Received: by 2002:ac8:5e0e:0:b0:4ed:b47d:8f68 with SMTP id d75a77b69052e-4ee58841a89mr50437381cf.15.1763771221302; Fri, 21 Nov 2025 16:27:01 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Matthew Rosato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 2/9] migration: set correct list pointer when removing notifier Date: Fri, 21 Nov 2025 19:26:48 -0500 Message-ID: <20251122002656.687350-3-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763784259978018900 From: Matthew Rosato In migration_remove_notifier(), g_slist_remove() will search for and potentially remove an entry from the specified list. The return value should be used to update the potentially-changed head pointer of the list that was just searched (migration_state_notifiers[mode]) instead of the migration blockers list. Fixes: dc79c7d5e1 ("migration: multi-mode notifier") Signed-off-by: Matthew Rosato Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/r/20251113213545.513453-1-mjrosato@linux.ibm.= com Signed-off-by: Peter Xu --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 1b2c02d7fa..b316ee01ab 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1693,7 +1693,7 @@ void migration_remove_notifier(NotifierWithReturn *no= tify) { if (notify->notify) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { - migration_blockers[mode] =3D + migration_state_notifiers[mode] =3D g_slist_remove(migration_state_notifiers[mode], notify); } notify->notify =3D NULL; --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763782808; cv=none; d=zohomail.com; s=zohoarc; b=DCPR9JtsdIU1OP5FjdO7KslxZT+QAip43YpKDcpWEQDXvSqE7Ycuo9CPn4XVfH1e+hVG39hR1dl8d781/klpTgNv+W6+E0NejRv/c+PzAIi1yVjzZtJkRJLGi2qUcf8rSh0GMKWjYbxr4RXPFwwL7YG8NpcbKGlv2iohvnSxjwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763782808; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SudVAchgZ3enzSuaz6qNw29hKeE4PlULQA5kP/QnNrU=; b=BWbjWv5Pko4l6ulIyjb2e6aBYMvU3hYgIsDJyFOz2YnhpWpR4iJo/8c9Sc+t1tFnoCkb9s+sqDlzKb9fkvNIliYMyOSAq0vR6AfsHR68Ws/Omm27thbKPLrT3+HQim76F7ntb4wsbrjYmVCmPjcqSDWCgd0X7xFpIx3m/vbCJW8= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763782808491142.9795578270348; Fri, 21 Nov 2025 19:40:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcnB-0003Qp-Hq; Fri, 21 Nov 2025 20:52:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbVG-0007e6-UT for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:29:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTF-0003e0-FK for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:29:24 -0500 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-2f0ZQ3S1MR2VXIWDzXtGWA-1; Fri, 21 Nov 2025 19:27:03 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b17194d321so339938785a.0 for ; Fri, 21 Nov 2025 16:27:03 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SudVAchgZ3enzSuaz6qNw29hKeE4PlULQA5kP/QnNrU=; b=X1ElYhYOvCn5SKs4D0d6xa2tFYt7n8kb1UJ18NQEl/UlfSSWMx8lujXZvtjij4gJ8MDvUK 9FUeRXhfPDI7LPWUuhk9otleR82VJclnddU7pSDG7j3iUBVQ2Nck3okE9HuLv+UBaLtMIZ e341PONIumJoqDpwoACSVaH936sWcW8= X-MC-Unique: 2f0ZQ3S1MR2VXIWDzXtGWA-1 X-Mimecast-MFC-AGG-ID: 2f0ZQ3S1MR2VXIWDzXtGWA_1763771223 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771223; x=1764376023; 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; bh=SudVAchgZ3enzSuaz6qNw29hKeE4PlULQA5kP/QnNrU=; b=s8xU2/PxCB7tRO/2/HFnacGRqCYfXNaUChQWlhLhmDQXEAbLpq7xrW8w1B3HEf+WPx iTaPwW1uTACJQ/6R8O/LMpVUgCVGlf8Bq8oDDZX/DrJoy0AW/W+ZlB/GNufy1XVDLR2I pEIc2JOq2oQphWFfPb4wvxxVaN6xLzhKPXutk6ED6k3xING/6ey8WBzK2LvkRfi5JjeK 9ZZxyg6K6oTDMRUeIqXUHp+DTbb8dNHgXv6qU2uQPVFDEvpgkPQydexPxshdeHpZ8O57 WNBNGaEt62ccJ2oxQmVCadvdGbhyMkD3wqnfvubVnTTS+QDCCPDgkL43ok4ywTqlp3qW RmkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771223; x=1764376023; 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; bh=SudVAchgZ3enzSuaz6qNw29hKeE4PlULQA5kP/QnNrU=; b=EpwBP0UOaS4+UfDYtdGNojNgGWUkHnwS0gskgy8Jne0gPAGK30T7NGi2KR4vOHOSZp KhgOsqJ5aUCF4uagvbpfZ3FQmnZW3j+4LpTsq/7ZZnlJWkcz1EOmQuqV8ZIHi83qKM0q jLIwW3RMMOs9vRZw457SNOY9GP6nMopxZ3hX8jXPZmFrbctI9elthWjsglRAW3qtHZsW b6bVrUZUnPnHEODKDMm9zqzV5G4GQWiMGqkgXkUDqT8DctqwAbltx58PuIKceQfBOolX wgLDSDYnv+YlI/tCxnsgJ0vgS3S+oWjjtW/mEl9pzTVSkh0ku3DEX3bC427KaDN1yxXY ro0g== X-Gm-Message-State: AOJu0Yz1WdizQ21iBL4s+apOz1dGZ5GaNnNDs8Zhz6Dq7oz4S4xNiep9 MpztJKFM4YtthhoKrQ+B3qDi2kPu/AxB1siEPLHbSNQLwiOq1lfBPxquNPBoyJ8zj9Ss5/8bNtX 9bmdPYSr8CGW4ooOyZ0/pyMxQPo4XivTaKFhrkQwNJJs+jlzdUMsizYFBtBDnNdpaamVqTrdnqX sB7e0Lf6EnNpVxePnDizW39dmYeXId0tP6vJuPmw== X-Gm-Gg: ASbGncuaXVJpisbslqv+atHYrYn1ckngpgQ0xKk8hh8mm271GvxxLYMJuEyP9tqqb3G xWoHZxj8Uf1EHh8y7fWY7fYwQ1dNUwpquoch+HxsJVR0+6bWgHh2D63f8Z0OOzsNi/AJGMlBKZJ xInrwUeDZgjsiML9S03nWe5BEQPKB8a1IkxECvEcU9s6U7C4sAdYVmLX4pmEtZjNDD7g0AFjemh g0bSMi6GbFt24ybKLSvcIWAx7pZ7dw1wzP27FPziu0WhOJPc8U3lkvH2eSjIdxDhr30bT/wTyyV mY3DLII3h6B4m1daxJfF8wY7BXjesoSnq6WpIWLpEgaFuJpBI9ZvnRbEU0KUk+wSWPtAK12MGkb z X-Received: by 2002:a05:622a:d5:b0:4ee:15e7:d9c6 with SMTP id d75a77b69052e-4ee58911324mr70422021cf.53.1763771222802; Fri, 21 Nov 2025 16:27:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCfUP1AUWM8ZWKgbzEJLUfgTloUcvu2D55Fx3WDliRSBqUEbRl6tFl7L0k4IdntCouJSxeug== X-Received: by 2002:a05:622a:d5:b0:4ee:15e7:d9c6 with SMTP id d75a77b69052e-4ee58911324mr70421701cf.53.1763771222215; Fri, 21 Nov 2025 16:27:02 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Markus Armbruster Subject: [PULL 3/9] migration: Plug memory leaks after migrate_set_error() Date: Fri, 21 Nov 2025 19:26:49 -0500 Message-ID: <20251122002656.687350-4-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763782809687018900 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster migrate_set_error(s, err) stores a copy of @err in @s. The original @err is not freed. Most callers free it immediately. Some callers free it later, or pass it on. And some leak it. Fix those. Perhaps migrate_set_error(s, err) should take ownership of @err. The callers that free it immediately would become simpler, and avoid a copy and a deallocation. The others would have to pass error_copy(err). Signed-off-by: Markus Armbruster Link: https://lore.kernel.org/r/20251115083500.2753895-2-armbru@redhat.com Signed-off-by: Peter Xu --- migration/cpr-exec.c | 3 ++- migration/multifd.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index d284f6e734..0b8344a86f 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -159,11 +159,12 @@ static void cpr_exec_cb(void *opaque) error_report_err(error_copy(err)); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); migrate_set_error(s, err); + error_free(err); + err =3D NULL; =20 /* Note, we can go from state COMPLETED to FAILED */ migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL); =20 - err =3D NULL; if (!migration_block_activate(&err)) { /* error was already reported */ error_free(err); diff --git a/migration/multifd.c b/migration/multifd.c index 98873cee74..a529c399e4 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -964,6 +964,7 @@ bool multifd_send_setup(void) =20 if (!multifd_new_send_channel_create(p, &local_err)) { migrate_set_error(s, local_err); + error_free(local_err); ret =3D -1; } } @@ -988,6 +989,7 @@ bool multifd_send_setup(void) ret =3D multifd_send_state->ops->send_setup(p, &local_err); if (ret) { migrate_set_error(s, local_err); + error_free(local_err); goto err; } assert(p->iov); --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763776973; cv=none; d=zohomail.com; s=zohoarc; b=T0WFK+Y7G6CezsERmPtw44VY5HsD+26niQb4S/ydne2qEAW5vuYM5/YWuPft4fcXOL55VWmNDx7A8FACZ1X9eotcSHUzt6hEQB9PGzcmCEZfhuPBYdFO3wy/5YQi1yLkwqFEOO/700PFkwQxcHLMjvuE77JlB2LgVXVEiC9YUqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763776973; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zP1UWP2hrKh6gHFJKbP+xwMm3Oogaln/YNFdJGManXk=; b=hFtKPongmCm4j9wILf17tuC63XG538Ogmw4H6/P5Qq7Vczwidp/9g1LspZXeeR8S6WeqsVm7UCU0Lrdi51OFDpG9g3CGqempFqWECnfp7N+LKovZ7KRaOmYb3s12lLq87ISnafRV6Wl82B6kNp52sQCNxxicBCGEvO6FGXPxmGs= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763776973422899.0400686272687; Fri, 21 Nov 2025 18:02:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMckT-0001AG-87; Fri, 21 Nov 2025 20:49:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTQ-0006bv-SX for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTF-0003eZ-FX for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:29 -0500 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-571-gPn_B8rCNPSftKvQ_gAVXw-1; Fri, 21 Nov 2025 19:27:05 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8b2e2342803so761248885a.3 for ; Fri, 21 Nov 2025 16:27:05 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zP1UWP2hrKh6gHFJKbP+xwMm3Oogaln/YNFdJGManXk=; b=Lp4iUbDG/+FwDeFC897sfsbpgvV5h7704A8IkYfhMxzB6/LwsE28nlpJCvKrbNXiqQlTQA kQl0D9xOCUclRfzT7GOZXi4CDKxSDChp3ZOOl/vCntmAI8Lz+qS6lD4q2Tk//W0l2XxSCX 7FpXCr2ePKSxOID3+aa7tRNbwjmIO/8= X-MC-Unique: gPn_B8rCNPSftKvQ_gAVXw-1 X-Mimecast-MFC-AGG-ID: gPn_B8rCNPSftKvQ_gAVXw_1763771225 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771224; x=1764376024; 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; bh=zP1UWP2hrKh6gHFJKbP+xwMm3Oogaln/YNFdJGManXk=; b=IKnDhYvJJIA+//9ajgTO+5ctFntrtieJnGyl04UbhZWP98b9ShtuooExVq6pDtQEd3 3ag8g7A8kzpUfU+1wCiidKtwEQCjSu1ShXWHRCPXdARNWcfqwdtOJGZcE3yjrebsOkeB 6dR+OaZoWqpDr6meUUu5Px4nAWjrDyTUUbsQvFT6nbH0aBGJZIIjTR3k5jow5INbpgYP KCH162dFAgd0IEeOPVZ1XYnazi2edWcv/9T+kZS4ApVxldv667PatyoU+e3h2tCTf+bc 0XSP60Huu4CLAqOJcg/v1uvfgjINtB7OFhA4mkGovHGpFFUhRpWKw3MgFhK5MlNqnuDl SIqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771224; x=1764376024; 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; bh=zP1UWP2hrKh6gHFJKbP+xwMm3Oogaln/YNFdJGManXk=; b=oyKAGFVEy8udyh+guQ1wBXt247qCqN7D6t4FfW6WEYxmtVJw0a0upJrL+6R2pdtAMM tMhOlTaJ6PMHMBtTY8mFcA2ue0sgousna8VND2sr6XWGH1ehdWRZAGRT30AGc9MTjupS Lx04MZHilV++0MB5Pom/Ulo0v0hGQ2rCZ72rSsKA4NWMkz422GhGwPqUJ6MgPIknQcpL CH/QPnJ5DQtL0r2srA2e/FXzmdX0WZACNCETi56VD4PQPjqY/wl1XILS/k6Pd0Xt4Sh1 AsV5+PJY5/vPWQ2ZA92Vz034LA2UfPa1okNznPAnCg0M5vEbq/blPgDTFV7uvoxY20Bl E9hQ== X-Gm-Message-State: AOJu0YwcXopeEBYAnfBRHryqyOtl+mDQ+7vr8MZDINct5wO5aRY6vg2Q rEBcqtAsN2YyIAFiM6n0X0/RgmhyXR1dsh8Nz4orG/cIHnClwr4UoaEB59x1NiwrwrjdMGsbo3/ pEkcAI4WEUHdYHNxV78IOplxkBtlveu3Qp/RssiSk9fh8fiTp8s2AmPHQg0/aEVqA3HTWnkaV+g 8fNaDm1f+yku95b84cN+DbaisAZet6LbT62mWQhA== X-Gm-Gg: ASbGncu3T6dWZ2B+1nreAXp+V4RJqUOkC7yrvvogcICNuEq/rIkpt619k0xJCXtCkkS dQ+6MFi8ZDv1d/u3irkmvfR50N8eI79K+S2YNcGB0liUXR7e+ZrpahM5T/ZQRV20AXSuajs1v/e vKCYWeSGuLZEta4Jo4yn72U9xLtplYFr7C3R31g6BIjOzTUIJKHbhYKCf8ntA5xQb2m6ytev6kA wRk9ZLBZ+phbXomkmuKi/p0G2Sjm0InsW1RNflhwaIt+LUQKop+2Q61zUZB7ImSwTqqXuGRd3kQ kNm/kS1k7hp552Fgcu6DWsC3ymLvFibxCVXTUUHrHXq+VG3cjS3Fsi3QELCWGPfvbaVqG7A80Wc Y X-Received: by 2002:a05:622a:89:b0:4ee:1f5b:73c3 with SMTP id d75a77b69052e-4ee588b5258mr63518061cf.60.1763771224335; Fri, 21 Nov 2025 16:27:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsAHt94GT25KyIjV8tHCZ6e43lQ2/U0ANCQz+46OsfX/WiHUHGdENgtxvVqUtE+bY/FUKXjg== X-Received: by 2002:a05:622a:89:b0:4ee:1f5b:73c3 with SMTP id d75a77b69052e-4ee588b5258mr63517621cf.60.1763771223722; Fri, 21 Nov 2025 16:27:03 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Markus Armbruster Subject: [PULL 4/9] migration: Use warn_reportf_err() where appropriate Date: Fri, 21 Nov 2025 19:26:50 -0500 Message-ID: <20251122002656.687350-5-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763776973752018900 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster Replace warn_report("...: %s", ..., error_get_pretty(err)); by warn_reportf_err(err, "...: ", ...); Prior art: commit 5217f1887a8 (error: Use error_reportf_err() where appropriate). Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251115083500.2753895-3-armbru@redhat.com Signed-off-by: Peter Xu --- migration/multifd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index a529c399e4..6210454838 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -464,8 +464,8 @@ static void migration_ioc_shutdown_gracefully(QIOChanne= l *ioc) */ migration_tls_channel_end(ioc, &local_err); if (local_err) { - warn_report("Failed to gracefully terminate TLS connection: %s= ", - error_get_pretty(local_err)); + warn_reportf_err(local_err, + "Failed to gracefully terminate TLS connection: "); } } =20 --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763777048; cv=none; d=zohomail.com; s=zohoarc; b=cnyt48XcZdQYpBkOj0SJ0cp1/3LpiL4bRUqjvLLtLvzovkLuBW1XLHZfLnrbihAFxx4r8uLfbGAzZqzEKExVTuJhThzDOl3rLkjzwVn+fDf6hWknGc7DVCuv7bM1lUSTBw+h5NuMEvETtPCfBeT3L0PFO2RP39CmrOJNsttwPVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763777048; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ucm9Frb4EPj7cNAABkDFctVqJ/YbMHaGhW3ZAw/4A04=; b=CsNEISL0+VTiYJoJpLxiuxiPrr31fzEplKCaltcda2PzA+exB7Fp9XVLEB48XjUgWFGXP94/8Qmwt8F8gIDWOyxSPm36kw9ZSHVeeio8OpM8aCNPNnHswYGCCExiynVHIHHtBFzNTBFGBKakCNLy9HyMzYVwu5Fc3ltBIxzUrfc= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17637770486541007.9545116340778; Fri, 21 Nov 2025 18:04:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcjh-0000am-Lw; Fri, 21 Nov 2025 20:48:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTT-0006eE-Hg for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTJ-0003f4-6t for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:33 -0500 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-Jtcs0RKQMnuSRmfEgUwfDA-1; Fri, 21 Nov 2025 19:27:06 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4ee25cd2da3so50624131cf.2 for ; Fri, 21 Nov 2025 16:27:06 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ucm9Frb4EPj7cNAABkDFctVqJ/YbMHaGhW3ZAw/4A04=; b=gaJL/Q1tBCFWRAlQPaYvBb8s+6l9DwkpnAw7Yg1QpvmLBqQWqXIzF6iBjz0Bg7xJ4x21Gj v2j1KeDvKzEeGteDj8homL/7OGQxXa8WQ42SUlDWjF/OgJo9S4S8OiH4XJ+rCX4kB3NdEM dTiz2TRhzqDuowfjJ5eJdQyv1s9n8oA= X-MC-Unique: Jtcs0RKQMnuSRmfEgUwfDA-1 X-Mimecast-MFC-AGG-ID: Jtcs0RKQMnuSRmfEgUwfDA_1763771226 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771226; x=1764376026; 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; bh=Ucm9Frb4EPj7cNAABkDFctVqJ/YbMHaGhW3ZAw/4A04=; b=XdKP9EREcfvxBrGyTTyJLDFiTg5UsswB3NWCLL7S3paWxFU6tLQqW0Bc15r1jKnhmF xDVKYWxGQ/r+beuDrZ4Fkm7XDocYKUH5U/q1QCG6/TwAbT1YMgS9btdznErbmUMd3dXe 9dkY28m4M4pq8imL5UXmDvYH/7R/v0IeO6H9fNmCXa/v+TmNtI3Mma+wYQBsd7TTLg0C +SwQh658x2jQZQZYXFCLuLFFpxWuWTfjPs/c5VnY1DHK70C8c4WLuYd7KiTLPhSkrC3z dFGFcLPcgrQnB0AhJFJ2QV63ieF/uD9yKRcC9ln5JminFY8kYFLOCNpXj3Xmmzu/tWCb nfYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771226; x=1764376026; 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; bh=Ucm9Frb4EPj7cNAABkDFctVqJ/YbMHaGhW3ZAw/4A04=; b=dmlFT6P7AiIcgBOLPseE9Xes7Kc+DT/naB0rUr7la65g/GudreaoMV48b59Isk6ynF tKUxKFIraHXqzbwagNBEHpzaOuk9rA5fiN+LHdk6nEdzfp+HDaM8wvM8HmunsGUx5vDd rpy61cIq3x2W8r1LB46iw8pNKtqQT/712sa8MdKGqfDIiywnxtCFtUXCXGV00c2Roitk RwKGd2lgnTce1ksGGWniWJPUj+9H2ezV/G98l9ttmdGjx+KFpz9GloYOL+nBtcvZb2Gl 0VU4rRlUpdCkPtyF+ADtsSqcebqZZSEyP4571U2DP0PzTpuYHaqVc02NgTleZ0JLVGrC 3jNg== X-Gm-Message-State: AOJu0YyjNXqaAfc/pV8bd5wICWPf2Ujc+ALSIOftK7eK/ZW4FHT8JSKu /st2Tus38DOV+kKhuOwO8i4qM4u0NvrokrUictYBYMIviAJhLIfFZZzgybsbDU47jGCbIFP4OPr /hmMbPrIbR9ciZpzJV7C4t7LVcblT3/TeuFkh0fB19TvZbvYVsGJd2snuE1HQx//6yZTZ6zATol iOGcBobYaus3QInqCRNksOgWPV1hHn+8cS4bRZ3g== X-Gm-Gg: ASbGncsA+8N2OZwt38OggWDnVBHy/5tQ+Q4VJqQRMETesYS17vq6PyQ2vlsoaDYrZKd 8w+nykGsN57UmDc1it87XtxtZU+s2ltP/wBWSIB1r+DPElrdIzhYu1mQSwJtQSw2LgX0xNPQbag JjXiPHEi6H9m0ydEt1cvkJAN1n5jhFm5opb3ixBvEDiCpl4aT2JzMSf9UATXJCPyy0WBX9ed6nW cjm/v4sYVRRL9WD/sVeCPgNrHjPZLXNcY5UHss/1KOu4Kw0NJXwPgYoFEHmj38fWwxlS4A+ZLJz wmwGPuQgJObqF80JhwDhiS3YrT6HGITCxz4qAVAVxZFzZ+ZBAC21f99s4hYh7Fn+hJDcWg38a+u h X-Received: by 2002:ac8:5905:0:b0:4ee:1b37:c9e9 with SMTP id d75a77b69052e-4ee58818828mr75181921cf.5.1763771225672; Fri, 21 Nov 2025 16:27:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8gSWGGAKJX3onm9hzxFU6L8pmTUbEDKEYpmu9D3XvC6KTbEGWFAt1q4+DA2DP9iImfr2I1A== X-Received: by 2002:ac8:5905:0:b0:4ee:1b37:c9e9 with SMTP id d75a77b69052e-4ee58818828mr75181581cf.5.1763771225193; Fri, 21 Nov 2025 16:27:05 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Markus Armbruster Subject: [PULL 5/9] migration/postcopy-ram: Improve error reporting after loadvm failure Date: Fri, 21 Nov 2025 19:26:51 -0500 Message-ID: <20251122002656.687350-6-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763777050269018900 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster One of two error messages show __func__. Drop it; it doesn't help users, and developers can grep for the message. This also permits de-duplicating the code to prepend to the error message. Both error messages show a numeric error code. I doubt that's helpful, but I'm leaving it alone. Use error_append_hint() for explaining that some dirty bitmaps may be lost. Polish the prose. Don't faff around with g_clear_pointer(), it's not worth its keep here. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251115083500.2753895-4-armbru@redhat.com Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 3f98dcb6fd..7c9fe61041 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2146,25 +2146,24 @@ static void *postcopy_listen_thread(void *opaque) if (load_res < 0) { qemu_file_set_error(f, load_res); dirty_bitmap_mig_cancel_incoming(); + error_prepend(&local_err, + "loadvm failed during postcopy: %d: ", load_res); if (postcopy_state_get() =3D=3D POSTCOPY_INCOMING_RUNNING && !migrate_postcopy_ram() && migrate_dirty_bitmaps()) { - error_report("%s: loadvm failed during postcopy: %d: %s. All s= tates " - "are migrated except dirty bitmaps. Some dirty " - "bitmaps may be lost, and present migrated dirty " - "bitmaps are correctly migrated and valid.", - __func__, load_res, error_get_pretty(local_err)); - g_clear_pointer(&local_err, error_free); + error_append_hint(&local_err, + "All state is migrated except dirty bitmaps." + " Some dirty bitmaps may be lost, but any" + " migrated dirty bitmaps are valid."); + error_report_err(local_err); } else { /* * Something went fatally wrong and we have a bad state, QEMU = will * exit depending on if postcopy-exit-on-error is true, but the * migration cannot be recovered. */ - error_prepend(&local_err, - "loadvm failed during postcopy: %d: ", load_res); migrate_set_error(migr, local_err); - g_clear_pointer(&local_err, error_report_err); + error_report_err(local_err); migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FA= ILED); goto out; } --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763776862; cv=none; d=zohomail.com; s=zohoarc; b=RCv4t3lTjgF9qEXoB06TfnfuJ/BJgMQGiTNBG7DnvtbIVCmS7m0oKsqYWfOsQc5Z/qHO5cjueBf6jExwtjLfEjhR6Qh7R76ilr3bzEZZ23OOhRY5EXofpRCykqzXx5yPl3brA57+CuMo0iIHvHZwPSX4bKlr7d/yp09OQRS4WzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763776862; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=P1sVJQwbcNqFr0LfI7lXuG6bpSPUSfPuzbZGwxc62oc=; b=Lst85XvkT9k3jZuZKGT+msAZKJaiCpefCFWu8pOMlmRr3oFCWl6TSAu+nL+cAnuw5l5ku1hpXli26mGJlhvcBQqPduOMMhNH3/kZnV2O2Mo1VXVmMivi3eKgQR2xsgRjz0ksO3bDsU9ky+OnMcEx0M8nJtoIvR+8WZPplaixs0Y= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176377686297048.9890813433733; Fri, 21 Nov 2025 18:01:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcjp-0000eW-3s; Fri, 21 Nov 2025 20:48:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTT-0006eP-PH for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTJ-0003fM-Fc for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:33 -0500 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-TLLfEmZ-NEeEGFEs4H-GcQ-1; Fri, 21 Nov 2025 19:27:07 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-882381f2092so101680986d6.1 for ; Fri, 21 Nov 2025 16:27:07 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P1sVJQwbcNqFr0LfI7lXuG6bpSPUSfPuzbZGwxc62oc=; b=JzIOQcpuXugHwPbE6s4hJNee0J7I6OncCmVUPHeeCBm2BM5IW1Fjfa9KDY9RucxdQZhYHP L4zR+EpEInDCsZb1CZT//Pe6uvNMUCq/0i4Qd93F2naGUgRv4nm59NEYucipLSxmkJuFOl ILs0oG95gNX2tSS2lKGPKluULEn90y4= X-MC-Unique: TLLfEmZ-NEeEGFEs4H-GcQ-1 X-Mimecast-MFC-AGG-ID: TLLfEmZ-NEeEGFEs4H-GcQ_1763771227 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771227; x=1764376027; 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; bh=P1sVJQwbcNqFr0LfI7lXuG6bpSPUSfPuzbZGwxc62oc=; b=jCw/qqoFSbhgaFElyJq6fuH+RBDr82AVdX3bYtlCmm+91HLMlArEECn8sPo8QhhSEZ 3JH0wMuOvmCZ4X0+j/ZFue0o9L1XTldOqbetUDr75EYQXnrpvAPe3TtovBEet711aqzC LNx62Mfb17fcMZLn0x1MjnAoBD9f0/rMYf+9n1l6JLms4RExT5DUhPYYDRddZD49Wr7t klb11iah6oXWo5rljjVyML7nWUaZlnJNi3wnhEiy1Q8+IVzcdwdqFmhfOv/X08z6dAF1 XxuDMW8ZKQRCqMBg/Ebs7iPtoT3+PxLcLkGGiB9MeMR8msrNRUW2sDLSGxsn7dDXTgsI YNfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771227; x=1764376027; 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; bh=P1sVJQwbcNqFr0LfI7lXuG6bpSPUSfPuzbZGwxc62oc=; b=wRFeg7hO6t0o/GeZfJYdnWfYUN9AgpplCG98JoJScnavJjC9/owbIxf5izNre/Hhbo atVNlIImJAyc0R6dwF4n/eLa+D1zsYdwk8vndQdBCrOhlcCwauX9wKXLp+XyS0st3bmj qFqROabPj4sP00O2Htey6jQsMrjj/DU8KXEegpdahYfmE6hl3Dz0SQDHax18PcaoEyn6 WhsMXE349vRdZQfI2krKl7kqyJIX/lt0Oh3WkwrQNmvhRYRVxxLpSWt/a6ZO7uqwtAqe P05UHqGBApV5vA2oZwWk4ZMQFfzXlmAND3bSs9RDSVshYgXZwLHwDo6Z6l7fub0quAgh dqEA== X-Gm-Message-State: AOJu0YwtjEYXEClBCKhFAtgVMrQFn+TvsXSz9KjpULkitX8SPLGHozvK prBjK90+owUb2wZ7HfG6AMjurJgY/JS7pDP0i/Cvr80gbC+YkCyqXjp6p8EogMc/IwgUW6pYqp0 wdArwsQUyZmv1BKwfedjyBLma3/Coy/GFSMNr07X4J+AIeL/ru6MTm+OAF432E0eZazPtupD7xS NxIIBE9bYrTq6xSxE6M+IXxKzOgfwk0lC96/jSLQ== X-Gm-Gg: ASbGnctWiEYIljO9ej4ickS761R1UBJvD3UtKGmAbNMJNjIwetiB5J9FYsE3sENiggH bnvcYfssuW1wKFwwaC68Wd5tQZcJSq0Ao3ADxPJyqLSX9Ln/GM8ZsRUxmqSCZmqwET6z+xiHcbv oVpMBsquepyof30IBMmAonxB7Uj+GgEBjF5TGb41ZP64sxgNoZtRmcel6F4YhHaaUIC47R+FQQ5 4o5J80hjL3OKxI4PDtoqTZ+o4Gcquv9D0bH7V+26AiFLNT5lk9647ROpkGhQE1WUxBXBGDGi0WV 4LHo+VcY71VrIp866eSvm8py3LHF8Sn09yu2LnMF9ZiSCssNWWZKtAn1NJzBa2twKPa9gyDv3VU 5 X-Received: by 2002:a05:622a:1a20:b0:4ed:1948:a8af with SMTP id d75a77b69052e-4ee58a784e0mr53056701cf.36.1763771227090; Fri, 21 Nov 2025 16:27:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5LYgqKjf1YfaOBt0DyDdbVf1JsO6Arl+DEvvcJN+01/xffZEH3hC74b1ysHLDbdErTseJYw== X-Received: by 2002:a05:622a:1a20:b0:4ed:1948:a8af with SMTP id d75a77b69052e-4ee58a784e0mr53056391cf.36.1763771226586; Fri, 21 Nov 2025 16:27:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Juraj Marcin Subject: [PULL 6/9] tests/migration-test: Introduce MemType Date: Fri, 21 Nov 2025 19:26:52 -0500 Message-ID: <20251122002656.687350-7-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763776863633018900 Content-Type: text/plain; charset="utf-8" Some migration tests need to be run with shmem, the rest by default use anonymous memory. Introduce MemType and replace use_shmem with such a enumeration. This prepares for a 3rd type of memory to be tested for migration. Careful readers may also already notice that MigrateStart has another field called memory_backend, which makes the whole "memory type" definition convoluted. That'll be merged into MemType soon in a follow up patch. When doing this, introduce some migrate_mem_type_*() helpers to do the work for each memory type. Reviewed-by: Juraj Marcin Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251117223908.415965-2-peterx@redhat.com Signed-off-by: Peter Xu --- tests/qtest/migration/framework.h | 8 ++- tests/qtest/migration/cpr-tests.c | 2 +- tests/qtest/migration/framework.c | 81 ++++++++++++++++++++++-------- tests/qtest/migration/misc-tests.c | 2 +- 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 9bb584a6bb..70705725bc 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -18,6 +18,12 @@ #define FILE_TEST_OFFSET 0x1000 #define FILE_TEST_MARKER 'X' =20 +typedef enum { + MEM_TYPE_ANON, + MEM_TYPE_SHMEM, + MEM_TYPE_NUM, +} MemType; + typedef struct MigrationTestEnv { bool has_kvm; bool has_tcg; @@ -102,7 +108,7 @@ typedef struct { * unconditionally, because it means the user would like to be verbose. */ bool hide_stderr; - bool use_shmem; + MemType mem_type; /* only launch the source process */ bool only_source; /* only launch the target process */ diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 9388ad64be..70f8e69633 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -32,7 +32,7 @@ static void test_mode_reboot(void) g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); MigrateCommon args =3D { - .start.use_shmem =3D true, + .start.mem_type =3D MEM_TYPE_SHMEM, .connect_uri =3D uri, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_mode_reboot, diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index a9be9c2dbf..8fa39999a1 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -260,6 +260,25 @@ static char *test_shmem_path(void) return g_strdup_printf("/dev/shm/qemu-%d", getpid()); } =20 +/* NOTE: caller is responsbile to free the string if returned */ +static char *migrate_mem_type_get_opts(MemType type, const char *memory_si= ze) +{ + g_autofree char *shmem_path =3D NULL; + char *backend =3D NULL; + + switch (type) { + case MEM_TYPE_SHMEM: + shmem_path =3D test_shmem_path(); + backend =3D g_strdup_printf( + "-object memory-backend-file,id=3Dmem0,size=3D%s" + ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", + memory_size, shmem_path); + return backend; + default: + return NULL; + } +} + int migrate_args(char **from, char **to, const char *uri, MigrateStart *ar= gs) { /* options for source and target */ @@ -268,7 +287,6 @@ int migrate_args(char **from, char **to, const char *ur= i, MigrateStart *args) gchar *cmd_target =3D NULL; const gchar *ignore_stderr; g_autofree char *shmem_opts =3D NULL; - g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; @@ -332,13 +350,7 @@ int migrate_args(char **from, char **to, const char *u= ri, MigrateStart *args) ignore_stderr =3D ""; } =20 - if (args->use_shmem) { - shmem_path =3D test_shmem_path(); - shmem_opts =3D g_strdup_printf( - "-object memory-backend-file,id=3Dmem0,size=3D%s" - ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", - memory_size, shmem_path); - } + shmem_opts =3D migrate_mem_type_get_opts(args->mem_type, memory_size); =20 if (args->memory_backend) { memory_backend =3D g_strdup_printf(args->memory_backend, memory_si= ze); @@ -403,6 +415,42 @@ int migrate_args(char **from, char **to, const char *u= ri, MigrateStart *args) return 0; } =20 +static bool migrate_mem_type_prepare(MemType type) +{ + switch (type) { + case MEM_TYPE_SHMEM: + if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { + g_test_skip("/dev/shm is not supported"); + return false; + } + break; + default: + break; + } + + return true; +} + +static void migrate_mem_type_cleanup(MemType type) +{ + g_autofree char *shmem_path =3D NULL; + + switch (type) { + case MEM_TYPE_SHMEM: + + /* + * Remove shmem file immediately to avoid memory leak in test + * failed case. It's valid because QEMU has already opened this + * file + */ + shmem_path =3D test_shmem_path(); + unlink(shmem_path); + break; + default: + break; + } +} + int migrate_start(QTestState **from, QTestState **to, const char *uri, MigrateStart *args) { @@ -410,11 +458,8 @@ int migrate_start(QTestState **from, QTestState **to, = const char *uri, g_autofree gchar *cmd_target =3D NULL; g_autoptr(QList) capabilities =3D migrate_start_get_qmp_capabilities(a= rgs); =20 - if (args->use_shmem) { - if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { - g_test_skip("/dev/shm is not supported"); - return -1; - } + if (!migrate_mem_type_prepare(args->mem_type)) { + return -1; } =20 dst_state =3D (QTestMigrationState) { }; @@ -441,15 +486,7 @@ int migrate_start(QTestState **from, QTestState **to, = const char *uri, &dst_state); } =20 - /* - * Remove shmem file immediately to avoid memory leak in test failed c= ase. - * It's valid because QEMU has already opened this file - */ - if (args->use_shmem) { - g_autofree char *shmem_path =3D test_shmem_path(); - unlink(shmem_path); - } - + migrate_mem_type_cleanup(args->mem_type); migrate_start_set_capabilities(*from, args->only_source ? NULL : *to, args); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 54995256d8..20edaa51f5 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -97,7 +97,7 @@ static void test_ignore_shared(void) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; MigrateStart args =3D { - .use_shmem =3D true, + .mem_type =3D MEM_TYPE_SHMEM, .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, }; =20 --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763776374; cv=none; d=zohomail.com; s=zohoarc; b=XiWj+I7OcwoTPgaAuQOS5aDL9fLLFHaJW49vvBVfSBkTB/aU+zTMiN6Ti4YYBn2Z1CgijiGZSqjo89EEYDYn3IQoqHo+Hi6//Nxx6VSkSBWkRe3+hOyGaABUZzxcAFFnBWQlqBkplEpDB95sEmTZzIIh9NRCkDESZMiKce0a3gM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763776374; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XkmroyYCTEEZf3ECgpF/Q+QP6WnX41hH0GBpOgZMfpk=; b=H369OcsRyjmLEVtUmUYFBwW25zsbuin96rfvhVe3UAvtC+/+74Y2Qa0Cc6/Cep/85tf7H4noFIHkoD6vzaKy/zfWkpLpKhBypdGYJLfZNeMHeVa5U+4akxqCfWTE2KFPy43KsmBEC5JMDjPG5UQuatCCn0lpl0+X0Vp+XApt5mI= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763776374050819.9656810728851; Fri, 21 Nov 2025 17:52:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMckc-0001BD-H5; Fri, 21 Nov 2025 20:49:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTT-0006eV-Sz for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTJ-0003fu-Ip for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:33 -0500 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-676-6PfPID-CM_2uaN3W3aGJZQ-1; Fri, 21 Nov 2025 19:27:09 -0500 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-882381f2092so101681606d6.1 for ; Fri, 21 Nov 2025 16:27:09 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XkmroyYCTEEZf3ECgpF/Q+QP6WnX41hH0GBpOgZMfpk=; b=LUWrG0eW/y960hRITViuys67Ze2+fiTrNTE8BIamyjuIMiYFgBRra0abEsAZ2RdF1gbMoe 3vOX5K+aK0okP8044g4k2JlDxV0/53maMa6+vnohYobzFJu7ZXXbC0IMzfQrCrk3jlna8r +kJVHWpkdfc6JoRLhGrrqprAwEFBpZs= X-MC-Unique: 6PfPID-CM_2uaN3W3aGJZQ-1 X-Mimecast-MFC-AGG-ID: 6PfPID-CM_2uaN3W3aGJZQ_1763771229 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771229; x=1764376029; 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; bh=XkmroyYCTEEZf3ECgpF/Q+QP6WnX41hH0GBpOgZMfpk=; b=TthdNVOMSA/X3DNBcmPVvsR1wJkjCScOqx5rtOjawIBmiJNUHExBazockUixXt/ogE 0Y+T7T7OxVzzW3UY+zu+Ofz6ud8y+Vr7uQGteYk8aGkj/L8QG3iU7XKIKF2RrXM9+R88 NxGF3Imv9Mi7/+lMWNUHRZN/U1/WsiD8d2m/hpi3jdUFFvz7GlsNqj/33bcjA7vo+RQo RzB0dLmmXs3hex9TXctqnmhyCyj83Eg1eIWJ3JmkWVdoJbO1/HgFqdIn7J+Tox8MY0r8 9Oaj/K5192FbxU4ctH/oakbOOznNNm28b/k6vrN8mLDGqPW9s5ecbLobqUNNJsycqycs 2lTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771229; x=1764376029; 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; bh=XkmroyYCTEEZf3ECgpF/Q+QP6WnX41hH0GBpOgZMfpk=; b=MMZJZJBuYJSWBy4tYkvDwrDXYXXD9VE/WJhhvjEYa3xQ8C/qQDA+qav74jk/+VxCEg VTQAEyqyUXQfSfMXwJuMryXO+x9kzi2BSzBDSZmUXGrX3SaSt08TX+ZQ5S6Fvh47Fbi0 WLu8KP7Nk0USpQ67l18N2TgCh6URoFXnji8gadfFIwRgpz4AYnWKnOQBAuv8n+3kcixa 6Kl1gC8D9CW9mrzHLfnc+uQl+xgVDFlxdsvp8UBaW9IbPnBg1FFm4Qt/2zgyGfoQje+w c3ldHUV3tKdz49Kuslyy9zA8tw6BmUSaW+vccsVv/wNXik9vymXguGyKNd+5tkKOnCUy KLVQ== X-Gm-Message-State: AOJu0YwF6VOu+Px2Wp52tGL1cSsiuTg+EBmzQUKKMRG+boB4NDGn6tcn QElv5aIADYIC4YV6//u4y1+DfBf2on6SnFAeuzukOtIyM2HP43Jue/S9IF0XdiIvt/fkGNYyHWg XD+EgwARDrBecjyrh6wFgt0F0zqvUQaEFXUYb3absoCKx8S+hThP2Q+2tPsKV+cWj5RFZu7UGz4 qqzYXPcWvH9hTFXdYtXNg72sRlydzbyKeBKaUE/A== X-Gm-Gg: ASbGncvoyHZAG5T5SO7yehyTxlqmhKdNUuoWQTyp0VQDq6j1UuQlA7Sa5JYiFf9Bf3m vn7rOb1Ne6uFGBzQ6GxmxrJLjx5FwEstVN/C3X0l2b76iIlolROk+mvpI0T2vvQpXQTCcIneBza yJpCJ50sXHtonhySXXHJe9rR/vczq3FOtxQWTw47nIgd8chxW6wTT7ssvqCUnmDoZ+FH+ilmFyh 6QURkcUY8BVSn2aC/1MnhM2MHjIkHBV+tocySPJY9bRAiFxKzG4jycV9v0D9jM2gpUMRE37NbzL /P7dc6Z1MG64lNCeTqpVN6xV9YY3gfC2d2bX2IxxbeYw09S+Kg3bY7lMvLBL01flrXIJyDQ6RXI 0 X-Received: by 2002:a05:622a:1386:b0:4ed:542:bb38 with SMTP id d75a77b69052e-4ee58af89e4mr65813951cf.74.1763771228825; Fri, 21 Nov 2025 16:27:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt7QYNROGUhUhoBJNA89HOwWmlTp+dZDw3Cam6MRLvX0KHsXyxE3Q8KPZJbPMcwcxB8sIbFg== X-Received: by 2002:a05:622a:1386:b0:4ed:542:bb38 with SMTP id d75a77b69052e-4ee58af89e4mr65813681cf.74.1763771228387; Fri, 21 Nov 2025 16:27:08 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Juraj Marcin Subject: [PULL 7/9] tests/migration-test: Merge shmem_opts into memory_backend Date: Fri, 21 Nov 2025 19:26:53 -0500 Message-ID: <20251122002656.687350-8-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763776375775018900 Content-Type: text/plain; charset="utf-8" The two parameters are more or less duplicated in migrate_args(). They all describe the memory type. When one is used, the other is not. mem_type currently uses numa parameter to specify the memory backend, while memory_backend (the two users of such uses "-machine memory-backend=3DID"). This patch merges the use of the two variables so that we always generate a memory object string and put it into "memory_backend" variable. Now we can drop shmem_opts parameter in the function. Meanwhile we always use a memory-backend-* no matter which mem type is used. This brings mem_type to be aligned with memory_backend usage, then we stick with this as this is flexible enough. This paves way that we merge mem_type and memory_backend in MigrateStart. Reviewed-by: Juraj Marcin Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251117223908.415965-3-peterx@redhat.com [peterx: move MEM_TYPE_ANON case upper, per juraj] Signed-off-by: Peter Xu --- tests/qtest/migration/framework.c | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 8fa39999a1..7f325e4753 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -260,23 +260,36 @@ static char *test_shmem_path(void) return g_strdup_printf("/dev/shm/qemu-%d", getpid()); } =20 +#define MIG_MEM_ID "mig.mem" + /* NOTE: caller is responsbile to free the string if returned */ static char *migrate_mem_type_get_opts(MemType type, const char *memory_si= ze) { g_autofree char *shmem_path =3D NULL; - char *backend =3D NULL; + g_autofree char *backend =3D NULL; + bool share =3D true; + char *opts; =20 switch (type) { + case MEM_TYPE_ANON: + backend =3D g_strdup("-object memory-backend-ram"); + share =3D false; + break; case MEM_TYPE_SHMEM: shmem_path =3D test_shmem_path(); - backend =3D g_strdup_printf( - "-object memory-backend-file,id=3Dmem0,size=3D%s" - ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", - memory_size, shmem_path); - return backend; + backend =3D g_strdup_printf("-object memory-backend-file,mem-path= =3D%s", + shmem_path); + break; default: - return NULL; + g_assert_not_reached(); + break; } + + opts =3D g_strdup_printf("%s,id=3D%s,size=3D%s,share=3D%s", + backend, MIG_MEM_ID, memory_size, + share ? "on" : "off"); + + return opts; } =20 int migrate_args(char **from, char **to, const char *uri, MigrateStart *ar= gs) @@ -286,7 +299,7 @@ int migrate_args(char **from, char **to, const char *ur= i, MigrateStart *args) gchar *cmd_source =3D NULL; gchar *cmd_target =3D NULL; const gchar *ignore_stderr; - g_autofree char *shmem_opts =3D NULL; + g_autofree char *mem_object =3D NULL; const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; @@ -350,12 +363,12 @@ int migrate_args(char **from, char **to, const char *= uri, MigrateStart *args) ignore_stderr =3D ""; } =20 - shmem_opts =3D migrate_mem_type_get_opts(args->mem_type, memory_size); - if (args->memory_backend) { memory_backend =3D g_strdup_printf(args->memory_backend, memory_si= ze); } else { - memory_backend =3D g_strdup_printf("-m %s ", memory_size); + mem_object =3D migrate_mem_type_get_opts(args->mem_type, memory_si= ze); + memory_backend =3D g_strdup_printf("-machine memory-backend=3D%s %= s", + MIG_MEM_ID, mem_object); } =20 if (args->use_dirty_ring) { @@ -378,12 +391,11 @@ int migrate_args(char **from, char **to, const char *= uri, MigrateStart *args) "-name source,debug-threads=3Don " "%s " "-serial file:%s/src_serial " - "%s %s %s %s", + "%s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_backend, tmpfs, arch_opts ? arch_opts : "", - shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr); =20 @@ -400,13 +412,12 @@ int migrate_args(char **from, char **to, const char *= uri, MigrateStart *args) "%s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s %s", + "%s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_backend, tmpfs, uri, events, arch_opts ? arch_opts : "", - shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr); =20 --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763808382; cv=none; d=zohomail.com; s=zohoarc; b=bhaN0hurxtkBUh/94XeDxQRekWnVuuOO5aUoEEFNFK4SzYnTTyTUZhBY4SHMl5krnkH+cbLcUEvMR4Nia4yNkZNdQne+jbF4ze2H0CHxivOJqdsRFwofZi/VtSw4pXsOr0vgofZeN5IXEcZFf0Xesd/B+5ntRRdhnqiMAQMalUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763808382; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eiFTSrhmdRBgSz2YPDVLbDrwe9yxAidpMEUIApAw54Q=; b=XG2pcXVAIxjbO+q1znpI8hPkxe4TZLkamKmIONCegVxK5ZXAPvgVoaoZNhVEbvSIz2vFJ0WWZsCHLuzKfvjvZ9yUOaqQZL5o6hgfTBMO7sVuCMQK7NqpS0k1fk7QApijG6VSrRv8f5sirz4KcyQdb+9KTgi+SqJfTDiiq10UG7Q= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763808382163457.4944530759685; Sat, 22 Nov 2025 02:46:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcmN-0002eF-98; Fri, 21 Nov 2025 20:51:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTW-0006fi-F5 for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTL-0003gM-50 for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:35 -0500 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-BB8srPofOdylj48UcAZZxA-1; Fri, 21 Nov 2025 19:27:11 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8b29b4864b7so417796985a.0 for ; Fri, 21 Nov 2025 16:27:11 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eiFTSrhmdRBgSz2YPDVLbDrwe9yxAidpMEUIApAw54Q=; b=CdU8rt4M7yQveRYpslTkw+kW1niVJ7k+7js08bb6k3EVWnE0ndDy4nWbOtgi8FydXi6H88 t/8xNqR41VO2TOKw67PaAyaC9QSLuP87PgH8q4R86PcN+arDL2vkS8ZucXQgTmths7vOE1 B26CBQcTwtEfzeoKccWTga/7flpD8jI= X-MC-Unique: BB8srPofOdylj48UcAZZxA-1 X-Mimecast-MFC-AGG-ID: BB8srPofOdylj48UcAZZxA_1763771231 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771230; x=1764376030; 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; bh=eiFTSrhmdRBgSz2YPDVLbDrwe9yxAidpMEUIApAw54Q=; b=UKWgt2pOM02H0xt7GTBRUZqOUj4hQmlsQ8HoMNx4cK+by8mSTwaIoROz57nxi6jesg 4BNyMjOyxh7yHj6YtWP2SCt4RDpMWSgkJwWHUl+J2f9WSNhduWVWiNB7kG+0RVT+mgpr hy3BPzsVSmkzoDn+MbEcwv84fEQWGU1YDNBoBYXcqjIEx67oeSIsXqDSmUU77fOoBmaS oCdcmZOK6tzcdJGlf7TSlfGZ+2tlEzrWxjowlUSsck9OwrMDuivkztDVDpJHAw5l35CF /sfV25S66cKP2VS/9u4UM/s8All5gKuPKRVKa2/TIVIHh5aZa76UZ889CLkryzm9Aat1 7bZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771230; x=1764376030; 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; bh=eiFTSrhmdRBgSz2YPDVLbDrwe9yxAidpMEUIApAw54Q=; b=owLQwjN7qLwy0IQ0hou4XPJpDzeqvQ+ahh4qm0FTtisfpDB7GkfGghaDNL7+J7/TDy DCpbU+f61YQAYJ3xU5S728zky8xMOzaav1QpZSY2697+BHFXRzP/xuNb+l+5GUFhIhml fL9C4fZXJgTEOliuLF2z207+I+Cn3axDUk62IEZlnncudUdyEk5fmcV+tU1v0zActu8b cgOQjSQ/eA/c0K8b1nHhwxqVKV0AeZONbRpO2d35TyzDdri5aIuh/IkGn3aLAbwAbo3z OCsX2tOQGXeTWDYq+hhU2DBBkalApQXUJS9sW6Su7Mv2JfcrfVCzy+U65lMb2GxUW+bU vWZg== X-Gm-Message-State: AOJu0YwE4OnorRCGp6/ogMBbLDdL+PzZ23GU7Y5TiZSRznVVycWkCe/a as3Ap4wP9L60Ag0Vn2YZmAqXINIh3lHSPZnyPyue2Mm/5CWK2J6hZMfnkKm3eqPH2m9y2DBpnfc GtfsjKVVoMd5RgdyChDEbP1UfOlYj/YyJfZxJkkEB7KTUHOb/4XGQIU6WiFJERq2t7RxIxLs0y0 11wdfUOvgqgoJZ9kLN06pJoksoaZpp/pMyPNTVoA== X-Gm-Gg: ASbGncu9NwMbTWsJv6YJ+CdBNA6cn/4CC3ZmhjoceHKdiHjOgkwzOSIfLOiTN7kbewX KqfgW0mtLE3DIc7czjMd3spg6hsMp8uWtwP9VrKiA+Rvux2z4+8gQloybHwAR6RiTzBuOAT7MV7 5ixgyGa9gLBz5q6x3MQS1gwWt2SQ92ZD0L6uy/xwfo08yEtoxtJme1APNUuh+AILqtbp9poEvV0 CwpJoMThTHkAM45nuQ/+HLHv1FLRNLFC5jVZS0uZeu/4DsCbPQi6LblOBMOuHZ7/oAz8Gzgpu9z 8Gm7Ncdk0UWvqlT2NWDdafiTVFQ6ZcfZKQzb8uWZkWwGGhQkJV57SWen0XfOIa3/I6k/yfs4BIM x X-Received: by 2002:a05:622a:45:b0:4e6:ebcc:23fb with SMTP id d75a77b69052e-4ee5885c1e0mr55410081cf.36.1763771230208; Fri, 21 Nov 2025 16:27:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSz5f8KKhFnfZCxHKcRs4RSrtJbzYl0HlcaNlsT3gTjs0zj4DUlPcOTqVzk00sH9PwVZvC/w== X-Received: by 2002:a05:622a:45:b0:4e6:ebcc:23fb with SMTP id d75a77b69052e-4ee5885c1e0mr55409801cf.36.1763771229750; Fri, 21 Nov 2025 16:27:09 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Juraj Marcin Subject: [PULL 8/9] tests/migration-test: Add MEM_TYPE_SHMEM Date: Fri, 21 Nov 2025 19:26:54 -0500 Message-ID: <20251122002656.687350-9-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763808383239018900 Content-Type: text/plain; charset="utf-8" Add memfd support for mem_type. Will be used to replace memory_backend. Reviewed-by: Juraj Marcin Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251117223908.415965-4-peterx@redhat.com Signed-off-by: Peter Xu --- tests/qtest/migration/framework.h | 13 +++++++++++++ tests/qtest/migration/framework.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 70705725bc..9dec21c344 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -19,8 +19,21 @@ #define FILE_TEST_MARKER 'X' =20 typedef enum { + /* + * Use memory-backend-ram, private mappings + */ MEM_TYPE_ANON, + /* + * Use shmem file (under /dev/shm), shared mappings + */ MEM_TYPE_SHMEM, + /* + * Use anonymous memfd, shared mappings. + * + * NOTE: this is internally almost the same as MEM_TYPE_SHMEM on Linux, + * but only anonymously allocated. + */ + MEM_TYPE_MEMFD, MEM_TYPE_NUM, } MemType; =20 diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 7f325e4753..1c662f86a9 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -280,6 +280,9 @@ static char *migrate_mem_type_get_opts(MemType type, co= nst char *memory_size) backend =3D g_strdup_printf("-object memory-backend-file,mem-path= =3D%s", shmem_path); break; + case MEM_TYPE_MEMFD: + backend =3D g_strdup("-object memory-backend-memfd"); + break; default: g_assert_not_reached(); break; --=20 2.50.1 From nobody Mon Feb 9 00:12:29 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763776902; cv=none; d=zohomail.com; s=zohoarc; b=JY4GDwnLFsMJiQPgvMZe0FVuSG95tAo+QrkycSNtH5qk925HCEVowXF/hWMKIqWpLJ7dfxK63/x1TXFoxblCirc3HTeVBPNUCvkDfPkMRP2bBPc97ri1xTUZOI2k5fkxCJ3VOIV54iYlYDtEuqsm9lLRik/ixVH2LzKa6sTkoPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763776902; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V76MNTnyuhhXMHGtNeIBFZdzBP6SOZz/Nq+ucjRpHnY=; b=dFi6alUFvDKpMtCfI5a96CKHYeVKDKfg6ps3KS40mi+o716/d20dMWWq+gjZEZH9CJ1qEr3yJEsbXGSkM8XcYrVcnFQAFSgaTbB5Hez+yCKNW4sqVnBAn2UxGKgwHFGmsArTb/s3QRj2YMB99JAq0kPSxKSUAw3LOcuBehBlEmo= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763776902897163.10621109797808; Fri, 21 Nov 2025 18:01:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMcmU-0002up-Ob; Fri, 21 Nov 2025 20:51:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTY-0006hs-Ul for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMbTN-0003hB-IY for qemu-devel@nongnu.org; Fri, 21 Nov 2025 19:27:37 -0500 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-BRyUGonfOL-gl0Co6SZBQg-1; Fri, 21 Nov 2025 19:27:13 -0500 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4edb35b1147so61896881cf.0 for ; Fri, 21 Nov 2025 16:27:13 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ee48e8df63sm43870291cf.30.2025.11.21.16.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 16:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763771234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V76MNTnyuhhXMHGtNeIBFZdzBP6SOZz/Nq+ucjRpHnY=; b=K+3yM9RdsYJTLAmqQaatW9gtXw8KujZlueZiaemfoLA1MxK7QbOsr84qH+O7pkLKN35Fyc EmLO6t+6UQmTDLNI791Px51xtWO8mtfF/3E+1GLP09fHRmTyYHVoHanz2gGRiYMK91xelL pUrzp7c63gNQKHPdeIyxijlusMpgF8w= X-MC-Unique: BRyUGonfOL-gl0Co6SZBQg-1 X-Mimecast-MFC-AGG-ID: BRyUGonfOL-gl0Co6SZBQg_1763771232 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763771232; x=1764376032; 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; bh=V76MNTnyuhhXMHGtNeIBFZdzBP6SOZz/Nq+ucjRpHnY=; b=AbMAq/uymFt6GyXagiT/7PDtWEXsaeJfvNvQMCl8FiF4dAMmAGoqUKN/HEq+g4Oe7a v/Y5t7UWus2lW7GFo+MZPGWSnzIoTvRcW7PPXPC8FDATG0JAjjsk1d1WTYFHyB/KyoSo SISWnijk9vjDr1AOkctFAmPMkc0NNKJOdsE0wifpND22NN1fDDDWQUGqJMYwH0YRNT57 7D4A+IKjR+zZ7sfSjTkmTEx+SF6i66wBnChlUWDsJ6H0q3hp7/giT0/K4F1bjJ6NthIS /b6+US3CldL2YpXVtNDbUsQT+XmcG4eqrTLGRel0wMcPEVcXDIh3kaRqAp4+9lUIzy4u kLaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763771232; x=1764376032; 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; bh=V76MNTnyuhhXMHGtNeIBFZdzBP6SOZz/Nq+ucjRpHnY=; b=vbl3l+/Yg/UBD0g84IvpzdVeAuyJ5bOWsafvQ+9USXozjLC/mn5YUxjSPCqtP9+Yaw kWlsQCDKrBVQVZsNWdYk3OA1aBh/rWgMpKrC6CVA8QBxtqri8u2ZRRUtwgSt9iNr1iwX FC2KuSWWuT9C/w56Z+WhVtc1DM4qwZooT80g2L+w37CnsGbNabHdI3kdlb75VwJ6RkGV wGeTqB3Z8V9DN8+LCcbFZ+wp5Gtbabam2Jx3KNbowHeeP3J7FaUcT6gosttbkDuDv4p6 bI7jqszYB/QLN27AjF6cZn28aPz440PkHlLElp7F4xYZkadW/2A/oiqCFbrnvHh+EQUn LogA== X-Gm-Message-State: AOJu0YxwLF1V1gajkhiTGPKOHfPt+dn60ynGmzcvQWTWZms+I4l4ESRr 1o+ycZYiWKQ8FxEd1gAU+58JS8rZVGGRy2FwwDLDGplNPDUBrAac6FBTbhJieDRUkJHBdSpxTom pTBVng2lwK9eVttCnypfaiazENTu2jm2HpSeuJPesOVuzVc3yo6mjT45ISKQdfwluyz4Gn/UBra Wt8D61m+DvT0uusQZ/ILOBpi1L8qbBkY/fcLQYbg== X-Gm-Gg: ASbGnctpqvQnYOORgCzAdMCo8NKPFMR8+lDJfb6NNkjLKsjQ4tfgfGaSteJWp+p5fdT j7rDu/pZyRBT1XNTIZjYtTl44b7CCNcZZIY77fhmjz80y6Y9TYK2dC/6665pInbz/mXao+lHEj4 2pb8Y7sSMIzCEcIn8GYZuCKt0W6ne4R1HvPs9v+sZJ5gPk6zIiwRRrleRzAtryBnU9LbWCHA8EM keMF17NmG3qZ+PeAdLPkyaOuyDrcZNhFLtLes9YjT7qHLZChODfdUvHZ8Eoui35eNV3+cEzGhZ/ j6t0XIQRHP0wVH86TdbYdm/gHFmwQO+R2JEON6YzKj/CTeC0XJbK/Q4nUjjzypegS9f7/Z4QQpn 4 X-Received: by 2002:ac8:7f14:0:b0:4ee:b2b:aa23 with SMTP id d75a77b69052e-4ee58801af5mr54219131cf.15.1763771232116; Fri, 21 Nov 2025 16:27:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOI/YTYGISscJwTlqQvpI+y94/nKvDemeAVm3XbDnRWVbMY+8mKndOHO3TN28aCWc6JFWtZg== X-Received: by 2002:ac8:7f14:0:b0:4ee:b2b:aa23 with SMTP id d75a77b69052e-4ee58801af5mr54218721cf.15.1763771231481; Fri, 21 Nov 2025 16:27:11 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , peterx@redhat.com, Juraj Marcin Subject: [PULL 9/9] tests/migration-test: Use MEM_TYPE_MEMFD for memory_backend Date: Fri, 21 Nov 2025 19:26:55 -0500 Message-ID: <20251122002656.687350-10-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251122002656.687350-1-peterx@redhat.com> References: <20251122002656.687350-1-peterx@redhat.com> 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1763776903693018900 Content-Type: text/plain; charset="utf-8" The only two users of memory_backend as of now (cpr-exec, cpr-transfer) uses memfd as backend, now we fully support it. We can move memory_backend usage to mem_type and drop it. Reviewed-by: Juraj Marcin Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251117223908.415965-5-peterx@redhat.com Signed-off-by: Peter Xu --- tests/qtest/migration/framework.h | 5 ----- tests/qtest/migration/cpr-tests.c | 6 ++---- tests/qtest/migration/framework.c | 10 +++------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 9dec21c344..ed85ed502d 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -134,11 +134,6 @@ typedef struct { bool suspend_me; /* enable OOB QMP capability */ bool oob; - /* - * Format string for the main memory backend, containing one %s where = the - * size is plugged in. If omitted, "-m %s" is used. - */ - const char *memory_backend; =20 /* Do not connect to target monitor and qtest sockets in qtest_init */ bool defer_target_connect; diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 70f8e69633..2a186c6f35 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -89,8 +89,7 @@ static void test_mode_transfer_common(bool incoming_defer) .start.opts_source =3D opts, .start.opts_target =3D opts_target, .start.defer_target_connect =3D true, - .start.memory_backend =3D "-object memory-backend-memfd,id=3Dpc.ra= m,size=3D%s" - " -machine memory-backend=3Dpc.ram", + .start.mem_type =3D MEM_TYPE_MEMFD, .listen_uri =3D incoming_defer ? "defer" : uri, .connect_channels =3D connect_channels, .cpr_channel =3D cpr_channel, @@ -235,8 +234,7 @@ static void test_mode_exec(void) MigrateCommon args =3D { .start.only_source =3D true, .start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults", - .start.memory_backend =3D "-object memory-backend-memfd,id=3Dpc.ra= m,size=3D%s" - " -machine memory-backend=3Dpc.ram", + .start.mem_type =3D MEM_TYPE_MEMFD, .connect_uri =3D uri, .listen_uri =3D listen_uri, .start_hook =3D test_mode_exec_start, diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 1c662f86a9..e35839c95f 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -366,13 +366,9 @@ int migrate_args(char **from, char **to, const char *u= ri, MigrateStart *args) ignore_stderr =3D ""; } =20 - if (args->memory_backend) { - memory_backend =3D g_strdup_printf(args->memory_backend, memory_si= ze); - } else { - mem_object =3D migrate_mem_type_get_opts(args->mem_type, memory_si= ze); - memory_backend =3D g_strdup_printf("-machine memory-backend=3D%s %= s", - MIG_MEM_ID, mem_object); - } + mem_object =3D migrate_mem_type_get_opts(args->mem_type, memory_size); + memory_backend =3D g_strdup_printf("-machine memory-backend=3D%s %s", + MIG_MEM_ID, mem_object); =20 if (args->use_dirty_ring) { kvm_opts =3D ",dirty-ring-size=3D4096"; --=20 2.50.1