From nobody Mon Feb 9 00:26:18 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=1766500237; cv=none; d=zohomail.com; s=zohoarc; b=DM4kuaUIJ+0UMt6CFBAI7iRsM2TNedVLSBsFTInNBFC95eEDocFYZB2tdwISn2I9+sRcPq8JefPO9/gQivpjGPApq01IWfSuxnZ0z7z6V0FdMv/By04o481n+m4S7Q8Pm29GTaXov+xdPDrMKeAdqwk9JS4GR/ntCccGR982qmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500237; 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=jb1DUlJQ4GnVRgU92F0kkwFwuzusrXZvVQZu8EFnPos=; b=iyC3ZaG1Rt7XRMes9RAtECIKJ4wjUWekClwqy90IeL648e4u2oMUsHcqzxWlJrWAro/ex/2F73SRxA6rm0plUkADsD5emvCH63fkOsUdrOEJExRGG2Zo2NHh51ePQcKTB53tXPqXOZLBVRFB4k/XfTN/smKBiM/zV22UUzdJMUM= 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 1766500237873244.675511021445; Tue, 23 Dec 2025 06:30:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Ow-00010V-3y; Tue, 23 Dec 2025 09:30:14 -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 1vY3Oq-0000wj-Go for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:09 -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 1vY3Oo-0003es-MJ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:08 -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-140-7xJv2OJNNlOmoPkyeTTX3A-1; Tue, 23 Dec 2025 09:30:04 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b1d8f56e24so1259095285a.2 for ; Tue, 23 Dec 2025 06:30:04 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500206; 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=jb1DUlJQ4GnVRgU92F0kkwFwuzusrXZvVQZu8EFnPos=; b=fWU9YobwqO6QyZQcrYpc30R2GoK8XiZD+Y5deo91jsFVZadYLdlId6t/9jvV5/hLL+f4sE Lf8eqRsBXvgKs9WDI+uPnkcBvBhP6OHLhHkCa9hXZtyiuALGN9H7zFin2oYU1+V/Hv3xCq pGlhl04pXyFjOvbvEWCyXJBCi0cyE+w= X-MC-Unique: 7xJv2OJNNlOmoPkyeTTX3A-1 X-Mimecast-MFC-AGG-ID: 7xJv2OJNNlOmoPkyeTTX3A_1766500204 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500204; x=1767105004; 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=jb1DUlJQ4GnVRgU92F0kkwFwuzusrXZvVQZu8EFnPos=; b=tn/gz5ce2nntUSgXaR788+4zPcHhcKrxcms2nfYJMyi5P0rFE/I3r/oLZJk5VDnRl/ o+MBRzANzdwD6FAeIUy0PxklpKU1naS+CsIM+o2e1Oa4PLIFHGq+PYTDxXOI36fWIqbD 7RjeznKO11Uxgolt/m/SQCQnx3+i8zOrbnLY3wOzh6/YXew9IgRN87HQPw9EYg2E20iP lrwtLsIjGVyI1LdbbW2VsgPGCRw532zo2zdJZF0UpG6Iz7aip3/TcDWLSKTbv+8n5GNz NsgE1cqPxYgQjs+4rC6Qdcv2Z/xJaoCREGwI23NJGIVf6ENC0hbefxgOEQ8MNde4Oial lXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500204; x=1767105004; 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=jb1DUlJQ4GnVRgU92F0kkwFwuzusrXZvVQZu8EFnPos=; b=egA4aEFZ1DVuqzFX6Ziyd71KCyK9MwoPHu57vv1Mz7t9pfPwSA2aUh8ag4znmu9XQh KQ+Wli/iHG+ntKDkbkccVKelbPppSlvnUVbcoD+6W5Jzu2pyfj26tsqKi8584qMbrz/n J4CVQpXNCMmztLBx9hjHye5J8Nhm2vLyizOYUOsDSd/ZAR7Sn5RmRwDgQ7CA8HTC7oxS wf2OvGx2/JKWVQ9kLxNsyqoFDIZxsShQdS3YMt23HqZIE51/4x9TYGLb+3thDX3cKILJ 3CAgOOazyRK4ZRbIVn6mgIxxBpEa0V00aZK0FIKjegPdI0huMOIDrzUu5oVnsTa+3xfH K56g== X-Gm-Message-State: AOJu0YzKTzH01ZoZ/T3VpNo1rbiEcBZLmfdinE7UToezX6C2CS+3gqfY 73VA/UUcVhER5qFKC6Xdpq0aZYWMuX6Ow1TvyZ3LiDCdyRckKSioqEqKLOv4qwsU9DR2H00c/qr 1c8Z1hArtIgY1mi8TIkilmymt0bQwkZzLLy7+vFrestI19+eeVtOd0FiAywfa73j7tMVgTYaVMT 8VxBWSeLaHrEIxwCR09MFE0GCD+TFWz6p/InFIOA== X-Gm-Gg: AY/fxX5wOvhxSP9TuiaXbtlucbg0c45tjJDnO/lWzMQIag6Gx9B3oK2xp+GWUBY2X3A F5m7KzfuGsIKLPSZU0dFB13hwLFoNWvQU+pEcMPzPwlCoDE5LPhyfTZ8DsXZhRsDj9mH+7CKt8W wCaP9UNB0HTNleL2tIGu1+eeeaI9tdeoJAiDKwm5ZZ80psbzJ5QfdcZxKrDS5LSvPIEeJd2Efa3 wb8s9xCDCHKBoZANsbw9le0rydH174TlIjwbV4en3RxpkRaeTsWGrzjm0kdinK4tDLQ1Mfo66Fx gRgu9VOjokGZO+Nsp/yt7iLBKiF94c0pnh5ad03OyBSzzOg4J31ySTXv2z1B/l4F8p1RUhaCLEO 6EbE= X-Received: by 2002:a05:620a:4626:b0:8bb:9f02:489e with SMTP id af79cd13be357-8c08fac0621mr2252342985a.74.1766500203545; Tue, 23 Dec 2025 06:30:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlY3WGyuGEN0JcEoitTu8cUBQeAHdLH0s8twOu8NBJn0aFFmrJeDm+/j3O+eJ+Pd+QVgpviQ== X-Received: by 2002:a05:620a:4626:b0:8bb:9f02:489e with SMTP id af79cd13be357-8c08fac0621mr2252337885a.74.1766500202980; Tue, 23 Dec 2025 06:30:02 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Pawel Zmarzly Subject: [PULL 01/31] migration: fix parsing snapshots with x-ignore-shared flag Date: Tue, 23 Dec 2025 09:29:29 -0500 Message-ID: <20251223142959.1460293-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500238424158500 Content-Type: text/plain; charset="utf-8" From: Pawel Zmarzly Snapshots made with mapped-ram and x-ignore-shared flags are not parsed properly. The ignore-shared feature adds and extra field in the stream, which needs to be consumed on the destination side. Even though mapped-ram has a fixed header format, the ignore-shared is part of the "generic" stream infomation so the mapped-ram code is currently skipping that be64 read which incorrectly offsets every subsequent read from the stream. The current ignore-shared handling can simply be moved earlier in the code to encompass mapped-ram as well since the ignore-shared doubleword is the first one read when parsing the ramblock section of the stream. Co-authored-by: Peter Xu Signed-off-by: Pawel Zmarzly Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251126121233.542473-1-pzmarzly0@gmail.com [peterx: enhance commit log per fabiano] Signed-off-by: Peter Xu --- migration/ram.c | 21 +++++++++++---------- tests/qtest/migration/file-tests.c | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 29f016cb25..7d024b88b5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4205,6 +4205,17 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *blo= ck, ram_addr_t length) =20 assert(block); =20 + if (migrate_ignore_shared()) { + hwaddr addr =3D qemu_get_be64(f); + if (migrate_ram_is_ignored(block) && + block->mr->addr !=3D addr) { + error_report("Mismatched GPAs for block %s " + "%" PRId64 "!=3D %" PRId64, block->idstr, + (uint64_t)addr, (uint64_t)block->mr->addr); + return -EINVAL; + } + } + if (migrate_mapped_ram()) { parse_ramblock_mapped_ram(f, block, length, &local_err); if (local_err) { @@ -4244,16 +4255,6 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *blo= ck, ram_addr_t length) return -EINVAL; } } - if (migrate_ignore_shared()) { - hwaddr addr =3D qemu_get_be64(f); - if (migrate_ram_is_ignored(block) && - block->mr->addr !=3D addr) { - error_report("Mismatched GPAs for block %s " - "%" PRId64 "!=3D %" PRId64, block->idstr, - (uint64_t)addr, (uint64_t)block->mr->addr); - return -EINVAL; - } - } ret =3D rdma_block_notification_handle(f, block->idstr); if (ret < 0) { qemu_file_set_error(f, ret); diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index 4d78ce0855..c196a703ff 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -303,6 +303,22 @@ static void migration_test_add_file_smoke(MigrationTes= tEnv *env) test_multifd_file_mapped_ram_dio); } =20 +static void test_precopy_file_mapped_ram_ignore_shared(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, + FILE_TEST_FILENAME); + MigrateCommon args =3D { + .connect_uri =3D uri, + .listen_uri =3D "defer", + .start =3D { + .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, + .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, + }, + }; + + test_file_common(&args, true); +} + void migration_test_add_file(MigrationTestEnv *env) { tmpfs =3D env->tmpfs; @@ -329,6 +345,8 @@ void migration_test_add_file(MigrationTestEnv *env) =20 migration_test_add("/migration/multifd/file/mapped-ram", test_multifd_file_mapped_ram); + migration_test_add("/migration/multifd/file/mapped-ram/ignore-shared", + test_precopy_file_mapped_ram_ignore_shared); migration_test_add("/migration/multifd/file/mapped-ram/live", test_multifd_file_mapped_ram_live); =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500272; cv=none; d=zohomail.com; s=zohoarc; b=cBf8P2CdoBetW1xPimmxC6phHnUfqgvripkMldlLX71UZHUfczjPHG9TjI/fsvogFnmP4AjFNq9cHkJvkYFdGsfdvi//JFDrkK4OIk53TGOjTuHanK3CZVaOuw0qsjanxQy2XfoZRrIOkyIy7NBrtjJXRRJJtEmcgtfuopGrlCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500272; 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=m6hpb97ha9BDKzmXV2BV/SXg6Ol4/zd6/rmqQsh2gSY=; b=k9vql1Q3aueLkv3HFYiwsLsk1S3oeKcM0uDSqUIsGxZGk1oTk9ppAUOnD9xdsHCoVxHzTKv0CjlFOOklYfrHr2A8Yf4JLMHuC12xBAdFatEUqDmm4iGM0EHEBQKARU4yXvz72mxqiZHRggnUNfz9qOiriW2zQQA0Wm3pO5Hovdk= 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 1766500272825735.8182411200006; Tue, 23 Dec 2025 06:31:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3P1-00013E-Gu; Tue, 23 Dec 2025 09:30: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 1vY3Os-0000zu-C2 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:12 -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 1vY3Oq-0003g7-Jn for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:10 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-ige9DswiNJ-j0qibMweIDg-1; Tue, 23 Dec 2025 09:30:06 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b2e235d4d2so1801884785a.3 for ; Tue, 23 Dec 2025 06:30:06 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500208; 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=m6hpb97ha9BDKzmXV2BV/SXg6Ol4/zd6/rmqQsh2gSY=; b=ccXm9zcm7JvRVKBLVnWaYbysQWRbMGM7uBLwk5mV7Znwfk4RO97vjapTWcQCpAZJYVvafH AYVyUIVl+e6QPTGrshiXRp4J8J+JVY8pWJZad2ZIyG603if7U+XkZLoI+2fMo8dAvt78WZ 0VUDDinOTWawGRqMDoc0I6DfWRJhZpI= X-MC-Unique: ige9DswiNJ-j0qibMweIDg-1 X-Mimecast-MFC-AGG-ID: ige9DswiNJ-j0qibMweIDg_1766500206 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500206; x=1767105006; 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=m6hpb97ha9BDKzmXV2BV/SXg6Ol4/zd6/rmqQsh2gSY=; b=bHvLaNIrePeU47tlxfqam243hAgEde+VodImsyK4r0HISqRH77r9Uw7lGyQVz+Cfsy gcw+DMFigFvX7ExOE6lOkWk/FvhuIOaXxV01kIG55OsPyIGE1g8qMtD2sFCXeZ+9G+sF 28DIFoq22HOzWEFHQDWbYC6FZd5S99DSJ2eeyZLQsu3Iv+7ST1tKWT4R8HUStvpybGT1 Fe4dBVBGO33DCBg74fm/gDGGNutwU82WkkbNkaAwd0TtJjrg3jyRTHGedcMSvt0ViNU4 1+NpmmIR8SJ2Z0o5DOdFRqLnvWOTOwn4/xJ8qymzhSSERUIfQpDjPhW6XxlZ/fJ4Du6H FovA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500206; x=1767105006; 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=m6hpb97ha9BDKzmXV2BV/SXg6Ol4/zd6/rmqQsh2gSY=; b=QT1ZSKre5EGE6pQ7S2NKBX8S3TPMkiM0/rboSOGtAgwGtgiYKkRH+EHfYiZ8LH99Xw 2+OzeRGwZBzF+cVC47yBjV0rV7jt1gjQO+6vt55D7fBN85e4xU9Hm84z5g0a2DCOGvEU OroEe83mur3qBltLfCKKxTBjfScEjrn9f98nafZ0YGP3i2T7vix8ev03jdoTUEdpdK0j iPlIgsDGBI+ykcn4eHB6msZHAwr/HxsUfuztMZKPVLyzbLEDxQvKvjexyY9TJH98Csc3 UnjWVHmfAIpaZTZWDsw/WcXjChImIzOPRtRiRFu8DzHkeloLsDvS//CH4eAz0LDMs3r2 XIig== X-Gm-Message-State: AOJu0YyszYpl5r4pSvF49VdFQbwOCxdF2gDCRGKFW8eRowhhsW0NzLno VFTxXezWPGyCMwEK0Ff/nBE3ofozm3Ao2lUcSB16Wn3/CD3gxqL6FaBeIzZ4qqrSR44wchYhgtX 0i7ziB/LhCxNDFtAS2M06qeFCSteXDpff/o7j0upJ1ofrdJ1aYNhvIIq8WAYrwEiPnDEhSRY3lg KDn93UCllcj18xmFbgEO29FzVTTMgVDaPu6MK1eg== X-Gm-Gg: AY/fxX7d6hQ+6ZcypO/iUCb/MVlEVtQhWaKGLocWD0Z9TBFpHgcrMiKrioQcQfSfmRE NnIiWTNWbFaXTBhiJsGciiqQIY23HkHlLHrAA7/+KAXOS9WY3XbI99UMgpICQQxqMFTVzYwpeaJ CQasODZ6AkqqdjggPZcbBNQ/v+DeVz0/NEgh/fKOWMam5LGm9OnLesDmPVy3XHCOGF2pZpV7Qwf cRC0Hns9bz41Nhx8y87AYZ5tGKEf9LUsXns21DoJv2rFTL4vO6coXnL8pR2Bj0kaaQJ3URmrWjB OQasquID2QyL+VThsSCenWmgDSGqJokL6CUw17zVGlqsMJX1xMxz1r4DQWN8qtwS8ALdPGxtNyR N4iM= X-Received: by 2002:a05:620a:44d1:b0:8b4:ebbe:ae04 with SMTP id af79cd13be357-8c08f68238emr2309097485a.35.1766500205662; Tue, 23 Dec 2025 06:30:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1gyPA+Dqwxf1Sx8Ygw0cLwU0/W0AG5oyAxN+ibQHFwcJF8x0oRhXtvsHvurC761SYGg3x9Q== X-Received: by 2002:a05:620a:44d1:b0:8b4:ebbe:ae04 with SMTP id af79cd13be357-8c08f68238emr2309092885a.35.1766500204977; Tue, 23 Dec 2025 06:30:04 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Pawel Zmarzly Subject: [PULL 02/31] migration: Fix writing mapped_ram + ignore_shared snapshots Date: Tue, 23 Dec 2025 09:29:30 -0500 Message-ID: <20251223142959.1460293-3-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500274542158500 Content-Type: text/plain; charset="utf-8" From: Pawel Zmarzly Currently if you set these flags and have any shared memory object, saving a snapshot will fail with: Failed to write bitmap to file: Unable to write to file: Bad address We need to skip writing RAMBlocks that are backed by shared objects. Also, we should mark these RAMBlocks as skipped, so the snapshot format sta= ys readable to tools that later don't know QEMU's command line (for example scripts/analyze-migration.py). I used bitmap_offset=3D0 pages_offset=3D0 fo= r this. This minor change to snapshot format should be safe, as offset=3D0 should n= ot have ever been possible. Signed-off-by: Pawel Zmarzly Link: https://lore.kernel.org/r/20251126154734.940066-1-pzmarzly0@gmail.com Signed-off-by: Peter Xu --- migration/ram.c | 53 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7d024b88b5..117957da91 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3042,28 +3042,37 @@ static void mapped_ram_setup_ramblock(QEMUFile *fil= e, RAMBlock *block) header =3D g_new0(MappedRamHeader, 1); header_size =3D sizeof(MappedRamHeader); =20 - num_pages =3D block->used_length >> TARGET_PAGE_BITS; - bitmap_size =3D BITS_TO_LONGS(num_pages) * sizeof(unsigned long); - - /* - * Save the file offsets of where the bitmap and the pages should - * go as they are written at the end of migration and during the - * iterative phase, respectively. - */ - block->bitmap_offset =3D qemu_get_offset(file) + header_size; - block->pages_offset =3D ROUND_UP(block->bitmap_offset + - bitmap_size, - MAPPED_RAM_FILE_OFFSET_ALIGNMENT); - header->version =3D cpu_to_be32(MAPPED_RAM_HDR_VERSION); header->page_size =3D cpu_to_be64(TARGET_PAGE_SIZE); - header->bitmap_offset =3D cpu_to_be64(block->bitmap_offset); - header->pages_offset =3D cpu_to_be64(block->pages_offset); + + if (migrate_ram_is_ignored(block)) { + header->bitmap_offset =3D 0; + header->pages_offset =3D 0; + } else { + num_pages =3D block->used_length >> TARGET_PAGE_BITS; + bitmap_size =3D BITS_TO_LONGS(num_pages) * sizeof(unsigned long); + + /* + * Save the file offsets of where the bitmap and the pages should + * go as they are written at the end of migration and during the + * iterative phase, respectively. + */ + block->bitmap_offset =3D qemu_get_offset(file) + header_size; + block->pages_offset =3D ROUND_UP(block->bitmap_offset + + bitmap_size, + MAPPED_RAM_FILE_OFFSET_ALIGNMENT); + + header->bitmap_offset =3D cpu_to_be64(block->bitmap_offset); + header->pages_offset =3D cpu_to_be64(block->pages_offset); + } =20 qemu_put_buffer(file, (uint8_t *) header, header_size); =20 - /* prepare offset for next ramblock */ - qemu_set_offset(file, block->pages_offset + block->used_length, SEEK_S= ET); + if (!migrate_ram_is_ignored(block)) { + /* leave space for block data */ + qemu_set_offset(file, block->pages_offset + block->used_length, + SEEK_SET); + } } =20 static bool mapped_ram_read_header(QEMUFile *file, MappedRamHeader *header, @@ -3146,7 +3155,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque, = Error **errp) if (migrate_ignore_shared()) { qemu_put_be64(f, block->mr->addr); } - if (migrate_mapped_ram()) { mapped_ram_setup_ramblock(f, block); } @@ -3217,6 +3225,10 @@ static void ram_save_file_bmap(QEMUFile *f) RAMBlock *block; =20 RAMBLOCK_FOREACH_MIGRATABLE(block) { + if (migrate_ram_is_ignored(block)) { + continue; + } + long num_pages =3D block->used_length >> TARGET_PAGE_BITS; long bitmap_size =3D BITS_TO_LONGS(num_pages) * sizeof(unsigned lo= ng); =20 @@ -4162,6 +4174,11 @@ static void parse_ramblock_mapped_ram(QEMUFile *f, R= AMBlock *block, return; } =20 + if (migrate_ignore_shared() && + header.bitmap_offset =3D=3D 0 && header.pages_offset =3D=3D 0) { + return; + } + block->pages_offset =3D header.pages_offset; =20 /* --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500267; cv=none; d=zohomail.com; s=zohoarc; b=IDR14zIhlQcNNKhoNyncgfnbwyX1bBRSqXdKjkYNn6VfuMkPCxnescCl2jut7S4fBHbX+sNjlyeteqjBe3kMksf933JjuWwHYalAvggQHSM96tEn0YuVFCC5LhOUOSjZ4mHgErLxC7oW8lWOYg+FCIb7Ny8tCHvGIaVA3YBWd7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500267; 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=FJCxXjvbHoSTcTF3F7Cydt9isGH5zYxpLXCy6vGUHCo=; b=OOfBvR1EhNV7fPjSNeCylAYeuEsJPdisCkH4mYGs8MGeEAU32Y9uoYQujAJ1+ktQLU+Q/CHPPNfmMPVFcWxT7aGcw9P3eALRAa2SZ2mUL0covxRgMrqNTv1BlaUnNpCVscW8fiUe1LzY+Hsl9tPmaluw8yBcPHk/iDKfYCV/bew= 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 1766500267832582.694418142184; Tue, 23 Dec 2025 06:31:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3P3-00015O-Pp; Tue, 23 Dec 2025 09:30:23 -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 1vY3Oy-00011f-SC for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:18 -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 1vY3Ou-0003hV-OJ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:14 -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-456-JZooz3inNwyT0FTSHU8vgA-1; Tue, 23 Dec 2025 09:30:09 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8b2e41884a0so1308652985a.1 for ; Tue, 23 Dec 2025 06:30:09 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500212; 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=FJCxXjvbHoSTcTF3F7Cydt9isGH5zYxpLXCy6vGUHCo=; b=KQWm6EXku88ALOaQHYZ8FY5JzW6CkrRrZGPokZZCCv7OUynbu0MvIYl8PIURpDTy0Zw2lp fO2x1t/QcQBNYMEWMAChYqcbb0yrlFID7XhKBhylm3RTw670AQlbEj6w6cQfH/+68EOBjk rC/tDOzTMvdwZoXEAfuAsmtsQWzCnc4= X-MC-Unique: JZooz3inNwyT0FTSHU8vgA-1 X-Mimecast-MFC-AGG-ID: JZooz3inNwyT0FTSHU8vgA_1766500207 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500207; x=1767105007; 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=FJCxXjvbHoSTcTF3F7Cydt9isGH5zYxpLXCy6vGUHCo=; b=NtYnVkX4mGjl+oE8DHLacC7qm7qt0yownLVoMHM/r4O31TaRIog64RU3gsnxX0o5jY jEqKFyOF9CN/L88E7RZMrwtpRtwMzAW8jEpH8lNzhoTp3wa0pbcV0caL/+MrnOnKjEF4 nQWBxZ3ZsoXp3H2ZcwEbFiL/IbuEPDNenTIzCw9qlV0atohFbc2ec5VjSvaHu0JyQ7Td u1K7okLoDXuxZRTIsXWU1Bolg6gPitlJ3kDYn5ajBNjbPMis0L/qk2O9/iZsxo0f6dIr HiSq2O4FZkE+YbXlIhYpLHQ9oH2qhoIezUMc5rptoRA41QI5O6U016y39/TF1iScKE+Y ne/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500207; x=1767105007; 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=FJCxXjvbHoSTcTF3F7Cydt9isGH5zYxpLXCy6vGUHCo=; b=PWwcjv8Z5M4TdwN5b+cls5yRELGmgyml8XniHQ4r7Mb8fclR2PNBdmDY7jwAHMmwF1 gPLyccBmALtaeYla/aXq9NP064A8MUSjJ9CbLRH53zOGmacWtjGSwI/XrDcRvOj4DGC8 BFJYxFYDRWLElGmrBjtjeajukqUyDXIkDl+amBlQMFr2GCKEgJUWJcZH/AjVJS4otYA0 0CzJJfzFb9V8RJafUQ4GCFaLKGvkpFQu04HxmzM4bKjUHHK1zY8PUUjoTHiVKJla1iHt SDOnqD6xnExeXrAJ32GhTZEGe7wtJwaNpRuYPp1poqCQdPCVOwet8t/UVxtBrhB3aKeH bEoQ== X-Gm-Message-State: AOJu0YxQ4sTkemHG+wE2EtixGuXNbJNb7Mif9ZzA4LDELi3dSbgs8HWd Q7CpIp83CJfwgH95uQdQFfugVyZAqajf+ZnKBpldjXWoGYImVHxyR3sdejppwhpaiCec0epCDFF 1seQEJ7zVkX2692qk/a/ZgH0TUERyDB9yzldgARxjXkpsSadM1TqTwx55+COmSacwmMYITzRbpu bC/Yth8FTpp58hfBMnfLKWlBXuATt0tMCTdqQWOA== X-Gm-Gg: AY/fxX7UO5RW/8rmFZPr9p3Ho8ZxWFSsRfYjNR2SDT6mz2wG4zkhFk/QOjRJV5MXet7 oMlJMPuaNuea0Vq6WBSrI8KVD5cXkmON/58PsaYWsu/yX/2XosvOVYW+NEMdZ6MJdOYOYXwQYFw Qs1m7e5QLHGuS/n/kBgBWqbiup3l6u4epj/le4L+oinx05dLosZP73QZZ9td67Hb23rZO1XRs5W 5hDU81mf5Ms0LB0+sXpOlTYXN3NUEybp8R3jBKEY8Y1GwOEhi1YTjO5V7JL9uerCKDYiizc3j35 VXG9dogo1HW/efTyVUKkdkossb5pq9TEa/FiSrKKHzj9M7f0YfITcbraml3FSrEMrz/AZQLITwr L42I= X-Received: by 2002:a05:620a:1a0c:b0:8b1:d2f7:9586 with SMTP id af79cd13be357-8c08fd041c2mr2235942685a.64.1766500206756; Tue, 23 Dec 2025 06:30:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqkHqlu72dGz634+VKDjEnLMdTmYCEkAmDtAx6ikSCtQamyuNJQ3PEbStrQNd1XgeM3ltMLw== X-Received: by 2002:a05:620a:1a0c:b0:8b1:d2f7:9586 with SMTP id af79cd13be357-8c08fd041c2mr2235934785a.64.1766500206032; Tue, 23 Dec 2025 06:30:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Pawel Zmarzly Subject: [PULL 03/31] scripts/analyze-migration: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO Date: Tue, 23 Dec 2025 09:29:31 -0500 Message-ID: <20251223142959.1460293-4-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500268725158500 Content-Type: text/plain; charset="utf-8" From: Pawel Zmarzly It has been renamed on the C side a few years ago. In modern QEMU versions, fill_byte must be zero. Updating the Python script to make grepping and understanding the code easier. Signed-off-by: Pawel Zmarzly Link: https://lore.kernel.org/r/20251125173007.245607-1-pzmarzly0@gmail.com [peterx: fix over-long line] Signed-off-by: Peter Xu --- scripts/analyze-migration.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index 67631ac43e..a12ea9fc8f 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -107,7 +107,7 @@ def close(self): self.file.close() =20 class RamSection(object): - RAM_SAVE_FLAG_COMPRESS =3D 0x02 + RAM_SAVE_FLAG_ZERO =3D 0x02 RAM_SAVE_FLAG_MEM_SIZE =3D 0x04 RAM_SAVE_FLAG_PAGE =3D 0x08 RAM_SAVE_FLAG_EOS =3D 0x10 @@ -172,19 +172,16 @@ def read(self): mr_addr =3D self.file.read64() flags &=3D ~self.RAM_SAVE_FLAG_MEM_SIZE =20 - if flags & self.RAM_SAVE_FLAG_COMPRESS: + if flags & self.RAM_SAVE_FLAG_ZERO: if flags & self.RAM_SAVE_FLAG_CONTINUE: flags &=3D ~self.RAM_SAVE_FLAG_CONTINUE else: self.name =3D self.file.readstr() - fill_char =3D self.file.read8() - # The page in question is filled with fill_char now - if self.write_memory and fill_char !=3D 0: - self.files[self.name].seek(addr, os.SEEK_SET) - self.files[self.name].write(chr(fill_char) * self.TARG= ET_PAGE_SIZE) + _fill_char =3D self.file.read8() if self.dump_memory: - self.memory['%s (0x%016x)' % (self.name, addr)] =3D 'F= illed with 0x%02x' % fill_char - flags &=3D ~self.RAM_SAVE_FLAG_COMPRESS + self.memory['%s (0x%016x)' % + (self.name, addr)] =3D 'Filled with 0x00' + flags &=3D ~self.RAM_SAVE_FLAG_ZERO elif flags & self.RAM_SAVE_FLAG_PAGE: if flags & self.RAM_SAVE_FLAG_CONTINUE: flags &=3D ~self.RAM_SAVE_FLAG_CONTINUE --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500277; cv=none; d=zohomail.com; s=zohoarc; b=at1mWpMreCFaM5/W3bruBZ8L5RTxRzixnT7t3VExRhY3Y9IbmfQYHi2pVflOV42y5spxqI6IN6tJSUn8qYRh/Yqcuyd+77e/vrFMHzGWEuoLbK/+j5Pk+8O1C3w/dpgwogctmrcHG6xDvHHGpWmSAXix4tUFxinT36lpN9XOpKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500277; 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=A598UVmqzqXHgD15lHZQkjUxN1DyybTu+2VPcZiG4yU=; b=CpQ+EYyEoLnsm+GNC7/V6IqQeEFvU3w+lj6kmoTLGoqKyTR4Rwb4HvuPOMPw1LGJuGmOi5nO1GHbeuRtm/qyA1smlMLogkpleI3FvJVAUEbpz0WKGCG3F5gGlKeI9m01KAEHlAO1ijllvljPgWa73vMcoA0K6SIAEJAsftTn1lg= 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 1766500277589539.5552403057924; Tue, 23 Dec 2025 06:31:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3P3-00015C-GG; Tue, 23 Dec 2025 09:30:21 -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 1vY3Ou-00010p-Pg for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:14 -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 1vY3Os-0003gy-JT for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:12 -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-536-QcBuu-jwPw2Ve1QIFreh2g-1; Tue, 23 Dec 2025 09:30:08 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8bbe16e0a34so1182734485a.1 for ; Tue, 23 Dec 2025 06:30:08 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500209; 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=A598UVmqzqXHgD15lHZQkjUxN1DyybTu+2VPcZiG4yU=; b=P0zDYdzFBkkThTzWh9Zaf8BCAgPEXmxIkrqd0chJT4vVbteJ5KyPSUuhzUIVj/TZODwsmH R0jxo3N1ks4EYvr66eh/NblKcUsXjvRNdUyzrkVpk1Sg+Pczwr5FRumJreg7BCycV+die7 6EkT6aVgkhXP5uaWA5PEJSsWiP9qetg= X-MC-Unique: QcBuu-jwPw2Ve1QIFreh2g-1 X-Mimecast-MFC-AGG-ID: QcBuu-jwPw2Ve1QIFreh2g_1766500208 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500208; x=1767105008; 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=A598UVmqzqXHgD15lHZQkjUxN1DyybTu+2VPcZiG4yU=; b=VCxmQd47aIdt9FDDuC7rz8n8bmvl87Mz/joH1fkM7U/k7IGOMhIhhfdQnQ4NL6k/wl 0K3W3LJXgWLhcMU9utItvHzC0HMtqlpFjvVwofrxlbRFLsuilKlfTAXaMcpmIbkBQ2hT NO3IVkWW6SrFgLbHciNO6ONe6kVt2lakKS0yFiP+RegsK8x60yhs8u3qGf1sKa9DvGId K3DShZpacp+qqykVGI8QzYTWBORiYxPy0/l3ctABYadc2ZMQAAAGyRxL6mSA2FEyA14T xOURz0WCiTOiPVkDYPbTVdS/Wufu9CZha+eNBxX2DETTbcmntHGixyfp4CVPsYI0Yctr xLUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500208; x=1767105008; 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=A598UVmqzqXHgD15lHZQkjUxN1DyybTu+2VPcZiG4yU=; b=TMlyLsYABDfa1Lvg9kPwjzGYsDEbzpqvWEM4+QztZ6QoEcCsHfBy72shc+ZiXQ4RPn I5a537MiR2cAAOH8OViFnZcbZDW/piRTajlgOXWAs/B5YKgYcUX4X+niyJXNx6/oKc64 UYPLcdvtnWIA46iRaKs7bTnxgdE7xRNZJXz8vnYnoJIteXKSi9QyGr1QcvOznJjR72yb si14gl2FErdAcT/1b3i1/NKc9qIkTuRkDYzu9Ny9V08WGAT/dPSLrbTWrfQvk6qyi0e4 epV/QmWKRMjKxY2ImoRW+NDwzS59gyt/Davo025PsAxYxAQtF1xswDknHkWEhohRg8GD oXvA== X-Gm-Message-State: AOJu0YyawjJ+GafFOZuQGd0i5xuGWJFFCXhmcuO6rfoPgifg8O8DsG2X YOrcdx+LU8oWFzFMEAgyU8nqTOkmVLcZq/jyoQaziaIkl8dWVUBJlfhr3nvUVoMHX8pxn7X2RR2 G1qz7Fz2I3yO1PH3Bh+IlAq+1bFHkgz3rVkC8q2ViugZeK2XxW6spp2NLtKpgY3+KRD26A5kGa4 8pAeQnliJ6+1F+iB68LU25XkwAk6Cai308vQgmpQ== X-Gm-Gg: AY/fxX4lVQ2jEKQwct4lf8iECbzqCR2M7blMMHVntmpuYv0ljsC94fbIGt4cCzHOaNc BvUcb06v63kDtC4E0v2TzeX7Uc4ligvb205NTiWLddndV5vqUm6vqEagVJOtbO34i2B+eb0gafP t6t5vOJrda+jlQO6JWgvfVPwwMdb0UVkfTgzZi5EXWfEnK3UfBlAnrXIgkEfK3iG1HeC5qh4xuz 8pFSuzrJ8BkVZjvoUGOPPg/SLpewDDb76eAjKJk8fhpt3b620lwsEvdBqYKMagvy9jjANYR3WQu L3DP6ScYCu1tsjsYLPx6EdFuVdAujaDa7y/J59T8U3PvzAfJZ3hEP7KKuHvI/2x6NXz76bI4t/l Gslk= X-Received: by 2002:a05:620a:2945:b0:8a3:6c1f:31cb with SMTP id af79cd13be357-8c090029a91mr1954645585a.26.1766500207522; Tue, 23 Dec 2025 06:30:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAFH6TSdmN5RBehqX7dYZxmprB+98irmF/TR2qzTdacDSTD9zVbXSo99iDNPyE3lLh651l8A== X-Received: by 2002:a05:620a:2945:b0:8a3:6c1f:31cb with SMTP id af79cd13be357-8c090029a91mr1954641085a.26.1766500207007; Tue, 23 Dec 2025 06:30:07 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Pawel Zmarzly Subject: [PULL 04/31] scripts/analyze-migration: Support mapped-ram snapshot format Date: Tue, 23 Dec 2025 09:29:32 -0500 Message-ID: <20251223142959.1460293-5-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500278648158500 Content-Type: text/plain; charset="utf-8" From: Pawel Zmarzly The script has not been updated to read mapped-ram snapshots and is current= ly crashing when trying to read such a file. With this commit, it can now read a snapshot created with: (qemu) migrate_set_capability x-ignore-shared on (qemu) migrate_set_capability mapped-ram on (qemu) migrate -d file:vm.state Signed-off-by: Pawel Zmarzly Link: https://lore.kernel.org/r/20251126155015.941129-1-pzmarzly0@gmail.com [peterx: space fixes, introduce parseMappedRamBlob(), add comments, etc.] Signed-off-by: Peter Xu --- scripts/analyze-migration.py | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index a12ea9fc8f..e81deab8f9 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -19,6 +19,7 @@ =20 import json import os +import math import argparse import collections import struct @@ -127,6 +128,7 @@ def __init__(self, file, version_id, ramargs, section_k= ey): self.dump_memory =3D ramargs['dump_memory'] self.write_memory =3D ramargs['write_memory'] self.ignore_shared =3D ramargs['ignore_shared'] + self.mapped_ram =3D ramargs['mapped_ram'] self.sizeinfo =3D collections.OrderedDict() self.data =3D collections.OrderedDict() self.data['section sizes'] =3D self.sizeinfo @@ -146,6 +148,57 @@ def __str__(self): def getDict(self): return self.data =20 + def parseMappedRamBlob(self, len): + version =3D self.file.read32() + if version !=3D 1: + raise Exception("Unsupported MappedRamHeader version %s" % ver= sion) + + page_size =3D self.file.read64() + if page_size !=3D self.TARGET_PAGE_SIZE: + raise Exception("Page size mismatch in MappedRamHeader") + + bitmap_offset =3D self.file.read64() + pages_offset =3D self.file.read64() + + if self.ignore_shared and bitmap_offset =3D=3D 0 and pages_offset = =3D=3D 0: + # This is a shared ramblock, x-ignore-share must have been + # enabled, and mapped-ram didn't allocate bitmap or page blob + # for it. + return + + if self.dump_memory or self.write_memory: + num_pages =3D len // page_size + + self.file.seek(bitmap_offset, os.SEEK_SET) + bitmap_len =3D int(math.ceil(num_pages / 8)) + bitmap =3D self.file.readvar(size=3Dbitmap_len) + + self.file.seek(pages_offset, os.SEEK_SET) + for page_num in range(num_pages): + page_addr =3D page_num * page_size + + is_filled =3D (bitmap[page_num // 8] >> page_num % 8) & 1 + if is_filled: + data =3D self.file.readvar(size=3Dself.TARGET_PAGE_SIZ= E) + if self.write_memory: + self.files[self.name].seek(page_addr, os.SEEK_SET) + self.files[self.name].write(data) + if self.dump_memory: + hexdata =3D " ".join("{0:02x}".format(c) for c in = data) + self.memory['%s (0x%016x)' % + (self.name, page_addr)] =3D hexdata + else: + self.file.seek(self.TARGET_PAGE_SIZE, os.SEEK_CUR) + if self.write_memory: + self.files[self.name].seek(page_addr, os.SEEK_SET) + self.files[self.name].write( + b'\x00' * self.TARGET_PAGE_SIZE) + if self.dump_memory: + self.memory['%s (0x%016x)' % + (self.name, page_addr)] =3D 'Filled wi= th 0x00' + + self.file.seek(pages_offset + len, os.SEEK_SET) + def read(self): # Read all RAM sections while True: @@ -170,6 +223,8 @@ def read(self): self.files[self.name] =3D f if self.ignore_shared: mr_addr =3D self.file.read64() + if self.mapped_ram: + self.parseMappedRamBlob(len) flags &=3D ~self.RAM_SAVE_FLAG_MEM_SIZE =20 if flags & self.RAM_SAVE_FLAG_ZERO: @@ -660,6 +715,7 @@ def read(self, desc_only =3D False, dump_memory =3D Fal= se, ramargs['dump_memory'] =3D dump_memory ramargs['write_memory'] =3D write_memory ramargs['ignore_shared'] =3D False + ramargs['mapped_ram'] =3D False self.section_classes[('ram',0)][1] =3D ramargs =20 while True: @@ -671,6 +727,7 @@ def read(self, desc_only =3D False, dump_memory =3D Fal= se, section =3D ConfigurationSection(file, config_desc) section.read() ramargs['ignore_shared'] =3D section.has_capability('x-ign= ore-shared') + ramargs['mapped_ram'] =3D section.has_capability('mapped-r= am') elif section_type =3D=3D self.QEMU_VM_SECTION_START or section= _type =3D=3D self.QEMU_VM_SECTION_FULL: section_id =3D file.read32() name =3D file.readstr() --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500315; cv=none; d=zohomail.com; s=zohoarc; b=JohELL0+gqXNmKnGk3JQzbysyKAXom9oNPRBwHzSh5Elli1JVPjUSw9lC6PPAwc+vhpCJhKT2eSmsVsz/Hk3eQfnu7uZj1+qQH09iULXgTheoRmnTdusd5qoeh5cb88xrDCUJqn2fWtkN1NOaSKRGY0H7IJVd/ShxOSF1epcKeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500315; 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=TTDOiW/Wq0+UwfLB6nQCcn38uaqN2wIwa/NSTff1+GA=; b=RDHcNGknEfTd8qesXTIRLp/tcbdcCjyd/myviUmfCX7z3yzP+w0ztGh0KRFSBrVmU/cQRyG9iPZQwGy/z3DnkciwusM8QUKrFM1FsyOuVKk/DxOdUcDLRjTWVibR/TTj3KxVmPey11rXxiENwWkVRZQ6AkpLwoaG+txcLdzAXvo= 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 1766500315893396.88327435548035; Tue, 23 Dec 2025 06:31:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pr-0001iS-Gl; Tue, 23 Dec 2025 09:31:11 -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 1vY3Ow-00010u-44 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:14 -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 1vY3Ou-0003hJ-2z for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:13 -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-76-XSmmCwDXMA2eE8Q2D4O1Tg-1; Tue, 23 Dec 2025 09:30:09 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b2e19c8558so154710785a.2 for ; Tue, 23 Dec 2025 06:30:09 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500211; 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=TTDOiW/Wq0+UwfLB6nQCcn38uaqN2wIwa/NSTff1+GA=; b=IeJnGcnYBuDuiayGjSKK26CoFRszMF0O3blDJamF6HKD8T10je0hXeCCa93P/EqYu+P+N5 N3aPSZ9JcODM4uIryt3VeeNsh09UAmEWh4bQU2GlKTjWsFLpHe1Ezio/Q4kfFtJN/kU7X4 JVgiXrPEjOVn6ZpX1mq+XF9jUIQxP0w= X-MC-Unique: XSmmCwDXMA2eE8Q2D4O1Tg-1 X-Mimecast-MFC-AGG-ID: XSmmCwDXMA2eE8Q2D4O1Tg_1766500209 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500209; x=1767105009; 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=TTDOiW/Wq0+UwfLB6nQCcn38uaqN2wIwa/NSTff1+GA=; b=GDh3X7YCCSeTk5i60x9pB8KOQ6kcG2HX5+elUyo7ku/a9Il0ym7MTnF1CWnhnevH7B Oa1xXQs82ug+dcg8SChnf06Zik5t08G5CjEdKF5YHDnlF70P4oP+ZmtfEgAdrAUqUFT6 OWrZKHjQQfbOuOgnWt9Fd1tYBfO/OHvIn7bGAqlf1El8EkoGa6hIeLh25tBR30dHg3xX FyJv8oJiZGdbRqb4VKzQ4htD9NcSz6DGuCxlkCEkNy5UIXxVj6k63zEYFHfFlGNd8K5k grucCpYXzZb/zK8FnxKCg0e5nrESKQS8iR4wgd2KjhF7pR4RYdkJ02TThbOXo4aPpA+z WRMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500209; x=1767105009; 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=TTDOiW/Wq0+UwfLB6nQCcn38uaqN2wIwa/NSTff1+GA=; b=nurzGzYhGdMAhxbFHm56+vcTnFyXoP0MXcNi8lfE2V4rdeTe07LXrgeiUsrmqAh54s 4KzackgTZOWSn9Ia+RaSzoDNukcMI6aK6Ryr66c9Zt+C0LhfrqFHtOUqHj+lzHqQeiLp 9/mfR8ltWGdY+RFM/YqHm+x7Lpa4ixt8wA5D9arCs9Pzg4DbA3/9gEJQK0JFTOOMuWli TM4qWHrXUbA9f1DHFFNAL6yXfc9c5T2jTnxX0r8+b8PTOFIdhHMCn5mgwixZaeuj0DG0 KGpLdjGxLe4LZ6n0aAXcmPTTdEqnGroasPYr/ENUlxzW6ghEaazlUR8TjaS/sMNIiF6d jLoA== X-Gm-Message-State: AOJu0Yy87x7BnEd6p2e18Bi18yJwnwLi9dfEvgGfIkQaB0voxYYCtipi za/QrgP+w6ixIoSAXodvFBGMI/g3vlKSO+jCsHR1EnclcHiIKa0mS68wTi8QiRobt9jJFLvuw9X ZkTs+CcrdfMqQtK1lummP513g6AnpuC+SK+k9eX3aFEe2Zdv/0AJGQ1v508ux0J8Sfvtpiv//sZ dt9iZOIG+PQagwX2/fT8aezXrBiaEhNwq3wtuGuQ== X-Gm-Gg: AY/fxX6pUqjGCwfY8pUhJzcjPWlvOKW6KjaoxjGqpPYTDRqj3f6cMZ8LS35HGpqLARK dq8Duxfc1YMcojo5RRBYjovoyn12/dJKg0Dwx2HWOmGylkpybHu7V4k++eDuk0bItkrHN+FOPYy IH0cjbAlo+d6sSzV1mIucd9J1Xt44i9AGUEAcBZFc/VChViAO5zq4gcsu03PNTqzMQQhop2FpFP VcVbhe1/OISLnuQg0n0dfPRMXqgIfqdaWX4ZK/mC/JYiWjWzc5+C4/d+EAAlaJ3Vf9Nju9Mdow8 W6buPyL1BvfWpK9knVB6qgFq59NKEcqUxQ3r5+y5gFvRWEiCtbtmPZoBe2ylWbimnVOMNgsdB6i A+LE= X-Received: by 2002:a05:620a:294a:b0:8b3:c8ee:7240 with SMTP id af79cd13be357-8c08fc00b94mr2500177685a.5.1766500208979; Tue, 23 Dec 2025 06:30:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzV/VTqm5/++H2CUARLN9+xV4/hHr9kAxP1KKfkimPuz1hf0BDyCf+QmHJSiyn639yJivm+w== X-Received: by 2002:a05:620a:294a:b0:8b3:c8ee:7240 with SMTP id af79cd13be357-8c08fc00b94mr2500165785a.5.1766500208081; Tue, 23 Dec 2025 06:30:08 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 05/31] migration: Use explicit error_free() instead of g_autoptr Date: Tue, 23 Dec 2025 09:29:33 -0500 Message-ID: <20251223142959.1460293-6-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500316845158500 Content-Type: text/plain; charset="utf-8" There're only two use cases of g_autoptr to free Error objects in migration code paths. Due to the nature of how Error should be used (normally ownership will be passed over to Error APIs, like error_report_err), auto-free functions may be error prone on its own. The auto cleanup function was merged without proper review, as pointed out by Dan and Markus: https://lore.kernel.org/r/aSWSLMi6ZhTCS_p2@redhat.com Remove the two use cases so that we can remove the auto cleanup function, hence suggest to not use auto frees for Errors. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251201194510.1121221-2-peterx@redhat.com Signed-off-by: Peter Xu --- migration/multifd-device-state.c | 3 ++- migration/savevm.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/multifd-device-state.c b/migration/multifd-device-st= ate.c index fce64f00b0..db3239fef5 100644 --- a/migration/multifd-device-state.c +++ b/migration/multifd-device-state.c @@ -140,7 +140,7 @@ static void multifd_device_state_save_thread_data_free(= void *opaque) static int multifd_device_state_save_thread(void *opaque) { SaveCompletePrecopyThreadData *data =3D opaque; - g_autoptr(Error) local_err =3D NULL; + Error *local_err =3D NULL; =20 if (!data->hdlr(data, &local_err)) { MigrationState *s =3D migrate_get_current(); @@ -159,6 +159,7 @@ static int multifd_device_state_save_thread(void *opaqu= e) * return we end setting is purely arbitrary. */ migrate_set_error(s, local_err); + error_free(local_err); } =20 return 0; diff --git a/migration/savevm.c b/migration/savevm.c index 62cc2ce25c..638e9b364f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2823,7 +2823,7 @@ static int qemu_loadvm_load_thread(void *thread_opaqu= e) { struct LoadThreadData *data =3D thread_opaque; MigrationIncomingState *mis =3D migration_incoming_get_current(); - g_autoptr(Error) local_err =3D NULL; + Error *local_err =3D NULL; =20 if (!data->function(data->opaque, &mis->load_threads_abort, &local_err= )) { MigrationState *s =3D migrate_get_current(); @@ -2841,6 +2841,7 @@ static int qemu_loadvm_load_thread(void *thread_opaqu= e) * return we end setting is purely arbitrary. */ migrate_set_error(s, local_err); + error_free(local_err); } =20 return 0; --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500252; cv=none; d=zohomail.com; s=zohoarc; b=BN6O8UXgNIvDoZcRsarYKocePPhxX5x8YQXFWicD3vYsisILEqdbqJJcRKPhlAutpPsCNvmlG3J2ip8OLoqAToDYnvGtwywa6mLSlwksfHQvcNRAqlcpW975LDDFV0B6TaQtPbCKzJFuuwjc6E/QagVzFxzMvXzds7QfmAE4M1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500252; 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=r3s0hCxig61OePmENRwDLet9KpUs1bicj/o3FmE0RZU=; b=IJ6Ps2VcgeHjr8vxraYzDImIK+lE18xNyHyXkz9vHWfLx0OVmix2gkrkxId/ryLexIqTJtIkUbFRMhJuKNAgIGuUkMupJ+mtaWSFF9vnO40hB0Gz2aCgKwIL3C24GMuznQ0fFMHcIQ5bMn91dLo19X0ZT2oFLyHlJRCh42HiIRk= 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 1766500252041792.604065412161; Tue, 23 Dec 2025 06:30:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3P2-00013l-69; Tue, 23 Dec 2025 09:30: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 1vY3Oy-00011g-TF for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:18 -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 1vY3Ou-0003hZ-U2 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:15 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-UlXRO9o_NjeDQfCmoOWSMg-1; Tue, 23 Dec 2025 09:30:11 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b51db8ebd9so1570948385a.2 for ; Tue, 23 Dec 2025 06:30:10 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500212; 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=r3s0hCxig61OePmENRwDLet9KpUs1bicj/o3FmE0RZU=; b=WePxB67UUV7O37gCspaA3bsp1rUn0Tv9mBVglreVKPExJUb7oCKS8UDaqdeOr0qeG3Q+mF KNfmwDN3AzMk46UHQHmYVkUd1KiOnbf+HIlgIcGBNvE5IRNjZ/Qm5sSbVahEPT4IuwrehI VQ7ir8LRfXo5ywindcA7UgFLIEo69hM= X-MC-Unique: UlXRO9o_NjeDQfCmoOWSMg-1 X-Mimecast-MFC-AGG-ID: UlXRO9o_NjeDQfCmoOWSMg_1766500210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500210; x=1767105010; 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=r3s0hCxig61OePmENRwDLet9KpUs1bicj/o3FmE0RZU=; b=kh/Op9hDc7vzdf53Fit7JoOaPOSMLlWYYLRdv9Q/cMkj2LzYneKMDEAjkiKWSRi0tL bSTA/+eDUP0qDPu+Vjy5M4noJp8etT+qoVrtaZyURt69sxfnqwvbhzoPErLEAvHcqgMp Hl/dFZgIDP4MEIf2fpKTvi/vm9tDX81RzPqVVi535enNNQllJoGR3Appg8rAAadAuZP5 Ad5MPHFImOvV/olTYpw5B7yDIdYZ+TUz4grrf05TnUKj1SAHbRjAlOF5D5lI5oh4yuKT KcT1g5wOFNpEVa4DdZnCVq487b2bFOM6ty1FC8xhHCjmrsFWHpsNMWiHxTO+xHpd5Ghb hoIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500210; x=1767105010; 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=r3s0hCxig61OePmENRwDLet9KpUs1bicj/o3FmE0RZU=; b=kb3bDTzvTludDDkselOAR4tmLucEcpUhDPmUQRcUpwVcC+YunT59OgnW7eJ+XIsjyv S9ImB2bAwQIXRBsUrp4RPVOLdz6hYqnQsFA9qxhh11dC9VdJOs7ljY53KyrKxWHaUD6A g48iMrP9eaMt4XHKsAlVzZYVpXLXZ2stLYvnvCwyH5nG5BgMgy4f27n+p/q1P40HCAPx cDM6uFIxAS8IK40VOKd64EYS2/8iQVn1mi6EkkrWvC3nxsmyP1sr01MawCZkMHckd1Js Ih9huqDM8oAK1PSFWfwxHLV+NsmNV2hS9zh4Dwwg37QJt5rjYupB/Bs9B6TDXTAkJaJC DPgw== X-Gm-Message-State: AOJu0YxA6iG4gRYkGnuTlC1/0fgrezhZkjw6ghG9AG0GA0Je9l4thNqP yzfufk19LflVwre0zLU9ox2yo3howruje6/pCDV/vVZWK8NA/+qq2A/GSXYNKs6HQs/0zxudKUG RXByT2tl/4/pzNNeP3auTuX0GWXc5XUicDB9CEjpTCUa8gRbMAHz/sE8UEIG7HN9nbnv7KIq/V8 KPTf6A/H6kdGWLBIF4eAuByhjFkDY6dCr1A82qCg== X-Gm-Gg: AY/fxX7aUIe/gTRZQv7eQytFuI4/hJWnRXaYda4HDFYHcS9/5Rq+glMIlz663xfFakz PvsnWwuL6Q6+lU4iNJ0Emg7tLFgfs7zc5Dn8kXFu1059/3duydlxFql5AyHGIL0fYnSLqNImfRc MWXl6ESPZ9DQ6psFHyBIMdvRmU8NgFPYcDghM/aagbvfLGY5DBzSK9/N8jwzfJOu7zxB7lH6TAS WRK+jxVp6KOXWRBt6aFB2NWxLDUbnACHvDmot3B0v7IXCnM3SarpY63LCccjRED1Y9fbyUmIUmT XekgVO1B6tvkx+CkDzIkZxAeZ62IhjIDS53RTz1TMA+Eppc0xerD7NppAYUl2NSR0RFXdYEFqw4 aQ44= X-Received: by 2002:a05:620a:4626:b0:8b2:fa94:e48a with SMTP id af79cd13be357-8c08fa9c452mr2294549285a.52.1766500210029; Tue, 23 Dec 2025 06:30:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1jy2Eef/D8eLeGwgklqhf2osnaXpbMQsgbqwKkx1IctJIWEe7h2UzvbjpidNOuzmebAXJ4w== X-Received: by 2002:a05:620a:4626:b0:8b2:fa94:e48a with SMTP id af79cd13be357-8c08fa9c452mr2294539785a.52.1766500209375; Tue, 23 Dec 2025 06:30:09 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Maciej S. Szmigiero" , Markus Armbruster , "Maciej S. Szmigiero" Subject: [PULL 06/31] Revert "error: define g_autoptr() cleanup function for the Error type" Date: Tue, 23 Dec 2025 09:29:34 -0500 Message-ID: <20251223142959.1460293-7-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500255350158500 This reverts commit 18eb55546a54e443d94a4c49286348176ad4b00a. Due to the nature of how Error should be used (normally ownership will be passed over to Error APIs, like error_report_err), auto-free functions may be error prone on its own. The auto cleanup function was merged without proper review as pointed out by Dan and Markus: https://lore.kernel.org/r/aSWSLMi6ZhTCS_p2@redhat.com Cc: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Reviewed-by: Markus Armbruster Reviewed-by: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Link: https://lore.kernel.org/r/20251201194510.1121221-3-peterx@redhat.com Signed-off-by: Peter Xu --- include/qapi/error.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/qapi/error.h b/include/qapi/error.h index b16c6303f8..f3ce4a4a2d 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -437,8 +437,6 @@ Error *error_copy(const Error *err); */ void error_free(Error *err); =20 -G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free) - /* * Convenience function to assert that *@errp is set, then silently free i= t. */ --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500309; cv=none; d=zohomail.com; s=zohoarc; b=Rf4Ty0ulbt8dc7+y6Yz+lOU/1npS/cMo5CqeWDGHKrDP4YWuho7OtoLnliGjeABOTfnXOf4Pns3iAF8i2/jPdPPi2Dz/gRpZZQazy/39rrf83xA6RK7Js5BTjBzF7GwX+p/QBdbrZm0lXB82ntaxBp05HGSRvETaj1ASNKce9Y0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500309; 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=JehPj5TZr+uKMtkS/2KpWg/wrctBO/xMsTh7F8UK8JU=; b=JLWZzCWUPY6dG18k3RWVIZOKlCivc3bL2I8AX8raNqSluZTAZ+cBkADkjAXniP8T16M5mnj3pKll3zHOcxQbFL72Jw/rdLqGZ30q52wCNQxnmKcEtBtnLVK4t/f9SVzJ8Nmkybn/FF5cYQeyxdQ4arwV6nN/HJMI5zs3fmdGYCE= 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 1766500309798556.013344442744; Tue, 23 Dec 2025 06:31:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q0-0002Wa-DH; Tue, 23 Dec 2025 09:31: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 1vY3P6-00016E-Bk for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:32 -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 1vY3P3-0003kF-9f for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:23 -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-594-HCiS7govM1WKncJNfzHjbQ-1; Tue, 23 Dec 2025 09:30:12 -0500 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-88a2cc5b548so135124726d6.0 for ; Tue, 23 Dec 2025 06:30:12 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500220; 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=JehPj5TZr+uKMtkS/2KpWg/wrctBO/xMsTh7F8UK8JU=; b=bZ2PIlay9YvNKesL8JE6tDV09T46vjGXeqlQfBUV8w1GnwUcwzZeoGe+mYmEcYoTXyVj4l NAL3d+9dRYGkv9RuHRyeHIJAWPVtqSeHJRAMN9H5pVJDH+xomWJ9NNJzyDjvwFctwY9AXH 85t6j9rzK4RMac3wdTXkbWO8KajG/Ck= X-MC-Unique: HCiS7govM1WKncJNfzHjbQ-1 X-Mimecast-MFC-AGG-ID: HCiS7govM1WKncJNfzHjbQ_1766500212 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500212; x=1767105012; 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=JehPj5TZr+uKMtkS/2KpWg/wrctBO/xMsTh7F8UK8JU=; b=L+dZNoP4YavFZZByRTEy/WVfFvgRVyZHuH3IoYpLUef92pVDvaMTlSp5ZBrTxmGSKS BFAkx15rIiPaYphY0J9BYdVFAjunT4/+LgjNXaPaFHmBzIA3obq74yEEANX1izp4wVmh 94ta/N5PIaHvdzDkZhzssB+kwr3SrsCC4UGIb0chMniIZuk1pbrRf5XdBpGrgTlXSe+Q wKHG1ZZfDnamJ0nYZAkq/fa1lCFkwpFFevOxJ4+lXPDmyf1MrJNBz16x/QZGqltqMqjX DQ+f0Dn4VYmNtPkbbSVKt2lcDRnIQHAl2VV+fAF4bQjuriUjLSWo3SkzFb4UohDZIdex Emxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500212; x=1767105012; 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=JehPj5TZr+uKMtkS/2KpWg/wrctBO/xMsTh7F8UK8JU=; b=EQFLlpTdBFPTFXaQMd7aeG0RqZTHHAHnk0sw/jySkaHXmBhrddlKj6e6FJEcvs1gTP 3Kx56rmmI7i2vk2wDAIfjgQYjj/E3O9a3syhEj9Fd3Y9d4tFM8bYBsGPklphooYZB/7/ gwU/lUlFTwbnVOKjp11/3mTWRKg56r4SV3jyj8CT7tCdvHBtEsbTIvZv8rXojuAMXaqi c3JI2YkeMusy4RvO805gCYbEzDT7vRzWb+anrRFG6Xe7nBfMpgk/OfrKIIzgw1YRGMBD kXU6vyc2XsXSHvNXgHmcIaNYyM9gYpMHvhfs4GuTK/zBwLwQIFF273ADEpSUdh6ELE7o AWHg== X-Gm-Message-State: AOJu0YwRP6SfJ5OEZvVQWD6I8Zw2yGGVMQfH/qSf/q7z+J/0qvJWUdZR IwK04YBNak1cXtBzcUpzzxoU7uBK6IV71H2jh7OYmamYuL/YR8x/C3uRXDB2UX1dR8iQSH7Ia3Q +b/uwerNPUE23VfOlbYJrCtk0k8Gu4wKwqJKjOfUTu2FAnYk1Iar/GO7SYRjEGmxsO8bocXGTSp AY02onYQYBNDV8nsbppLOMi2h79z/SFyTWRny4XA== X-Gm-Gg: AY/fxX6FGf2d1oHl8XCQcMZWDJhavEFyS4ZXG/HYsCKmaE9UecPAOuACwDmc/4MRhI6 dIfqI9Yxmuv05KRIYLSHO5ByOy5gJBkHnVBowANIocTsHJFdel1DrNzZDVPDTe1ORujSYFPK7pb w47icYQnNBet9XPKP8xPWi3BaFmYkBrS3109bcpJhPXdbdPAVzHkrzqouUEtRKxtKzZ5ehX+Ctm tYBVZCDFRSnqVnvJfDuhiorDSQ6toysKT8aoCKYIbXj9F9IHnY1ZpQumLGQNPLCdseYcTthP0bG MSGW6rLnz8reEKGrQKPOkdZljD38oRXjtj4rOduA8qbcdVaZI3vPm5wHnOWQSi0zE9cNMs4yGLL Rn2Y= X-Received: by 2002:a0c:cd91:0:b0:88f:ce0b:a008 with SMTP id 6a1803df08f44-88fce0ba2dbmr93961016d6.3.1766500211748; Tue, 23 Dec 2025 06:30:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5ewQLS2t/3mdlpDnEEO3m7bTVgNdkSOJdCFVBTHu9OTrNNWEitDHiFqFBxvf7BkSoW1Pj8w== X-Received: by 2002:a0c:cd91:0:b0:88f:ce0b:a008 with SMTP id 6a1803df08f44-88fce0ba2dbmr93960276d6.3.1766500211198; Tue, 23 Dec 2025 06:30:11 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster , Peter Maydell , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 07/31] error: Poison g_autoptr(Error) to prevent its use Date: Tue, 23 Dec 2025 09:29:35 -0500 Message-ID: <20251223142959.1460293-8-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500310733158500 From: Markus Armbruster The previous commit reverted support for g_autoptr(Error). This one should stop it from coming back. Suggested-by: Peter Maydell Signed-off-by: Markus Armbruster Tested-by: C=C3=A9dric Le Goater Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/r/20251201194510.1121221-4-peterx@redhat.com Signed-off-by: Peter Xu --- include/qapi/error.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/qapi/error.h b/include/qapi/error.h index f3ce4a4a2d..2356b84bb3 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -437,6 +437,26 @@ Error *error_copy(const Error *err); */ void error_free(Error *err); =20 +/* + * Poison g_autoptr(Error) to prevent its use. + * + * Functions that report or propagate an error take ownership of the + * Error object. Explicit error_free() is needed when you handle an + * error in some other way. This is rare. + * + * g_autoptr(Error) would call error_free() automatically on return. + * To avoid a double-free, we'd have to manually clear the pointer + * every time we propagate or report. + * + * Thus, g_autoptr(Error) would make the rare case easier to get right + * (less prone to leaks), and the common case easier to get wrong + * (more prone to double-free). + */ +extern void +__attribute__((error("Do not use g_autoptr() to declare Error * variables"= ))) +error_free_poisoned(Error *err); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free_poisoned) + /* * Convenience function to assert that *@errp is set, then silently free i= t. */ --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500456; cv=none; d=zohomail.com; s=zohoarc; b=Ab24h0IsdGQ8w5sBn4EDeJKMkHqNIahVlTN0lpQ/EXm/3Jmfh3W39J0xDasV1zz7hFTPoTZuQYcKx9S5L/msc0WgSOHCELAMsBoA9ByaGtQ8hf0Atz+eBLOn7VYmxZgyYpuJz5wy10vUrLeEWiyJtmVDjwf6Wp+/ch7HX7BS0Sw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500456; 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=bfCJmm4Dm8wFO89mns7yUaE2hgJsbzVj37K2Drizgrg=; b=GNQb1QJesc5R2OmeRQrG3LfqSjSqVCguowUVtYC+gPktPpD/DLu+GKd2gdqOno7uFKaERsW+XbF6D1EcyWw1iYFjK3abdVENpIb7O1ynuUVXjNFxjnqIgBWhtYvg+DcDWukZwEmz+XJQhP4uikciOI5u9jmVWZRpiZUsIQXc8mM= 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 1766500456267152.43937738702402; Tue, 23 Dec 2025 06:34:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3PX-0001Eo-CE; Tue, 23 Dec 2025 09:30:59 -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 1vY3P1-00013L-GQ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:19 -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 1vY3Oy-0003il-Jz for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:19 -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-642-RKQAjzZ1OEiX08wQq68NiA-1; Tue, 23 Dec 2025 09:30:14 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b2194e266aso161327285a.3 for ; Tue, 23 Dec 2025 06:30:14 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500215; 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=bfCJmm4Dm8wFO89mns7yUaE2hgJsbzVj37K2Drizgrg=; b=Rmd6hy7iLEL9L71XX4t5EtJ34xSC3DydqI1XKI5sjTGRO4KJ43+8eJ5eFZFOpR//mJ5iRX nY+Emhof5F6eFc3QncCpUut2FDDmd4+YgWW4mlitHhGJXJS7PjnvGvo7PgU7AJ6I9Sbf8W 4taiCvXsojo37o6Tc96cu0xOD3cvg58= X-MC-Unique: RKQAjzZ1OEiX08wQq68NiA-1 X-Mimecast-MFC-AGG-ID: RKQAjzZ1OEiX08wQq68NiA_1766500213 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500213; x=1767105013; 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=bfCJmm4Dm8wFO89mns7yUaE2hgJsbzVj37K2Drizgrg=; b=nBbX/qWBHoYw5Ghxun7bc0bRDk87wzz2kSFLLDVKFBJgoxCIMuxbyuh8Cu8/h8IIja ryFdvYeML6RwG1fguXV/tpDax1hB2EjbTVv3XWRtSdknLN18P5MO2jEr+yEthWc3C/n2 DWnTRQmAYuNZla3GOaMb8StXtnE/4nOAE7Onht9K3wH0sS9g3F1bNtEm0zkL8nuthk2s Q5ebCJo+jhby8t3aFMdyKvXc5WjiDsRyNEnVYC4OqCF3Na/d6owArGEpGgvqGTrEy+19 OW2FDb/9SpXk/mkRNBlAmMH3WA/b+wQYTNq1mpGkfoqek1jWht7VvP+6brwE3W9u8gJr uulg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500213; x=1767105013; 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=bfCJmm4Dm8wFO89mns7yUaE2hgJsbzVj37K2Drizgrg=; b=YDG5NLo4d+xcHx/gDmN0rgfjaAjhosSQ4FlgmlI6WNNHaCX0Euwq4Y1qADnB1uUUc1 ozgcr7oOg0wrcON6mR+aDV3KdUX8wJjDHwDPTJOXkl7Cmdt3oNkZl0kHKgwREIMTHL5W wHI5tFLVdCbmbq0MPTUcmRnYh0Lvexr0w2zM0XL+g9Tg8//+hk5zYCKG1OG0Zs11nV+y rFG7zVMsQzblvXi9ECieb15le+RW3uF1X4B1pNdlh9xm2aQ2ISjJqEg+0/UCEOdWIJqh 8keQph3hv+w693hsDPMNcGp5UnsMQsx+qmxzIVyUVJv80x21djJcF7kozXaPSLE4d4eF hcHg== X-Gm-Message-State: AOJu0YyQdJfQOqhnwpWgXNGnxfRsRaaz3vppucOPtxsz5JOxl/h0MPqb tHTTKUvdmQPkHNFksEHdRtq7I/UKZDu2rTZoIBHd36IJD10HxwzY1QCB9KRJgBXbO7h4wRknC67 GQPx71UssktQB10kUgKNdX32ITGxSlxa5HfMo3Ve8qMBPoU/BZO9kQXJiAG/2Id0twSg2p8sonI p5LQPXxUZfnJLP2zMIevLuDO1mP8BuAc+FxjMzuA== X-Gm-Gg: AY/fxX4SAtT2XjQP9FykvR4CW58kXBRpJarrGgKQIDjDVEpa+E6xMhEdSbYiHKWklFP 90LlKmYKHdVwuBpBvdzv8K6y33aAIqBeAI0SOsujVWneXsvxia5mIaMUIMfllxAkcO5k8tBU/Lg lXgZ/UUtMAbYHk7P9+UFHYtAKLpeezdHoA9nkxDML/F4O9/sW+glXAzOM+0+df9QF18AbhdUWbM YAukEcyxU/T4kRvRA8rKOd+ww1vH/GVsYd06PexlvMvXQ+j4JePurJ+Dg++OZtQUetgPAFUhyi0 rRQlrHqvGl8szrmAzxw5H/eXgoWUArvYW2u1tMAF2AuMGpx6NSo4a+O3x/uOgpqWpKpOT8bM7DX AVgQ= X-Received: by 2002:a05:620a:1999:b0:8b2:6b9e:5383 with SMTP id af79cd13be357-8c0906fc98amr2253300185a.85.1766500212871; Tue, 23 Dec 2025 06:30:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdFn6wJ4gpkztUBl0Xabf/70KnCMV094a3701B8u0wX3N4KKg0ePQu4s+YpuFoarBQBZEOfQ== X-Received: by 2002:a05:620a:1999:b0:8b2:6b9e:5383 with SMTP id af79cd13be357-8c0906fc98amr2253289685a.85.1766500212220; Tue, 23 Dec 2025 06:30:12 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 08/31] migration: Make migration_connect_set_error() own the error Date: Tue, 23 Dec 2025 09:29:36 -0500 Message-ID: <20251223142959.1460293-9-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500457524158500 Content-Type: text/plain; charset="utf-8" Make migration_connect_set_error() take ownership of the error always. Paving way for making migrate_set_error() to take ownership. When at it, renaming it to migration_connect_error_propagate(), following Error API, to imply the Error object ownership transition. NOTE: this patch also makes migration_connect() to take ownership of the Error passed in. Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251201194510.1121221-5-peterx@redhat.com Signed-off-by: Peter Xu --- migration/channel.c | 1 - migration/migration.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 462cc183e1..92435fa7f7 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -95,7 +95,6 @@ void migration_channel_connect(MigrationState *s, } } migration_connect(s, error); - error_free(error); } =20 =20 diff --git a/migration/migration.c b/migration/migration.c index b316ee01ab..0ff8b31a88 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1575,7 +1575,7 @@ static void migrate_error_free(MigrationState *s) } } =20 -static void migration_connect_set_error(MigrationState *s, const Error *er= ror) +static void migration_connect_error_propagate(MigrationState *s, Error *er= ror) { MigrationStatus current =3D s->state; MigrationStatus next; @@ -1602,6 +1602,7 @@ static void migration_connect_set_error(MigrationStat= e *s, const Error *error) =20 migrate_set_state(&s->state, current, next); migrate_set_error(s, error); + error_free(error); } =20 void migration_cancel(void) @@ -2292,7 +2293,7 @@ void qmp_migrate(const char *uri, bool has_channels, =20 out: if (local_err) { - migration_connect_set_error(s, local_err); + migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); } } @@ -2337,7 +2338,7 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, if (!resume_requested) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); } - migration_connect_set_error(s, local_err); + migration_connect_error_propagate(s, error_copy(local_err)); error_propagate(errp, local_err); return; } @@ -4039,7 +4040,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) =20 s->expected_downtime =3D migrate_downtime_limit(); if (error_in) { - migration_connect_set_error(s, error_in); + migration_connect_error_propagate(s, error_in); if (resume) { /* * Don't do cleanup for resume if channel is invalid, but only= dump --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500297; cv=none; d=zohomail.com; s=zohoarc; b=hhAh1PoPlQuN41Gipo6GqTRfSA5SmJTbTfUspps1ZQVaPlT/SMkkVRVEK519m7oACVblf0rCT5k2zwGfuXhnzgp6b02ZaV9DQvYv7zCz7inVEcLlxQc/5JhtYrwouEDTkx2Ci6PEieafkFc8ekkAixVXZQcWE/TatYE/HbXTG2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500297; 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=Z7Ft85ngIjHj7BTolKwSSNwqwExgehqFdfkFkCzmeBU=; b=imsn0Z5ZWWIOEHC7eziwUSnsT61Io+zElHjRrX2ETYnJH6nSfcZBaJGbh+8aelK/NCDGUDvBoXKuxbqB1kO0Xy6QkSftVXnOcnW2ZpwM+QCPemIF1VN+WiULcPG9uwxc85yQiEC5KezlUmNyD69vdbu0PV/NgA1mAzl9kV71Kes= 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 1766500297616763.4815575443406; Tue, 23 Dec 2025 06:31:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pt-0001u7-KM; Tue, 23 Dec 2025 09:31:13 -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 1vY3P1-00013S-JZ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:19 -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 1vY3Oy-0003iu-Rx for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:19 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-pJuxy8c8O--VT1dEK9YHSw-1; Tue, 23 Dec 2025 09:30:14 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b2e41884a0so1308686485a.1 for ; Tue, 23 Dec 2025 06:30:14 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500216; 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=Z7Ft85ngIjHj7BTolKwSSNwqwExgehqFdfkFkCzmeBU=; b=EtB9TuuPqV0yS4ga29x9K8i+KE3o9YLJyTkdfvylH7esa2iKNAgnAITjHT+/U+ODV3Bh0y HzrdaT/+YEoe9c3eXTV1ABn+CuOxpV+PnlaSaIy8PM79uPWEk5YadfqJeLhaKfU78Cl+AM B9u4DCwl/1Hf6Z/N7BiBtlwsslIFNVc= X-MC-Unique: pJuxy8c8O--VT1dEK9YHSw-1 X-Mimecast-MFC-AGG-ID: pJuxy8c8O--VT1dEK9YHSw_1766500214 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500214; x=1767105014; 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=Z7Ft85ngIjHj7BTolKwSSNwqwExgehqFdfkFkCzmeBU=; b=p+NwmaBzxsj9uWYK+M7w+2HRw2cbtLqmIB4I+bIEq9+QW4XROI4Gh8OWzNWIKTkVtv 7CvzIQIK399JYzFvYXTpqpnUziUa/cCHwfR21M6OCogfF74tNYBWQ8NrjXwTR05CrVrA YrzrtuyNKAaz5Dv0vBCfe7Awi1HH94GkUTDoIq5s87NGZ/h8YDCynsgHb+pFh2Y/MhCO t0BZUMquBKGHAy9RxazHi57BnvHCexQCzuZeFSRtqqI7VI4NDoXfbAoVO7t48rFD2NKd iEQpih17byITtYlhbNpA3v12kt24SwMCjLA/aOMT8uvov034Uvtiw8d69dSlXXHbGB52 DJ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500214; x=1767105014; 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=Z7Ft85ngIjHj7BTolKwSSNwqwExgehqFdfkFkCzmeBU=; b=WTCpIH2AlwxZcYj1birQWtuSAD8C/0A39rRYmBNiPDtp075XKhJcMLrCmBQyOC8zRQ Z9XVCJ1cTBMLaOKWJ7A+eDl6eLicTLFaM37TjsKqapeOgUTJeo8lNyculpZmyjQuBACD +altygBRFNCboFccURwvOH11TEaGxPbbOCS16WLvILvevONgK/YV6NDkG15zi8Dp26R/ lq5zBaxFTvEsvq/jWw9+gavhShB1oT2HyK9UYJq82egdxL+Fiev5FA7nD9cqAOQxtjk7 hVXu73x2laX+R4NOLHWLlbz/qbH3m/7DkDqo8uKDHrcMcIpH81wc738BuSa9PqeqiR8L dK+A== X-Gm-Message-State: AOJu0YzJ5NxmYPzjzqeQt3sF+OzxqK9rgSqyZAOqdGX4B6N5AdGaJvpi oFm7vkHQrj38JTTF2dgR6I/KyyovkuBDVd6jnC9gD56LJDKkzO4rSU6n3+nj9O7+QiEAb2DGa9I 3ednCBr+pjkxZi7IReZZrYixi9Vvp+l2nGTqf7kYuLbBwjSR9r7OdGsxq7R0Q9+Lr9lrPkejBD+ aSpxKEi1UziBgaLRjKrYDycjGg3os+r6dtXkHPsw== X-Gm-Gg: AY/fxX4rta0KdCupw5xQhFMYOphZMJEQ5dsG5WJbBBEvhBgm/eaPkh8361IUReR+9Fw ybOAfb2OAHNK611dWAxASF4rPuYj1eiVZy3R88VlO1dBompScoZ/wRBxAAatsukVYOE0T+TLKHD EZwhDh+b+gRcq61KGYDxPuwXfp0Lpu8BFmp7wUc6UlhQCEnwZer28C+n7rPj4HpcpmN18imww+x 36lTVvQ236JLTr+MydSbDgo2ajDyf2bVtOJNln/yfaoH7pV7lF23dABi/VFd9GKS1Yc/Lbu0zRW obaSA6Fuo8Cu7TQRxrsgOxAwRS7aLKQW83tnRIn6HWRvVk75YBdlodMlkFWk6MtE1aLWZh6zdjD kcQ0= X-Received: by 2002:a05:620a:404d:b0:8b0:f04c:9f0f with SMTP id af79cd13be357-8c08fd03911mr2494151885a.63.1766500213974; Tue, 23 Dec 2025 06:30:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrxYtmNJGlCxe9xkOOTdk7a/mhL+td1G66SxoU4ex3OSiwVzzgDu1OCMaMzqUwYPvlvTs44g== X-Received: by 2002:a05:620a:404d:b0:8b0:f04c:9f0f with SMTP id af79cd13be357-8c08fd03911mr2494141485a.63.1766500213341; Tue, 23 Dec 2025 06:30:13 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 09/31] migration: Make multifd_send_set_error() own the error Date: Tue, 23 Dec 2025 09:29:37 -0500 Message-ID: <20251223142959.1460293-10-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500298732158500 Content-Type: text/plain; charset="utf-8" Make multifd_send_set_error() take ownership of the error always. Paving way for making migrate_set_error() to take ownership. When at it, rename it to multifd_send_error_propagate() to imply the ownership transition following Error API's naming style. Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251201194510.1121221-6-peterx@redhat.com Signed-off-by: Peter Xu --- migration/multifd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 3203dc98e1..651ea3d14b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -414,7 +414,7 @@ bool multifd_send(MultiFDSendData **send_data) } =20 /* Multifd send side hit an error; remember it and prepare to quit */ -static void multifd_send_set_error(Error *err) +static void multifd_send_error_propagate(Error *err) { /* * We don't want to exit each threads twice. Depending on where @@ -429,6 +429,7 @@ static void multifd_send_set_error(Error *err) if (err) { MigrationState *s =3D migrate_get_current(); migrate_set_error(s, err); + error_free(err); if (s->state =3D=3D MIGRATION_STATUS_SETUP || s->state =3D=3D MIGRATION_STATUS_PRE_SWITCHOVER || s->state =3D=3D MIGRATION_STATUS_DEVICE || @@ -777,9 +778,8 @@ out: if (ret) { assert(local_err); trace_multifd_send_error(p->id); - multifd_send_set_error(local_err); + multifd_send_error_propagate(local_err); multifd_send_kick_main(p); - error_free(local_err); } =20 rcu_unregister_thread(); @@ -901,14 +901,13 @@ out: } =20 trace_multifd_new_send_channel_async_error(p->id, local_err); - multifd_send_set_error(local_err); + multifd_send_error_propagate(local_err); /* * For error cases (TLS or non-TLS), IO channel is always freed here * rather than when cleanup multifd: since p->c is not set, multifd * cleanup code doesn't even know its existence. */ object_unref(OBJECT(ioc)); - error_free(local_err); } =20 static bool multifd_new_send_channel_create(gpointer opaque, Error **errp) --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500449; cv=none; d=zohomail.com; s=zohoarc; b=YRbQdfDICH2IV82ATMffRGdajRGIzzYnHWFR1kkULiILG6aVi17TeeK0rn54y6XQTmQ+HSyrEQxP2zwVYTcOdQYEpksCDuxmHcOFUVfy1NSHsz3sIGBVBno7uFTU0fIabdlVDwpfhAIQvJztHrNFmOiAZJlWyxb2Fo1KTyeK0cE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500449; 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=cEFBdIohS4062D+O/J++uj/ToEv6MawI3RRAwg3mQ+g=; b=R5CGtw0Sh5IZu/9S6GkpsND20fDEvkgjwpXkN6Lc48DWCrH/jykWqT4Ok3iQhipPqcWRp0LY6cyxOQAhqaKn/kd/b0YM9P1z6ATGOjoxQgfeDNlgJfPZM6xxSZxBq+VgX9l5YsVYW5TvxONp3k1Jt8mG7ekt5eWv6glqAwrMi2w= 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 1766500449354297.0999875086259; Tue, 23 Dec 2025 06:34:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pu-00024w-Qa; Tue, 23 Dec 2025 09:31: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 1vY3P2-000156-VU for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:21 -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 1vY3P0-0003jc-T4 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:20 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-542-abAEsoRcMpWc9fTLno0Yyw-1; Tue, 23 Dec 2025 09:30:16 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b22d590227so628686085a.1 for ; Tue, 23 Dec 2025 06:30:16 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500218; 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=cEFBdIohS4062D+O/J++uj/ToEv6MawI3RRAwg3mQ+g=; b=ce3dK+rUXqYi3sUAj8KJ7zGAdZT39mNMPjIvKBAs1UXleqiOwttNNl0E6jKLdeB8atv71d rDUdDLfg/M5WxLjKYmQqA27DJ2upsjLiKBYXWr1ccPIZJ5jN2TIlajG9hr+7Y6YOOVLUYH ApXionGBNEbO0Q/ECWUIsLYVaiTuyjk= X-MC-Unique: abAEsoRcMpWc9fTLno0Yyw-1 X-Mimecast-MFC-AGG-ID: abAEsoRcMpWc9fTLno0Yyw_1766500216 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500215; x=1767105015; 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=cEFBdIohS4062D+O/J++uj/ToEv6MawI3RRAwg3mQ+g=; b=seUqBs90/ZmFgY2bzSQpLvAXH++1PXZtT5uxKQQLrmmQtYQHpTVzdwMCIfD8uGwGeJ md/9sTUlgSt0PkpCsa7UpusLVXWj5my5DUIabY21yqY7ZXvM9D89R5MDyy1vwd1R0lV+ /eE3PiGNlkcVzhX0SxTHy++O7LMx9Q1iLRDfZx9DNrNvh1Q0t5acdlwXy3h90Q7mRnM4 ImOTMGbE2Z053uI+VE0b0fSvFUbl1n+Pams3fLyYAqgj4fYJYVfRABJPwM585TXmsDVr HAjTMLbEAI4LfYLyhSRPMBgZH5tWbLghtbgdcyXOqZXrtllv9LYVjnnRY3RemR6SZAKK P5/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500215; x=1767105015; 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=cEFBdIohS4062D+O/J++uj/ToEv6MawI3RRAwg3mQ+g=; b=stkSkfNyrL/SiL3b3CLniNKpSzyKFLTv0Z9MlDopMYzhhpT6PDYGwlQXlK6GXc+KwI 2Ot6Pd/NiUJ4U2wpwvoFR0q72KuRDsGdoYeXNQhR7rD5x/je5sjbtwvemwEQ6oOf8++w 6hIg9AGKIrAqKNZ2zH+niHv6tDK/N72kh0XhfjHIsESUwCjMbKdh5Whti53TyYveYaE0 UWtxB1RFC5f22YoDorfAQW+RTcO9jk1pjtAKoax8ROlDTZGPLhvkY/yR65pKx2cpv4Dp PH4Ee6IrAg4//xWoimWo4uYkdpzfydMl9JiY+Ae8rlRPIPfsVokSO4uaScmo9oTLeB2A 4isw== X-Gm-Message-State: AOJu0Yx8JdoFX4r6Eae4n9uByEwgfL2mHxtpyME8Ao2wbD6tfRNV/S2W k+TLXl19I+5xzWO3qBbgw5X5NeMDBHVdXAsNbGgNrEAvTAa9YOoKQ+56hYcCA8olqjDjcOJJ7CY r8xZZdbbSAYNnNzI4vy+JcgVAkPz7Tp7UWso+eFcVgmZ43c/j/DT9tkLQ2jucFGmaIAaLbESdhP LP7MchA37FBK5o9Dtuwu3HYcvAJ7FJE0T/Bae3Kw== X-Gm-Gg: AY/fxX7kfBddmPeXdETDtKanLHSguw0e7SCcCYweQNWYYyigmzBR3P46o6OC1pGNg/h 1o4sHlylGZYuKg8nV2HZaY0ir5JWYkG2z8a1uf32L5ewnN1DNnzl0PrgFdcc9zkMegSZ6IFb4Er +4Axbk0d0NhLc6fAZvwfiTud7xBx4Neb4hT4tTy86LKJBBJTHwbOhAbGX0Kk5Pk6nYvLVEDLbTy w4BI9kpHm1JZQsJCKyCDwNwrRBpEZDQzstl80a9L/PjnpvlW55y1+c41bT7w5vEc6TrfewUiZQR USiM9eW5ehBcbnuOFIbtaN4wjKW/B4+0PPWubu9zV49Ux6dArb+F+AbvyYSJ8/X46BJBiiXRXM1 9KF4= X-Received: by 2002:a05:620a:4149:b0:8b2:4b6:22d4 with SMTP id af79cd13be357-8c09002816emr2306246785a.84.1766500215194; Tue, 23 Dec 2025 06:30:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9zCst7YcBgDo7sAKqu/hFO3OAETyOpzVWg+oqVNLEzBIzmVXoSV5ED7/pGRXdXoknLsrupA== X-Received: by 2002:a05:620a:4149:b0:8b2:4b6:22d4 with SMTP id af79cd13be357-8c09002816emr2306234285a.84.1766500214441; Tue, 23 Dec 2025 06:30:14 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 10/31] migration: Make multifd_recv_terminate_threads() own the error Date: Tue, 23 Dec 2025 09:29:38 -0500 Message-ID: <20251223142959.1460293-11-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500451452158500 Content-Type: text/plain; charset="utf-8" Make multifd_recv_terminate_threads() take ownership of the error always. Paving way for making migrate_set_error() to take ownership. Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251201194510.1121221-7-peterx@redhat.com Signed-off-by: Peter Xu --- migration/multifd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 651ea3d14b..52e4d25857 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1068,6 +1068,7 @@ static void multifd_recv_terminate_threads(Error *err) if (err) { MigrationState *s =3D migrate_get_current(); migrate_set_error(s, err); + error_free(err); if (s->state =3D=3D MIGRATION_STATUS_SETUP || s->state =3D=3D MIGRATION_STATUS_ACTIVE) { migrate_set_state(&s->state, s->state, @@ -1434,7 +1435,6 @@ static void *multifd_recv_thread(void *opaque) =20 if (local_err) { multifd_recv_terminate_threads(local_err); - error_free(local_err); } =20 rcu_unregister_thread(); @@ -1535,7 +1535,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) if (use_packets) { id =3D multifd_recv_initial_packet(ioc, &local_err); if (id < 0) { - multifd_recv_terminate_threads(local_err); + multifd_recv_terminate_threads(error_copy(local_err)); error_propagate_prepend(errp, local_err, "failed to receive packet" " via multifd channel %d: ", @@ -1551,7 +1551,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error = **errp) if (p->c !=3D NULL) { error_setg(&local_err, "multifd: received id '%d' already setup'", id); - multifd_recv_terminate_threads(local_err); + multifd_recv_terminate_threads(error_copy(local_err)); error_propagate(errp, local_err); return; } --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500426; cv=none; d=zohomail.com; s=zohoarc; b=SZgZgl+Z6jEUPCMHRmE5z7Gmbr7SlMWkvsvowGfXfzUaT81k7VxkD6QJJS99qSfjjoV9ybzieoxa0CwnFA37k8QrWqFoSOiYNsKM8yn+Z0tJD8RHKulUyY7IaCxs8mSbDlPKRuzyyhxZWscW/9hlWfLUc5VMkPnj4Wzpud2WcfY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500426; 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=kmQKTS4RxbULYzKokjP4wuLqRecQ06kRVOLasrUMPN8=; b=Sityeoj37B4R1eY37Ox10YxeReMH8C6kofmnqvsIrzAU1yhAWGfpRurF/cOONT+K69AUP1t7iLQOoyRTbyTI80Yg8Nghgrp0FiLkzMKHV1hJnLF+zH29+9OQzhdEV7zujkrjxZVPH8MMUjlXJqPQPff6/aezHEP3H6F8bD23P3U= 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 1766500426451439.38788798800897; Tue, 23 Dec 2025 06:33:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pr-0001lN-NF; Tue, 23 Dec 2025 09:31:11 -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 1vY3P6-00016D-Ag for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:32 -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 1vY3P3-0003kT-2U for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:23 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-LRr1FgdPMPGsi6Qbe7CWKQ-1; Tue, 23 Dec 2025 09:30:18 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b2f0be2cf0so1789630285a.0 for ; Tue, 23 Dec 2025 06:30:18 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500220; 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=kmQKTS4RxbULYzKokjP4wuLqRecQ06kRVOLasrUMPN8=; b=QiYlzKON5/TepLrmNSoLrTPlSdn9tzfmeTbkn4hq6CMTZVgGK2HatBjxTH+bvXWF768VYm aMzHiyluVVeXScchdvXu0AQ8vSB7wpNIyJbPi22397D0+z6/t7Xy18ag7dy5g6MwxLCaRZ bNPjgCN/2i2sJ7Mrv5xXjJ+efOYtyuM= X-MC-Unique: LRr1FgdPMPGsi6Qbe7CWKQ-1 X-Mimecast-MFC-AGG-ID: LRr1FgdPMPGsi6Qbe7CWKQ_1766500218 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500217; x=1767105017; 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=kmQKTS4RxbULYzKokjP4wuLqRecQ06kRVOLasrUMPN8=; b=IQC5uroaERwWG4X9w2R2bYrL4w7z5UqWrJ/yjCnrNZfpDSccKFXJT6SBOsJt4czh6u MJZfODTQf/IQzVb4xjk07GnjbKWZJhn8WauArKHck3YJVav7LmuF1VvyzXRtpO+sHEOt h4QAluMOZvAhiX+QJbhh4ZlpaHPUrz/j3lToMeqilWBS2aQyRJjpDI8SFVIc/yPi//S2 JAaGRp5Izgrjg+QCoku6MUgHubhD5LpyqB7LOzIJT/tvJm0KTVQvFjYGzwKCIQbByUSq Z2TeyYK2PWeIouklq+07UD3XwmNzhBsySYVriRUiWZblh8L6YMmxdtr+bj7BuftjVLQ5 74lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500217; x=1767105017; 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=kmQKTS4RxbULYzKokjP4wuLqRecQ06kRVOLasrUMPN8=; b=N9dghieHtUCQ5CGrRZ6v4tAXq74OZpzv8heTuq1CSXqwSj/2T/z7/5NmW1NlyXa/yI lzCq1itOVSWZa2KYkZjdKqvtLlzG4ilxKaJBx7tcCvm1p0a1xC5eTzIV8IElWoX/gN+M qmleYKQqIT/tSMmDEWj4F/O3edN1aqNptCNXTk2FMeivcRKOVsyyJ1QdQAtrCgzzNj8G e6S5RTWua6ft4wg3dOaVLXPtTRmoCGcBsTyLV+tLoxRPUbhfMmLGQaxEnQ2tE8HOLRXj zk1WctmuNZRUzut7ERCrzPAG0Q1yd2sKT+d83TAa6MZFzVun3kywQLWo9z1BNwwU7339 8k5A== X-Gm-Message-State: AOJu0YwnU+2qlzN+huL9QG7HpYNL2xBtGkk1VnIT9+vYjRpi38aIihSS h6tRyZCpy9CPdPLwJoJt1w2sBovusXT2lRzUZud+qknm2ei6BqbkV9tj2gR6Quoae1Lt8EK4aFk rY5u2EajrVGlvNWhR18ICay6MchqVicBJeoMs+6vc9v8S2t5GU1lMXpQ1fG9rWTzY6qIZ/k8Q7S oBQjN7u5WDOgZZ7Gf6cl1mKL9zriMsE31HyCCVpQ== X-Gm-Gg: AY/fxX5fQcHM+blBzGgxFH3YHwX35QqoF3NWbRqkNUkfQDb9YJ/pYywMBq6fIyXlyfw nD/RPDI5Eo5MWUtEIbmempNQ2KI0cC0ZwLloWJVbkXs5QOrP0dyRHWwgDY7yubLunI0vN6QDTD6 ZWKUJvSk2XB+3mJdTU3Rt+W7b4TilPtu4DeAZwwGlkBWKV5EdUtbK9d3rigZl66GNKxx/qQpm+V Sn6Tgjfnpmn0OGl76WrB36nRcMj88z0qkU8rnxIvs9JSo4sRO2sD9I44U3pQdOtkc+9T8S2Bhes c0fzkLwr4rcOzPWwOau/LrTaFLM4Gueps6QzfqEAkD7oPsTxVru56qVDFw8CjY4E+/tyfzW85Er hDq8= X-Received: by 2002:a05:620a:1a0c:b0:8b2:e565:50b5 with SMTP id af79cd13be357-8c08fd03785mr2016594785a.60.1766500217176; Tue, 23 Dec 2025 06:30:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfqMkI1u8ajrkHquPRnsQRlB8duYpnaYMEmb+rOzjCbf0eHiw55aFLlKBbRw/fxdcCQgTl7Q== X-Received: by 2002:a05:620a:1a0c:b0:8b2:e565:50b5 with SMTP id af79cd13be357-8c08fd03785mr2016573585a.60.1766500215560; Tue, 23 Dec 2025 06:30:15 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 11/31] migration: Replace migrate_set_error() with migrate_error_propagate() Date: Tue, 23 Dec 2025 09:29:39 -0500 Message-ID: <20251223142959.1460293-12-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500429512158501 Content-Type: text/plain; charset="utf-8" migrate_set_error() currently doesn't take ownership of the error being passed in. It's not aligned with the error API and meanwhile it also makes most of the caller free the error explicitly. Change the API to take the ownership of the Error object instead. This should save a lot of error_copy() invocations. Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251201194510.1121221-8-peterx@redhat.com [peterx: break line for qemu_savevm_send_packaged, per markus] Signed-off-by: Peter Xu --- migration/migration.h | 2 +- migration/cpr-exec.c | 5 ++-- migration/migration.c | 44 +++++++++++++++----------------- migration/multifd-device-state.c | 5 +--- migration/multifd.c | 19 +++++++------- migration/postcopy-ram.c | 5 ++-- migration/ram.c | 4 +-- migration/savevm.c | 17 +++++------- 8 files changed, 44 insertions(+), 57 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 213b33fe6e..e4b4f25deb 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -525,7 +525,7 @@ void migration_incoming_process(void); =20 bool migration_has_all_channels(void); =20 -void migrate_set_error(MigrationState *s, const Error *error); +void migrate_error_propagate(MigrationState *s, Error *error); bool migrate_has_error(MigrationState *s); =20 void migration_connect(MigrationState *s, Error *error_in); diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index 0b8344a86f..da287d8031 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -158,8 +158,9 @@ static void cpr_exec_cb(void *opaque) =20 error_report_err(error_copy(err)); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); - migrate_set_error(s, err); - error_free(err); + + migrate_error_propagate(s, err); + /* We must reset the error because it'll be reused later */ err =3D NULL; =20 /* Note, we can go from state COMPLETED to FAILED */ diff --git a/migration/migration.c b/migration/migration.c index 0ff8b31a88..70813e5006 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -914,9 +914,7 @@ process_incoming_migration_co(void *opaque) fail: migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); - migrate_set_error(s, local_err); - error_free(local_err); - + migrate_error_propagate(s, local_err); migration_incoming_state_destroy(); =20 if (mis->exit_on_error) { @@ -1548,14 +1546,20 @@ static void migration_cleanup_bh(void *opaque) migration_cleanup(opaque); } =20 -void migrate_set_error(MigrationState *s, const Error *error) +/* + * Propagate the Error* object to migration core. The caller mustn't + * reference the error pointer after the function returned, because the + * Error* object might be freed. + */ +void migrate_error_propagate(MigrationState *s, Error *error) { QEMU_LOCK_GUARD(&s->error_mutex); - trace_migrate_error(error_get_pretty(error)); =20 if (!s->error) { - s->error =3D error_copy(error); + s->error =3D error; + } else { + error_free(error); } } =20 @@ -1601,8 +1605,7 @@ static void migration_connect_error_propagate(Migrati= onState *s, Error *error) } =20 migrate_set_state(&s->state, current, next); - migrate_set_error(s, error); - error_free(error); + migrate_error_propagate(s, error); } =20 void migration_cancel(void) @@ -2014,8 +2017,7 @@ void qmp_migrate_pause(Error **errp) =20 /* Tell the core migration that we're pausing */ error_setg(&error, "Postcopy migration is paused by the user"); - migrate_set_error(ms, error); - error_free(error); + migrate_error_propagate(ms, error); =20 qemu_mutex_lock(&ms->qemu_file_lock); if (ms->to_dst_file) { @@ -2647,8 +2649,7 @@ static void *source_return_path_thread(void *opaque) =20 out: if (err) { - migrate_set_error(ms, err); - error_free(err); + migrate_error_propagate(ms, err); trace_source_return_path_thread_bad_end(); } =20 @@ -3094,12 +3095,10 @@ static void migration_completion(MigrationState *s) =20 fail: if (qemu_file_get_error_obj(s->to_dst_file, &local_err)) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); } else if (ret) { error_setg_errno(&local_err, -ret, "Error in migration completion"= ); - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); } =20 if (s->state !=3D MIGRATION_STATUS_CANCELLING) { @@ -3326,8 +3325,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) } =20 if (local_error) { - migrate_set_error(s, local_error); - error_free(local_error); + migrate_error_propagate(s, local_error); } =20 if (state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE && ret) { @@ -3522,7 +3520,7 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) if (must_precopy <=3D s->threshold_size && can_switchover && qatomic_read(&s->start_postcopy)) { if (postcopy_start(s, &local_err)) { - migrate_set_error(s, local_err); + migrate_error_propagate(s, error_copy(local_err)); error_report_err(local_err); } return MIG_ITERATE_SKIP; @@ -3819,8 +3817,7 @@ static void *migration_thread(void *opaque) * devices to unplug. This to preserve migration state transitions. */ if (ret) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); goto out; @@ -3944,8 +3941,7 @@ static void *bg_migration_thread(void *opaque) * devices to unplug. This to preserve migration state transitions. */ if (ret) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); goto fail_setup; @@ -4127,7 +4123,7 @@ void migration_connect(MigrationState *s, Error *erro= r_in) return; =20 fail: - migrate_set_error(s, local_err); + migrate_error_propagate(s, error_copy(local_err)); if (s->state !=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); } diff --git a/migration/multifd-device-state.c b/migration/multifd-device-st= ate.c index db3239fef5..91d5d81556 100644 --- a/migration/multifd-device-state.c +++ b/migration/multifd-device-state.c @@ -143,8 +143,6 @@ static int multifd_device_state_save_thread(void *opaqu= e) Error *local_err =3D NULL; =20 if (!data->hdlr(data, &local_err)) { - MigrationState *s =3D migrate_get_current(); - /* * Can't call abort_device_state_save_threads() here since new * save threads could still be in process of being launched @@ -158,8 +156,7 @@ static int multifd_device_state_save_thread(void *opaqu= e) * In case of multiple save threads failing which thread error * return we end setting is purely arbitrary. */ - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(migrate_get_current(), local_err); } =20 return 0; diff --git a/migration/multifd.c b/migration/multifd.c index 52e4d25857..bf6da85af8 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -428,8 +428,9 @@ static void multifd_send_error_propagate(Error *err) =20 if (err) { MigrationState *s =3D migrate_get_current(); - migrate_set_error(s, err); - error_free(err); + + migrate_error_propagate(s, err); + if (s->state =3D=3D MIGRATION_STATUS_SETUP || s->state =3D=3D MIGRATION_STATUS_PRE_SWITCHOVER || s->state =3D=3D MIGRATION_STATUS_DEVICE || @@ -588,8 +589,7 @@ void multifd_send_shutdown(void) Error *local_err =3D NULL; =20 if (!multifd_send_cleanup_channel(p, &local_err)) { - migrate_set_error(migrate_get_current(), local_err); - error_free(local_err); + migrate_error_propagate(migrate_get_current(), local_err); } } =20 @@ -962,8 +962,7 @@ bool multifd_send_setup(void) p->write_flags =3D 0; =20 if (!multifd_new_send_channel_create(p, &local_err)) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); ret =3D -1; } } @@ -987,8 +986,7 @@ bool multifd_send_setup(void) =20 ret =3D multifd_send_state->ops->send_setup(p, &local_err); if (ret) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); goto err; } assert(p->iov); @@ -1067,8 +1065,9 @@ static void multifd_recv_terminate_threads(Error *err) =20 if (err) { MigrationState *s =3D migrate_get_current(); - migrate_set_error(s, err); - error_free(err); + + migrate_error_propagate(s, err); + if (s->state =3D=3D MIGRATION_STATUS_SETUP || s->state =3D=3D MIGRATION_STATUS_ACTIVE) { migrate_set_state(&s->state, s->state, diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 715ef021a9..3623ab9dab 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1928,8 +1928,7 @@ postcopy_preempt_send_channel_done(MigrationState *s, QIOChannel *ioc, Error *local_err) { if (local_err) { - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(s, local_err); } else { migration_ioc_register_yank(ioc); s->postcopy_qemufile_src =3D qemu_file_new_output(ioc); @@ -2163,7 +2162,7 @@ static void *postcopy_listen_thread(void *opaque) * exit depending on if postcopy-exit-on-error is true, but the * migration cannot be recovered. */ - migrate_set_error(migr, local_err); + migrate_error_propagate(migr, error_copy(local_err)); error_report_err(local_err); migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FA= ILED); goto out; diff --git a/migration/ram.c b/migration/ram.c index 117957da91..ecd81601e2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4748,9 +4748,7 @@ static void ram_mig_ram_block_resized(RAMBlockNotifie= r *n, void *host, * Abort and indicate a proper reason. */ error_setg(&err, "RAM block '%s' resized during precopy.", rb->ids= tr); - migrate_set_error(migrate_get_current(), err); - error_free(err); - + migrate_error_propagate(migrate_get_current(), err); migration_cancel(); } =20 diff --git a/migration/savevm.c b/migration/savevm.c index 638e9b364f..470c9ef0f7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1125,13 +1125,13 @@ void qemu_savevm_send_open_return_path(QEMUFile *f) int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len) { uint32_t tmp; - MigrationState *ms =3D migrate_get_current(); Error *local_err =3D NULL; =20 if (len > MAX_VM_CMD_PACKAGED_SIZE) { error_setg(&local_err, "%s: Unreasonably large packaged state: %zu= ", __func__, len); - migrate_set_error(ms, local_err); + migrate_error_propagate(migrate_get_current(), + error_copy(local_err)); error_report_err(local_err); return -1; } @@ -1373,7 +1373,7 @@ int qemu_savevm_state_setup(QEMUFile *f, Error **errp) if (se->vmsd && se->vmsd->early_setup) { ret =3D vmstate_save(f, se, vmdesc, errp); if (ret) { - migrate_set_error(ms, *errp); + migrate_error_propagate(ms, error_copy(*errp)); qemu_file_set_error(f, ret); break; } @@ -1681,7 +1681,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, =20 ret =3D vmstate_save(f, se, vmdesc, &local_err); if (ret) { - migrate_set_error(ms, local_err); + migrate_error_propagate(ms, error_copy(local_err)); error_report_err(local_err); qemu_file_set_error(f, ret); return ret; @@ -1858,7 +1858,6 @@ void qemu_savevm_live_state(QEMUFile *f) =20 int qemu_save_device_state(QEMUFile *f) { - MigrationState *ms =3D migrate_get_current(); Error *local_err =3D NULL; SaveStateEntry *se; =20 @@ -1876,7 +1875,8 @@ int qemu_save_device_state(QEMUFile *f) } ret =3D vmstate_save(f, se, NULL, &local_err); if (ret) { - migrate_set_error(ms, local_err); + migrate_error_propagate(migrate_get_current(), + error_copy(local_err)); error_report_err(local_err); return ret; } @@ -2826,8 +2826,6 @@ static int qemu_loadvm_load_thread(void *thread_opaqu= e) Error *local_err =3D NULL; =20 if (!data->function(data->opaque, &mis->load_threads_abort, &local_err= )) { - MigrationState *s =3D migrate_get_current(); - /* * Can't set load_threads_abort here since processing of main migr= ation * channel data could still be happening, resulting in launching o= f new @@ -2840,8 +2838,7 @@ static int qemu_loadvm_load_thread(void *thread_opaqu= e) * In case of multiple load threads failing which thread error * return we end setting is purely arbitrary. */ - migrate_set_error(s, local_err); - error_free(local_err); + migrate_error_propagate(migrate_get_current(), local_err); } =20 return 0; --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500430; cv=none; d=zohomail.com; s=zohoarc; b=YnxIfWtV64eco3PfILy1JYEl3pPKeBIkIgQDnbRvSVb8PLo5LEzTyKXc/ifDZ0nbjEQlaTxyIcI98pVngp7Q/jJvHe5Evu74E/YZ3qDLeq1uITI2o1YPsALCnQQjm4LrX11NkNmAZB8IMUUxw5v8uskBogEkzv67tgGMpBmJTkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500430; 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=3jI5kulKRQefdFP90vbsqSgk1iSh74hQlPxeDrABO+I=; b=K4vgNU/KycfEWttYqsFc7kAVAwITGRYR2uyyaW44SKNdJ5fzE4CVayADV3SJYCS6CMUb0pjMkyY5/RxNdGfw1LMXtkLMB60zLeR9qEKc2c52JRPFTUg4IGeE+0q1aRq5vleAIr76Q4Iq5NGlLFNzTmEYU+SYWBPL7ojpdS3Zunk= 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 1766500430972165.7897282011727; Tue, 23 Dec 2025 06:33:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Py-0002SS-GW; Tue, 23 Dec 2025 09:31:18 -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 1vY3P6-00016C-9Y for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:32 -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 1vY3P2-0003kD-UN for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:22 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-K8UldiytMQCo4iSWGBnA6g-1; Tue, 23 Dec 2025 09:30:18 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8bb3388703dso1752651385a.1 for ; Tue, 23 Dec 2025 06:30:18 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500220; 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=3jI5kulKRQefdFP90vbsqSgk1iSh74hQlPxeDrABO+I=; b=c1S1l1X7pwa2RS94Qgb1ORDy3qleUCWwx6mNsnzHl3segSqtFUAbOEohAxBLpnr6LnpxcH nfXKEPhxutIee9Nabzs7yK3d61BCR2UZ2kv4MtC3Xy1HnmEmfAjyHKV6YMRFwZih8crgZE RvIywpICCVO1PMXmqgdWOkoBbmi1BYE= X-MC-Unique: K8UldiytMQCo4iSWGBnA6g-1 X-Mimecast-MFC-AGG-ID: K8UldiytMQCo4iSWGBnA6g_1766500218 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500217; x=1767105017; 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=3jI5kulKRQefdFP90vbsqSgk1iSh74hQlPxeDrABO+I=; b=ccQf/qW/Op4RxKQt0GoZ5fmscG2cJdv2LHkaVzrSemCp3zyMp1aNws/SXfqdQlSQB1 xgPAc1klSdZIZT2q0rvxINMJkET2na1pvRdV7nNsxjEUQ0g0y73cdyMRcvcVkDimR5Xm SgJb3I974FYrkNP9cpo90lR6uYLTjztIgduuaRuRJGnixHL530rC5YhzPaIViL7Eg6WE uJms0rAPqVXYU0VhveI5P5+QUoTlDMbhQq3Ae1Wg2s7rJ9tuyGH8VHrJyzX2BLKaOYMo vKwXjIa588XbzrxvbSRVA9g6d/7r+MegWPv45aVgP7HnJ4weLMhFvzg2v1NzsBVMKNCF 2wOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500217; x=1767105017; 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=3jI5kulKRQefdFP90vbsqSgk1iSh74hQlPxeDrABO+I=; b=loRetHDCbx/1PwNTEWv/soHTg/yYfqh9JZI8hbja4T/lsZIr59aCZvXU4lpDnsLvHy F+wWyW+Itm6KEvXmvD/JolsuC0hCtgVi04GR3k5n6TsagTVnzAV+etvtuNOxoc/AqAhh tCrQ+IEdj/eb/gc8eGQw9VMBpdXr12cv/5PDm5zRDVpihy6N634eO0mgRVT0jBJCaplW WF28IOlU5FhiGC4VJPpvRXcsvLk5YO9FJD0V/UuPF9zyOLqeXTpgLDWGVu+UpwVFbA0i iyznrxJV1AClIdB/eNlnX+cSpJnbEFPt3aJPWNYcqKeUPrjtENgjzroG0tNL5Qy1B2uf nRbg== X-Gm-Message-State: AOJu0Yy6KmmCcAC7EsB0MXYlKPyyp1UaYzIfZxsTVamvkuMO/qe9ocjd gVsUbj459a9us1L6lxohtMuWm7cPdKtTlMzFKw60chVixAwwJk0G0V1Y2OCUyNRhqRqRbfdvGYp rNZQFw5AwjVuCrTu4C/hjj3FhkcLfoLGqFVbL0Ic27iDdJINsyjT4leXg0T+RCeV2duwVyRcsmH M6x4K6D5wgLgvuEIhKRqMMjbcYbVuof39iY/f6Sg== X-Gm-Gg: AY/fxX6/RKHEbogRBpt+oIja/Zw+HYiebYYEKt54L7clzYM8Tccelw4TyvvQVUU0Vf1 RTVyR+r8WJ3jF1Dm/mb0qtyvtgzmw609uHK2xVvA8qMGCwgDKEOMrRCgR2aKrNzgxaM1dyjaC0B 8uGmd58i3wAX7PJGHcdhkb3RaC4Pg2g7TpJCJMeJjcLzz1sfeWE6GahOn+mjNeByDns3d8TxoTa CRvOb6VGs8fBLueEYki+rqP99S1M46JYyRuJdvAfCZUmmHnVBKwPoziSDsDHa2BFMvIQztKOB1o ahTIFv7DL7Yg8on9jkFJTuUa4yRGM6fG1StjduOwaRLPiCh0suX44iMUlmy3AfcCi9To6ZNLkMd 00x0= X-Received: by 2002:a05:620a:2682:b0:8b1:1585:2252 with SMTP id af79cd13be357-8c08f6568b5mr2019578385a.1.1766500217302; Tue, 23 Dec 2025 06:30:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFz9k7yYeGnwI0plGbCQuTKEQuG3wqcKpZoLXfOyrJYBGh+FGc/9ud9bvREuj3ePfui4Ze/Ug== X-Received: by 2002:a05:620a:2682:b0:8b1:1585:2252 with SMTP id af79cd13be357-8c08f6568b5mr2019568285a.1.1766500216576; Tue, 23 Dec 2025 06:30:16 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 12/31] migration: Use error_propagate() in migrate_error_propagate() Date: Tue, 23 Dec 2025 09:29:40 -0500 Message-ID: <20251223142959.1460293-13-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500431338158500 Content-Type: text/plain; charset="utf-8" It improves readability, as suggested by Markus. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251202175317.1186544-1-peterx@redhat.com Signed-off-by: Peter Xu --- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 70813e5006..d55fde222a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1555,12 +1555,7 @@ void migrate_error_propagate(MigrationState *s, Erro= r *error) { QEMU_LOCK_GUARD(&s->error_mutex); trace_migrate_error(error_get_pretty(error)); - - if (!s->error) { - s->error =3D error; - } else { - error_free(error); - } + error_propagate(&s->error, error); } =20 bool migrate_has_error(MigrationState *s) --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500449; cv=none; d=zohomail.com; s=zohoarc; b=NxTOcUYMhLZZ8IZQTmldi8/2/nj+5rTozCOmGnoVBJxlwjiRr/Hdza+lELTXwtNetqcIBlAg9isWnRv/7NfrtNyNmOMG8pOhqy7WtEdIzKYJsPx+fYqzXudMbUKGgwFCQpNyaRI0g3GA06uoNSoVwx8GPJSeL/Gs2TSvAMjdC6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500449; 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=JqwNvMrsGtX06aW/fAOs3pT2SsT5wFnHsxM699N92Tk=; b=Rkv8gDyzCGESAOXUmXMryT0Msd8dyxNmF2yxbkILT2P1f9f4YCANejmKc6CrjXYmHMeWgdSCNoZlj4x2nlW85BoFcoy05uZMLcujbRUAt2EXfe9BkiyhRiSladANGD8K9rmd0mDFWI1FtpnTCAdwn1OTgdM0njV8TiURRcjWskM= 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 1766500449350745.8399502277865; Tue, 23 Dec 2025 06:34:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pw-0002FX-8M; Tue, 23 Dec 2025 09:31:16 -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 1vY3P6-00016F-Bx for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:32 -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 1vY3P3-0003kf-9h for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:23 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-342-Pl_F6EIeOnCKJPX-pk-MeA-1; Tue, 23 Dec 2025 09:30:19 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b22ab98226so1731633485a.2 for ; Tue, 23 Dec 2025 06:30:19 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500220; 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=JqwNvMrsGtX06aW/fAOs3pT2SsT5wFnHsxM699N92Tk=; b=RmUSied+uZ8lAOpZN2S/UqrbwTWeWIQpvSE95tH/4IVrDZTHqIKPiizCiak/YY6NPxQFnd VRm2btSn3gb0Hs78IUPJ6jmwdAFDAMYYiB2vnKLAX1V6Feg2H2W3ohAiHzClPFB5Z4BIWs zP84QY6POIksf5kPnxtAWu6R5P6VBWE= X-MC-Unique: Pl_F6EIeOnCKJPX-pk-MeA-1 X-Mimecast-MFC-AGG-ID: Pl_F6EIeOnCKJPX-pk-MeA_1766500219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500218; x=1767105018; 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=JqwNvMrsGtX06aW/fAOs3pT2SsT5wFnHsxM699N92Tk=; b=hrwc2bqVfIJ/Y6jFNkw114rVewAgflqqSNN6Xc+9PHmDzk5s7aSPhy/B5euCpMkMA1 uKgSVI9UzxvIROqsAsFYN7CFh8h8cQhCUhYy2MMiXh1p79dxCNCihdSqPSCC3go/t6Ys xaJVzDCNVwnxis77eT26M784eWD4vshO9F4r864sQ1k2Giwj4P5Mq6b3D7V+gS5gOgur SSix3XlQ76ajGR5vLbQBCEfSIbqSr7POiYByNwn227DhSkI4j7QR5U7gO6pNrCELP91b gi1NYI1+mqMX0CDoQmPaKZDsoEZYSnK+kZjY0IvE0aya3NmuOS6oUU9thFSzIPiiAg14 AMgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500218; x=1767105018; 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=JqwNvMrsGtX06aW/fAOs3pT2SsT5wFnHsxM699N92Tk=; b=tN1Zga3wXlGoMxldiq2NKvgMfiAdAi3OVxQ/WOtmQOvpgMGa3M84bMtPUtvlKL0YPH gwaT2drWXBJzJqY5ut4lWrEw5FS79eJJ793lL71Tegtf3TqvyxPySA3HsTDez4+NsCiN tBBH/zQX+pzeORQ+PNVPOnrk16rgp0A4mZQRwmMbf8TzdjxMxLw0oRQnsDBEwEUhP5vB P0L1Qm8ew3Ng+52MqeqGDPbXHxagjhsHtQBTXGeeb2Rw8etj7UujXA3brCXHaUrwbm1c ZvGRp0Pr4+lphZ+6n3boiuMSVXZ8dUyLLWOpZxusBDOKTP6/zeGlbbzXnIxnqZtIqRU6 dprA== X-Gm-Message-State: AOJu0Ywby9eR9InpWSssropAZRA7DKK2fbw6nGTYZC/6k2ilncJ8hT2x J5wcnHEN05hSvRpT/dN5pGSTWKOjFvJ6l5pR2nFJqT9w1KlhLXN8WPvxObm9+nYCpi8+HeqjCJc mfASl5K2V6nI0vKFgPvqPGYyXp8PlHYDfvm46EI7JK3j3fQRIawHNYNezXdBp/FYrkU7xlEcaHP J/KxgbCkKcbQRwtV5XV52c0e0Cuda0PtQfIH8ysg== X-Gm-Gg: AY/fxX5+LQv7q2vCGyYs2KS+msPLwR+t1vAkw+W33q4DC3tfG9TilEMQnkfd6v25KvA yY1A3HkvoiCyog0V5AKnFWMK1Qq/y+lU1xEXhy3dcuNkJOeZs+2oLEprq7MpgbuSoAFCRRwX+yw OeNnDL7/ijYsnkYDKU4XPjAdjZSuXlQ4+SDvhmJiCgl8/AJG+sHyg1SOX9iheHyjM+zE0v0mc9r Av0sTFOAPltvSognAiCoMD68/qNO8r2moO7ajbMGaY5+wQRGfxbpTRbBAnbP3TTR/usf9yJmMn9 omYXSJkFuhpEym1VAVpEr4v7g4XccjgQd9pIQLGSr7g/Q3gUSlV2eBxXy7w5pbu7RitX8SDHzm1 aHv8= X-Received: by 2002:a05:620a:1a0b:b0:8b2:ea5a:4152 with SMTP id af79cd13be357-8c08fd1a9c1mr2461004485a.87.1766500217984; Tue, 23 Dec 2025 06:30:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjxGaf7w9uh/GvaOsOYiM62EG0AViskxAhyQmRS6Oc59z3kaGetqAFIlJlRoG082tOT1nTow== X-Received: by 2002:a05:620a:1a0b:b0:8b2:ea5a:4152 with SMTP id af79cd13be357-8c08fd1a9c1mr2460996885a.87.1766500217433; Tue, 23 Dec 2025 06:30:17 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 13/31] migration/options: Add x-ignore-shared Date: Tue, 23 Dec 2025 09:29:41 -0500 Message-ID: <20251223142959.1460293-14-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500451435158500 Content-Type: text/plain; charset="utf-8" This aids scriptings only. Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251205172054.288909-1-peterx@redhat.com [peterx: make the property x-ignore-shared to match, per cedric] [peterx: fix over-80 line] Signed-off-by: Peter Xu --- migration/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/options.c b/migration/options.c index e78324b80c..ea19b2c7cd 100644 --- a/migration/options.c +++ b/migration/options.c @@ -203,6 +203,8 @@ const Property migration_properties[] =3D { MIGRATION_CAPABILITY_SWITCHOVER_ACK), DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT), DEFINE_PROP_MIG_CAP("mapped-ram", MIGRATION_CAPABILITY_MAPPED_RAM), + DEFINE_PROP_MIG_CAP("x-ignore-shared", + MIGRATION_CAPABILITY_X_IGNORE_SHARED), }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500334; cv=none; d=zohomail.com; s=zohoarc; b=HZIMyVLvG8++wEe1yCdau46QODMvScOcxtIhF/R3RwcdSvnmiTvNTEnYqq4OVsjjOotr1FbQXLc6kErdpP7GTiXyga0PqV0qpG3RoM8XgSC7fg71/bjFLmaOwLURF9w6CtteCKumXxD+cHSvDfR4TXa2CEVhJA8049vbuoKFh9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500334; 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=mF+Ha4mX5K/3Q9gfAi2xtogfcDdAXHrzxjz+aiuLiLI=; b=bw8tmuNGM5H76KfqZw4Sb1w0dc40wEszYDVEY3iblO0iEM4gOn5LV1GIIhzImk7t6tAh4sKg8KBTNsTt4Ep8TqNwbsvVC48grpCea/QxRbxnpod7Oxq31WI1Uizj0FPa7f6PIMoF+ZswLnCmY1YwD8PTkBzDVG4IlOGo0Yjq6UA= 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 1766500334459626.3041366432839; Tue, 23 Dec 2025 06:32:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Py-0002Sg-Ip; Tue, 23 Dec 2025 09:31:18 -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 1vY3PC-00016l-2c for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:39 -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 1vY3P8-0003lz-0t for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:29 -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-92-qB-bA6EaNi-w9T0m_EZAyg-1; Tue, 23 Dec 2025 09:30:22 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b2e235d4d2so1801978085a.3 for ; Tue, 23 Dec 2025 06:30:22 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500224; 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=mF+Ha4mX5K/3Q9gfAi2xtogfcDdAXHrzxjz+aiuLiLI=; b=faPkL6H5td7xVuDBYgYDEEOTU+Y8rRviJAxVbligj559V9DbeVVpn3A8WR37hAHcA0dvf4 gWrV4uJgsFn8CQyP7I7xRcuhy39ZKTKUsib28jgFUYwtAron/E9DhGycrMixt3DD08XhN2 EYJlVjnEWu7rftSMBgD7rot0Ib6v1uI= X-MC-Unique: qB-bA6EaNi-w9T0m_EZAyg-1 X-Mimecast-MFC-AGG-ID: qB-bA6EaNi-w9T0m_EZAyg_1766500222 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500221; x=1767105021; 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=mF+Ha4mX5K/3Q9gfAi2xtogfcDdAXHrzxjz+aiuLiLI=; b=bXKHgqEIoGcsQf/I7PyI3clXOuIL2V9wWhEO6zYlg6l7shkOOjLJBuN0WZbPMf/SEj 88ImpA5zxTaw8Eyyh1pOKS5ir5JV7490VjT9+XIL+4GQihize9A2A5fa7u16vI8LTCKe CNHzurngM68q1+W+QRZcMNHUe0ltMQ7GNbEPks+Xthzn+DaDjfw8ZbaUPJO66pYNncaJ QM8bUeykVSbzAiZv5W9kAgFqcwt987SRC47MbEAn7RdIWlhU64DimYzhnTpo/hCuf8zQ G2sEtjmwmL7G5W4vJNRdbHBn1iG6QlpbF5KJ6WT80BPMuBrsPmUIUOpMgprVBwYqAm6u 8kpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500221; x=1767105021; 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=mF+Ha4mX5K/3Q9gfAi2xtogfcDdAXHrzxjz+aiuLiLI=; b=rIhsf7/bSBv3YyAyvGTMl4Y5CsRQSI01pz0mlEoNqV1bQitVbcdNSv1pbrdZlKOId/ yinJ7wXZ6PigURuAb9FrF8cK/wA76IspCg2nvkGjUWGQXBRWbDUDdbjBJXIoNbEZbecp SCVn1twxZh0nMlVauVRtxmq4sWS3d6PU5n8G2rJFbrZ/NpOq8tRKjMENwV0btdSDNGiA CSO/4tROdTI46JQsoxbdak9By0oSsIBih3abYepmFyDaMouVn1HDbgZ7y6FpwZPtN6YN mg4u4QlEq1nd0gpRyO2tkOThbL9WEWJsqsFQ0pFO8LX5KeFFxGMI67ZEStoWSbbmVZt+ nciw== X-Gm-Message-State: AOJu0YzYaDlBJHJgacSqn0h+xJ72t6ozrOtxFwFPcGgFTkxdKHh7QdtX 7rmMBgwHYoUTCQ8Xtf9cnVjbQVedkEI9xYlVcFoAIsplxmkobZ5Evr6qxhNM1FmrNTZ9QKfS8H6 Tc4qE1NtzLtqFqNiyhmJ6lvNHe28U42WNW4qlm6talLto8Gqjbxt5nVvm1Vi64k4Y8rIKaMukBr DyIy9JP0qirptq8GBL+8+DX2jdQM00+GU6NcrPgA== X-Gm-Gg: AY/fxX5+hW3qraKcN0NNQuYOE5ElOjowZ1p7vju0OSVMxbs0P4VIu8cZ2WDigzS8r5w Nw9ip8CG+eEMiaX9T+QfvlGwnyCDpucw9D2VKVpbpA8eY9+tqcKjVuzsVLoshv0Lm0Eo5fxFsRf 2PKHy7D01WssjqtjhG3PRbpAnqoeKisq0fd3IXE/9HPJMYLLJu6t0AVUDBFg9rbGg8o9BXhBwj5 nrvJOYU3QBLr0jxj+/aLBL9ZZTpJNsUkvlCg783slpG594UIquqPh8rWNr3cjnUXobSD63mYRSz EwBg8OIwYRHZlHWDOg5+ekIjl5225a58pgqB92nnYs2fmgzZGvLm5kchQTZGFKPCDggrCPoFcvu 9TG4= X-Received: by 2002:a05:620a:4611:b0:84a:d3ce:c749 with SMTP id af79cd13be357-8c08fab8868mr2314761785a.64.1766500221226; Tue, 23 Dec 2025 06:30:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvjyHgsym9CWFi6Si3slgwmLo0ybW1mP0myTpfxbJANDdjFEcaMC7B3bozcKU1z98psjD2SA== X-Received: by 2002:a05:620a:4611:b0:84a:d3ce:c749 with SMTP id af79cd13be357-8c08fab8868mr2314724385a.64.1766500218720; Tue, 23 Dec 2025 06:30:18 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Ben Chaney Subject: [PULL 14/31] MAINTAINERS: Update reviewers for CPR Date: Tue, 23 Dec 2025 09:29:42 -0500 Message-ID: <20251223142959.1460293-15-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500334836158500 Content-Type: text/plain; charset="utf-8" From: Ben Chaney Signed-off-by: Ben Chaney Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251210143624.416697-1-bchaney@akamai.com Signed-off-by: Peter Xu --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 63e9ba521b..dc6235e174 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3118,6 +3118,8 @@ T: git https://gitlab.com/vsementsov/qemu.git block CheckPoint and Restart (CPR) R: Peter Xu R: Fabiano Rosas +R: Mark Kanda +R: Ben Chaney S: Supported F: hw/vfio/cpr* F: include/hw/vfio/vfio-cpr.h --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500454; cv=none; d=zohomail.com; s=zohoarc; b=j/ZsN741mVhbseymO6uy4y341xgTwIV3EIGSKHUKBip+iuF2L6kjNp4j+NyTXQ0kid+toDAQ1cn0Wa2+3iCW+evLQAasTz8zY+f2szXe26SWtYM90EFg8b/GyXmPCzC/hERrIMkkHq+KlFnJW6yBKit0AKZ+gdBSwhalJgQR41k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500454; 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=PDO3NcZzsYCTKOGAKAbVb7PIZgkmuIZqHwaZxYA+h1s=; b=Wb1hNpuGFiI92J4fs1XGR73E6IoSssOxdiyOrvEeVwWTptyTgi11w50kCEAO2wduaN75uj2kg72falWLZqYJVhJvGZMPU0a3AaMqUL5a9OwYwXjOQPbA3gYtKAw9wHjHPKJDxEm3j3E33u1comzix4toyMndULSABRJDbfzKm/E= 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 1766500454485843.3714553836735; Tue, 23 Dec 2025 06:34:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q0-0002YB-Rm; Tue, 23 Dec 2025 09:31:21 -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 1vY3PB-00016d-Gx for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:34 -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 1vY3P6-0003lq-Vz for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:26 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-nXJa46XaN0ecuDLn3tXzmw-1; Tue, 23 Dec 2025 09:30:23 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-88a25a341ebso115189516d6.0 for ; Tue, 23 Dec 2025 06:30:22 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500224; 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=PDO3NcZzsYCTKOGAKAbVb7PIZgkmuIZqHwaZxYA+h1s=; b=AytWHmypg78vCtvwJzWSDynYAPA9LSpTJy2vkt37SRufVfr88U/mXPINKmbJviZSW4Kwm/ qs4hYxrFaYaj9D11SQdwbjJ4MwZyk1ls2CdmimwVc83r+1Ctdg9U589P9CtYlKmFmSQOgi vdx5VbBTRTMWl2uZnwycXlK9RAxv6uE= X-MC-Unique: nXJa46XaN0ecuDLn3tXzmw-1 X-Mimecast-MFC-AGG-ID: nXJa46XaN0ecuDLn3tXzmw_1766500221 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500221; x=1767105021; 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=PDO3NcZzsYCTKOGAKAbVb7PIZgkmuIZqHwaZxYA+h1s=; b=ZZKWdkdGwyedWY0y2Nsvkdu6CZ+JCM5Fj1PLye5r7OpS9pzSlHB5epi359xakkfZzQ mayo/029MSdJT3GjfhrFg1wVVr+BZwcBOkd1eI7XzGIbLTYfXP/g2XCQM/f4jJH2BGc8 FE+XUSjYzqj7xa+yxK1k1jZoBhmEvHZ6YpVStxQwLQYxTgCSzLsivfM/+I5Y8rAG8c2G X5TgKmKbEDBpPh2BrXyeShtVjznuMG8MJuGFSrUv29JfmcN4oDi3i/VLuuJua4pYVZC0 QFBKWzqhlF8PAAAwsb8cu12MrYquzbDS68wMkeoJF/cUBCJmHI2/7usTmpEByoahS4eW W+wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500221; x=1767105021; 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=PDO3NcZzsYCTKOGAKAbVb7PIZgkmuIZqHwaZxYA+h1s=; b=goJcx9uL8ZR9EKGulfDhI/bP71qQi5ett2vJvc66AlMr/68BeAcBhnPQh7DxE7z84S oB79tu0aV7hhu25p/NKqDuei81/YLDFTbqSQx4mid/r0gz0HH8G9YO2VDs/rNzeDA6xQ ZqJljX4+CpyzZbZRhyJzfebH8cjs80RdPbx1+8YklOAQ5SDgFqaVOqPMyiGewObA5wxj 14xfGkR2zsuURn5yjXZ6JH4+9y/He6lb6+itM9490Nkv8KHvzsRjrtp2bHrwUdE7+4Xd by+0ADWp1dEXa8//ir9MeAYqdJumKxtTG1hJ27v/gtxMJtSJwrvAcP4yV463hKLNIGYW uWXQ== X-Gm-Message-State: AOJu0Yzm7pF78zzsb4GpofhGcrf0MKoco3n23Nl84p+8ZfCuW+QFIvTP A+3ijkm82QgzY7mGV9t75e/KxvscYeou384u/re1aJbQFVmjzJglgsMZ1JDQ1JBVeoiVj/8sfBi /aHZCYLI8XFX2vTvxa6VvybJMTulQQj6T+vF1th3pS6j9+avwwyewhCX9zqDpZ0fbMe+ixtbSWM vFo7e00mO9KeFTr5OSr/CxhW91w7K4FazX3KxiMg== X-Gm-Gg: AY/fxX60TtoQHmWSjQgGxoILSEpb5pGeVQBisFpAG9p1plRrqVL1V23Ex5LJySYwHh+ OYI5VGSniwrQt6JUnNEeEcfDwOGM+9oPNm6c1PAGmNr0LQEVDM/9L+EchNWsMCXRIH//qdnm2pt WIHPtQWAAeuzMNxehFX6qRfcp6qNBGsc0pOE9bBaeSDqlYq3aiVWWwDda9nq1R53pUk20fuMmK/ Sj2dXUL3TYJwEn1X3xVHC9Fo4dB8y+hZZSSpmObOxto0iPbb1cCvrVMuhM4xSc7phlmOkEfFr6c o7C/5cBVwVkALixNDXuHJ010JyfvFr2+B2/Tb9M6dOLzVVxRp5TOifFuR04US/cWgK/iWg4oD22 1G6Q= X-Received: by 2002:a05:6214:2cd6:b0:888:1f18:79fe with SMTP id 6a1803df08f44-88d87606914mr176024346d6.45.1766500220661; Tue, 23 Dec 2025 06:30:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDQAZB/6GNZM+a4YsVdVTxWP8qxuLGDuzKKRE5fNglzZByS1KZP1L2mpGhcSBqFLw63uY4lA== X-Received: by 2002:a05:6214:2cd6:b0:888:1f18:79fe with SMTP id 6a1803df08f44-88d87606914mr176023556d6.45.1766500219944; Tue, 23 Dec 2025 06:30:19 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 15/31] migration: Fix leak of block_bitmap_mapping Date: Tue, 23 Dec 2025 09:29:43 -0500 Message-ID: <20251223142959.1460293-16-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500455500158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Caught by inspection, but ASAN also reports: Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 in malloc #1 in g_malloc #2 in g_memdup #3 in qapi_clone_start_struct ../qapi/qapi-clone-visitor.c:40:12 #4 in qapi_clone_start_list ../qapi/qapi-clone-visitor.c:59:12 #5 in visit_start_list ../qapi/qapi-visit-core.c:80:10 #6 in visit_type_BitmapMigrationNodeAliasList qapi/qapi-visit-migration.c:= 639:10 #7 in migrate_params_apply ../migration/options.c:1407:13 #8 in qmp_migrate_set_parameters ../migration/options.c:1463:5 #9 in qmp_marshal_migrate_set_parameters qapi/qapi-commands-migration.c:21= 4:5 #10 in do_qmp_dispatch_bh ../qapi/qmp-dispatch.c:128:5 Note that this is entirely harmless because the migration object which contains the MigrationParameters structure is kept until the QEMU process exits. Reviewed-by: Markus Armbruster Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-2-farosas@suse.de Signed-off-by: Peter Xu --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index d55fde222a..1ff728b6a2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4139,6 +4139,7 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); =20 + qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500444; cv=none; d=zohomail.com; s=zohoarc; b=RvpQiWRvbL4ubL2r8pp8GDYuAigS8lbVQt9aQwogDmKJtpJIq7AWFd11UPYz45HnDMqnfMkam9w9+P/U+FV6/4DOiw4GaX5T66RMj/TuG4OgNLF/sw2N4bB00B4Yv1BtwGH1H8UejT+ioEf0TGtKb9y4W6rMVQvqRm+eOXZww7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500444; 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=6TWzMHm7Js1si41Vstj0CSEhsHDy04wZuQci0sb4Jyc=; b=gNCwYNEEHEWXdM+ASIgskUUjukmCpfzy3wfBkiDHUmVpUc+OOPsxxU2AAHVDlRnmNd4AUmbcb/d5jVEjeqX0kVME2BYqGJ61T0EGSBteqIEBhZ37Hj3zivU27WYKoWVFssxaNEOFmrRklQn4LKUwSfF7jzhkiBYygAP/H6Lu3js= 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 1766500444791760.2368746928925; Tue, 23 Dec 2025 06:34:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q7-0002qV-HT; Tue, 23 Dec 2025 09:31:27 -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 1vY3PB-00016f-MO for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:34 -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 1vY3P8-0003lw-02 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:28 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-zAgFMv7gNJuDSL_sQjE27w-1; Tue, 23 Dec 2025 09:30:22 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b2e9b2608dso1038241185a.3 for ; Tue, 23 Dec 2025 06:30:22 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500224; 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=6TWzMHm7Js1si41Vstj0CSEhsHDy04wZuQci0sb4Jyc=; b=XGIXeMrNhL5xEtMtFx4cciXR8u5KtQ5G9y2G2J+DWF3tfgScL54aQ8MeVxBQ6h0tDBvzYr VHy9uCKuKmfAcUbQDqN5jQYcz5Fjf2bkMtwKfmoOKZAy0ccKObT30zEM42B3djUSD7uDdc fiDkL1rO4BRMAef7wGW1TPwBNYzxyGM= X-MC-Unique: zAgFMv7gNJuDSL_sQjE27w-1 X-Mimecast-MFC-AGG-ID: zAgFMv7gNJuDSL_sQjE27w_1766500222 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500222; x=1767105022; 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=6TWzMHm7Js1si41Vstj0CSEhsHDy04wZuQci0sb4Jyc=; b=eTlak3Q1r48gE8qPpJ/yIZAbA2hDqb1DbFa7h3rxKOus1OXPvW/6CuMBIIuctaUxVh 4hL6TdKI4Cq877c2A4sCoOozrd46X5TlJPkeordXpSJ7rV5nnwLl5oB3fLo5MDQpIG1D VfNt4/bhF//qgTH2de90u3dvhiOtQkdIDvJ3y5v65O3ZLIbMlnQ1ZifehG75mGgqtZ2Q W13L5EB2j3LuvIoZkIu5IkyP1jQSGf3U3Il7+ox31LUV66yBGKZarfdHbUe5eEz1geXU 0D9iJMUb4M2OhHMkiDN/6hrWHv2ZrJ8NwJJ0GjfpGtoazH6W7PkKJlGpTpi3LVfqRphq iZSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500222; x=1767105022; 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=6TWzMHm7Js1si41Vstj0CSEhsHDy04wZuQci0sb4Jyc=; b=dywPnW7osmo/lZ7MtJA2gfAW5zu4yLPrdVTntLUhU4c9U9Go6x7jyhRxj73+Az80r6 VbEwowUluwos/osKmb1CSmxlCnxkvoGN1MIG+uq12M7JuN0zubijmhobAdsHLbaJJoWm DOgMF3I+2tWo6tOmXl2fDmkzn9ujXBc/Rd2uiiuMxgqyvxH5mYCQKyWnmdIXuCuLt/xF Nxw/NKD5ZShhnzqWZMbSIceGE30owiFJFQoJiCJRulGPcj+0pJQRO1bQzgIIaH4EuVm5 ohBVZrP8rBRlTZOa8qu2do+Bd9EabGfNJCJtpNKfhGiaHpQCHIO7Y8Gyhdw/HufUUquw Bk5w== X-Gm-Message-State: AOJu0YyPXXA5AiUS7FjhklzYt9OCHJWYnNQFZPe3arEfny8LYYLY3dyC taRRUN7RZeEr+UFmylQZWmq0PjvZ7uqSEH70ii0bFBB24/qvT5oeu4vf8Z9kH1FaYQpcyieQzd2 ml1UZgzGc+mpiA6kBfhhvGVC5zENxLgQ192uiH9gG0rZtVv/K5gu1lb0YPIj2LccRgRyYVK9fPd dUD6pbyTWhvjP+GaTrq+ZZftX8U08nCsDoEiJOGw== X-Gm-Gg: AY/fxX4tlOKGabYjE5ZsKVuOPjJUNB5o7ZPBKntGyTdtUCdE2E22kQ2rikwmZwmzjNA jvGI0YB4Lxe87L3Lx0C8wAlvsVoXXVXK+T7v00a9jZjl5eY5/b6jd0XEizXQfmX9UNUZau3GdtE 5ZIvBDLbL/6+m8HqbHXMZRvcyEZBZMQbF0nmzwLX7GMRsStwOWQXnGDpqA3ZFtAPfWzwCV/ksic 7gYvaFdym+kez//WaDAHsoT4Ada521zXAnSAsV/7UYNjqnjOVW95gYGi2fsU5H0T1yvqgsRIvHv RWEz2r6ORdIQdtJALSFh7i7aYoY2m0/CPP39/JZuAlpiYVIIwgxu2jAdRXRXIDOUSW+XxwjWRvA 3MCs= X-Received: by 2002:a05:620a:44c5:b0:8a4:e7f6:bf57 with SMTP id af79cd13be357-8c08fbc6b6dmr2378858985a.5.1766500221614; Tue, 23 Dec 2025 06:30:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlDe02Y0jcMIIq0n2zKXgm1VazNKIAt1tPzrBCJWHZBoBaRzcP6Ze83uNqgL1U6tajKyNn2w== X-Received: by 2002:a05:620a:44c5:b0:8a4:e7f6:bf57 with SMTP id af79cd13be357-8c08fbc6b6dmr2378849485a.5.1766500220926; Tue, 23 Dec 2025 06:30:20 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 16/31] migration: Fix leak of cpr_exec_command Date: Tue, 23 Dec 2025 09:29:44 -0500 Message-ID: <20251223142959.1460293-17-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500445417158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251215220041.12657-3-farosas@suse.de Signed-off-by: Peter Xu --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index 1ff728b6a2..f1378c3bf4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4140,6 +4140,7 @@ static void migration_instance_finalize(Object *obj) MigrationState *ms =3D MIGRATION_OBJ(obj); =20 qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); + qapi_free_strList(ms->parameters.cpr_exec_command); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500330; cv=none; d=zohomail.com; s=zohoarc; b=N5t3OLpLjyIafYvr5s8sDctUI6tBlaxzwaJYvleNrwXq9gadYrN9WX5eshS8lEN7lIC+pWzDZZ68GMadUwCdGKdN7uD7+cTrq2EDtFbGzseUkYetL0/273pLrJAu8StvfusMv2GxIXmWVf9xvyguND4XETZ5rsAOjj7pkQUpD30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500330; 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=3OHM0sHmKXVcmlK09PwnR6A15OlmIPDNYfI+M1nhjB4=; b=LpYh9UdlHEM+ElOtmBNWn3iZa5QRwrgiqLrtZGydGkyFjWYSExqs9pQXxSSV+jtPEhW3UbbVb1+OvtawdI7yv/9IWaezjo9fSVXBR7zZ0OL+MRxMHByI0zyjGeZ//2ADaPRkumrQtb2TXNLXmSabfh5/bWPSXgRwrcRnGMn4Oeo= 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 1766500330499329.9792128857215; Tue, 23 Dec 2025 06:32:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pv-00029B-Ce; Tue, 23 Dec 2025 09:31: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 1vY3PE-00018x-Fi for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:40 -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 1vY3PA-0003mK-7U for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:30 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-vNRhiAspOpu1DEZvjJnXqw-1; Tue, 23 Dec 2025 09:30:24 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b51db8ebd9so1571024185a.2 for ; Tue, 23 Dec 2025 06:30:24 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500226; 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=3OHM0sHmKXVcmlK09PwnR6A15OlmIPDNYfI+M1nhjB4=; b=QRnbZgf6FYyzu2qxEDLkQmpZahYiZICeS0wfypfjxrbnZNFe9wYD6IIO6cR7FHz5a1OFk/ A+n58xYycYz1orOlu8DbHZs75i6aLpbXKB/D++kbjFyzSKvKeIsqXEPE77hB+IviuXPBrr 641sx1GV1411tBbm4erB4642jjNPdI8= X-MC-Unique: vNRhiAspOpu1DEZvjJnXqw-1 X-Mimecast-MFC-AGG-ID: vNRhiAspOpu1DEZvjJnXqw_1766500224 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500224; x=1767105024; 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=3OHM0sHmKXVcmlK09PwnR6A15OlmIPDNYfI+M1nhjB4=; b=JRtF3mNA/MhtAxji8E8ef5oWVSHmYXHMlXxCI6f3Cv9qM4GS5Jh4jyzsGyda9tcGqZ VgRmf9c+jiqBociyPw3m6W8CqHgXNukKihzhYhPpbp8j+4x5/NFfPio4XnmD71aaT+/G x5pX4nuhqbNk+koAa8135a1uR25A+46SKq/K/KlB+CeaoRa/eJTuIYibkGKeTy75VDkq sGvrD5RUW9DqeERMXjYe0SLOTfLEt/g05TLeAUOLUxIBVAp5/nAKtaBeysRughIS2RNe ABGZxzFHVYhpQqdTh1yDi2otf2BnSawwXnFrCDMiOSKxAZsjJ79YVrIcmpLPXRJkB7hs PgWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500224; x=1767105024; 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=3OHM0sHmKXVcmlK09PwnR6A15OlmIPDNYfI+M1nhjB4=; b=lbCMpxgLKhP4DN0lOYVrCnCEb7iCuEm1nyf/w7pukogOxpq2btZQmjLLMVL2v5s2L8 MhJyO/IJscrSmdzmdGZHmEJs1N4A5A7yK3u7LMv+uJFEJCnUVs3b/CRe8kIISqvh8G62 NrShvFidLyo9IhH3JaBTzKDNIckd37Sq8BVzWiHfIovBZyHA7rVF1rZXQbJHfMlQT/F/ fG48q+QmyV9v45ZgUW1qYQijqTvyDi/sZTjVBSRj5n9ur7f9m9pQ2bl2TlT2rlMKoGCb eQBDTjuaJKO/hhTfrOyE/Nr9LtgHPIf17p6RH+cF+xsHNKc/QFbfARhEVoguAjLNC1ZL BhJA== X-Gm-Message-State: AOJu0YzCRaTkJVvkXQzJvyzorJpGrbrLaQqLF7jeN3N6FScbt5CSfA1e sUZEyjQ2NJt6i56WgNhwRgWwAKqMPbpv0Aqs5MJQNKgZNRQSwE9757xqh4yUsKDGJPDSENgNrPO Xiqa4gw+gY7So60tgxvchqNcjEDkRwzQUbKRwF2xvqTxLE8Uvxs/3uReOFp8LvqKn3+5Ud+HVgN mrYzhiPXND603pNXc7aIhMl1kQP6x90NqtYhyEIw== X-Gm-Gg: AY/fxX4z9pgM/MzNkTtDrKxSMeXFvqv0q6AHtqK7yEstgzEi1zI7RSsGhqKVs1AVwO+ B2IqQoPFl13b4Zj6Txw8qRUZhOl2eyyt7iWpOl1aTJ5RWP8z/LsXYfp/kQk8V3JNY9zpeesMo5x 7JItRNHdn4LvROWsb8WWQ6V3JRzGo1nI4LhWFch40Gy8PXZ7Y+aDT9FWQamn3QqUhGRQa3GAZ7D WeEXr1ZUCUD8TLpCFeP3pRhWGtr+V9/T4KOvswMzFNiQ9AKkROAuf+CbK7OCj63FBV5nnvmf9X1 Q5qEb1FmAeF4i6aalBaTXWmkInU7dc/jgg6Q/rRd2sTJHk0AX/6A0n/oDSF7CXnjzp0IklJS0mO TGbk= X-Received: by 2002:a05:620a:19a2:b0:8b2:74e5:b3e with SMTP id af79cd13be357-8c08f6823f7mr2028395985a.36.1766500223677; Tue, 23 Dec 2025 06:30:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IE60+XZG6f2WaNYTxmF8n456GYv4g0/c9WwBmfNJ8sDIYR+WNQ7HRGOsdIlKoVwxFwSXcsJDg== X-Received: by 2002:a05:620a:19a2:b0:8b2:74e5:b3e with SMTP id af79cd13be357-8c08f6823f7mr2028385885a.36.1766500222918; Tue, 23 Dec 2025 06:30:22 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 17/31] migration: Add a qdev property for StrOrNull Date: Tue, 23 Dec 2025 09:29:45 -0500 Message-ID: <20251223142959.1460293-18-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500330885158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The MigrationState is a QOM object with TYPE_DEVICE as a parent. This was done about eight years ago so the migration code could make use of qdev properties to define the defaults for the migration parameters and to be able to expose migration knobs for debugging via the '-global migration' command line option. Due to unrelated historical reasons, three of the migration parameters (TLS options) received different types when used via the query-migrate-parameters QMP command than with the migrate-set-parameters command. This has created a lot of duplication in the migration code and in the QAPI documentation because the whole of MigrationParameters had to be duplicated as well. The migration code is now being fixed to remove the duplication and for that to happen the offending fields need to be reconciled into a single type. The StrOrNull type is going to be used. To keep the command line compatibility, the parameters need to continue being exposed via qdev properties accessible from the command line. Introduce a qdev property StrOrNull just for that. Note that this code is being kept in migration/options.c as this version of StrOrNull doesn't need to handle QNULL because it was never a valid option in the previous command line, which took a string. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu Link: https://lore.kernel.org/r/20251215220041.12657-4-farosas@suse.de Signed-off-by: Peter Xu --- migration/options.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/migration/options.c b/migration/options.c index ea19b2c7cd..d55f3104be 100644 --- a/migration/options.c +++ b/migration/options.c @@ -83,6 +83,11 @@ #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 +const PropertyInfo qdev_prop_StrOrNull; +#define DEFINE_PROP_STR_OR_NULL(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_StrOrNull, StrOrNull *, \ + .set_default =3D true) + #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 @@ -208,6 +213,68 @@ const Property migration_properties[] =3D { }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 +static void get_StrOrNull(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const Property *prop =3D opaque; + StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); + StrOrNull *str_or_null =3D *ptr; + + if (!str_or_null) { + str_or_null =3D g_new0(StrOrNull, 1); + str_or_null->type =3D QTYPE_QSTRING; + str_or_null->u.s =3D g_strdup(""); + } else { + /* the setter doesn't allow QNULL */ + assert(str_or_null->type !=3D QTYPE_QNULL); + } + visit_type_str(v, name, &str_or_null->u.s, errp); +} + +static void set_StrOrNull(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const Property *prop =3D opaque; + StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); + StrOrNull *str_or_null =3D g_new0(StrOrNull, 1); + + /* + * Only str to keep compatibility, QNULL was never used via + * command line. + */ + str_or_null->type =3D QTYPE_QSTRING; + if (!visit_type_str(v, name, &str_or_null->u.s, errp)) { + return; + } + + qapi_free_StrOrNull(*ptr); + *ptr =3D str_or_null; +} + +static void release_StrOrNull(Object *obj, const char *name, void *opaque) +{ + const Property *prop =3D opaque; + qapi_free_StrOrNull(*(StrOrNull **)object_field_prop_ptr(obj, prop)); +} + +static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) +{ + object_property_set_default_str(op, ""); +} + +/* + * String property like qdev_prop_string, except it's backed by a + * StrOrNull instead of a char *. This is intended for + * TYPE_MIGRATION's TLS options. + */ +const PropertyInfo qdev_prop_StrOrNull =3D { + .type =3D "StrOrNull", + .get =3D get_StrOrNull, + .set =3D set_StrOrNull, + .release =3D release_StrOrNull, + .set_default_value =3D set_default_value_tls_opt, +}; + bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500277; cv=none; d=zohomail.com; s=zohoarc; b=lyulKMVy/OeijN5C0ED00w/vJk13gPNGZxjTHqshupJ0MuSupO1ax3PfZWtAdz9bEd1/wpWkelD/d96GSASvGyeKxNXHLd2y0oBgcZ33qfYfDsm9891ImreSkLRxiplISI5/xP1VVBEIbPmLTNcrsqLow5KaQDUysUmVFKQpet4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500277; 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=1jPQ5dffedF6AMX+DvLvM5fScMcZBixifZ8t89hQKCU=; b=abMbZeT8aeURzpA/KSKZdG7g7TyBRpehyhvwqKprFOmuHmOhpqFAc8U1esbf7J9h0U5hPDt6Za2VL+04r/JuIX4jN6d5TG+xqm5wePNBGeh/fhNUSYY0/RP24+LNBkEP+u/WejzSxszLQrhQpbrrN5+nYeRxLcQYVTF+mPm7KU4= 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 1766500277985633.0326652436664; Tue, 23 Dec 2025 06:31:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pt-0001vg-Uz; Tue, 23 Dec 2025 09:31:14 -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 1vY3PE-00018y-KM for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:40 -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 1vY3PB-0003mZ-Bu for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:31 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-s-EAT9goOASOgpVOzXXa9w-1; Tue, 23 Dec 2025 09:30:26 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b17194d321so640922585a.0 for ; Tue, 23 Dec 2025 06:30:26 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500227; 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=1jPQ5dffedF6AMX+DvLvM5fScMcZBixifZ8t89hQKCU=; b=MWZSMwb6onR2wMC/XJqnbUX2OLsjPJneUcE5aXxYRFuT43ypLbdiwLVF6V43reBDme0G9R cEcl9bOLi9xT3tK8X+UkFfmd7vcBhrGWIvNCk/VOxjx3zQJt5KIlBuWFuGIMGJxWjLVM7F /6/vybu+e5eVzGG2NFJ0INdwD9FbqJE= X-MC-Unique: s-EAT9goOASOgpVOzXXa9w-1 X-Mimecast-MFC-AGG-ID: s-EAT9goOASOgpVOzXXa9w_1766500226 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500225; x=1767105025; 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=1jPQ5dffedF6AMX+DvLvM5fScMcZBixifZ8t89hQKCU=; b=kJIWeVdVNY5wEmp27wCMzPypWlFo5DzwhveFdHdR2M4egtvWVTlQcbDgiWU3TF0QcU leFlB9dC/2r5s9TVEZijrENo+a6WyjFkyZ5BnOiJlA+IUQ8GA8FmB7OYUZ0Qa64X3rZ0 HY2XvOiFtJUCHArdqQZ0Ich8xv8r9FKyutJPk7J3v9fb7fwYM3Pva5CYalTmk/jn823e Ek2vVyXVqE2zJL0HTt7r+xjb39vRpo6GHXbXfRoJciPsrc7FhallXQPnAJMKaUXPDEf8 QLhHkvjSg+rMXlMZ0AZnEIi7Dr1GEGqAlZb4E+rsgdl5U+FLJBJuGONdYEJ8KrHIQcSL mIwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500225; x=1767105025; 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=1jPQ5dffedF6AMX+DvLvM5fScMcZBixifZ8t89hQKCU=; b=m7uQXjRf0K7CzeuNjTrWFHXu61yZh0H19GLmxcE8Ms/54AHUtA4FLxSHGHvKA1hr/B m5Y9vFFt/eRTt2PA06Ykfi9oLtap9j9+5TL9m7gqULjOxM79Sbpwjj2H9ITrV7ZGW2uB D6iH0CevObj6Kpjjp1+xX04Sib4pBZP8F0Lk4CMVG2XGpwluzBhJPeNwgsGP+9k9LIAC gCUZj0kBjoHRqxut4tC7Oj6WZ1NuwcffHVa0lhmAuTBFoTagumiJwzH4VuB1DZKUYrv1 H+t8vtYXBwcMbe0X9lta0dTQQeP+ZIQnwIqvdofa+AZIx4awLDrn7L7ycrjFNSnkfkNJ G5rw== X-Gm-Message-State: AOJu0YwKKPurOVuZ+ltMmU9Ie8hvc8vISzn0xkExQs9Tj0gJflYRJbas zRkFlFPf4A9fkIuP6U+XQ4DlZEBaPYuw7lNltlgrsepFk5gxgl56iiLXSddGaPDeJcOv55F6DCI LO5pP/2y7mMNt6XyUKg18ZtXln9/bGmaMy2q7hveZaYl80TE5+s6jia15A1qCsV1d48uOppXErg daXFawSwsK6mz4w9SW7/Tx7mbRd+ivtrVEyltLWg== X-Gm-Gg: AY/fxX52nQ6B0k/qYfXr5vyNlF04P3+5mZhOeRR3ySpnL90K+/KvANmqVHugSTwhKM6 ObxTYO4USDiHMuG+8I4+dZa+4wJn8Yu3YJ1HnWZLgKRLMaOZXevax/I1YObsBMzQeJcgja57eRm FUJWNEHzyhAcsZySJP38IJxKwTs/pWnirNPhN9/9wapg2rZ6cTT/dqRAH+qfVMe9zpjyNJc6V// T8uPOotXVgtU2+LOfg4PPhj7Kiy97wSPFftvs6b+ZdSluG2eMrQyNS1oPCy9/HEzz4VN85Q4rke oIXOqIsBWzrcduFdPdEl4JEh4qIsX2rBjLyQxmZTumDcEoHSjhO43EEszjyY7tKWWDOVQXzNEsm pB/8= X-Received: by 2002:ae9:f814:0:b0:8c0:e5ac:af12 with SMTP id af79cd13be357-8c0e5acaff4mr1306380085a.5.1766500224964; Tue, 23 Dec 2025 06:30:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE20V+f+mztYilAiFhJ4BHRIViOFskcGzx6dT7bvJyY8aHHQy6E6NyRldGvonhS9N8/wQAArw== X-Received: by 2002:ae9:f814:0:b0:8c0:e5ac:af12 with SMTP id af79cd13be357-8c0e5acaff4mr1306366985a.5.1766500223936; Tue, 23 Dec 2025 06:30:23 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 18/31] tests/qtest/migration: Add a NULL parameters test for TLS Date: Tue, 23 Dec 2025 09:29:46 -0500 Message-ID: <20251223142959.1460293-19-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500278647158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Make sure the TLS options handling is working correctly with a NULL parameter. This is relevant due to the usage of StrOrNull for the tls-creds, tls-authz and tls-hostname options. With this, all manners of passing TLS options are somehow covered by the tests, we should not need to do manual testing when touching TLS options code. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251215220041.12657-5-farosas@suse.de Signed-off-by: Peter Xu --- tests/qtest/migration/migration-qmp.h | 1 + tests/qtest/migration/migration-qmp.c | 9 +++++ tests/qtest/migration/tls-tests.c | 56 +++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index 44482d250f..940ffd5950 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -36,6 +36,7 @@ void migrate_set_parameter_str(QTestState *who, const cha= r *parameter, const char *value); void migrate_set_parameter_strv(QTestState *who, const char *parameter, char **strv); +void migrate_set_parameter_null(QTestState *who, const char *parameter); void migrate_set_parameter_bool(QTestState *who, const char *parameter, int value); void migrate_ensure_non_converge(QTestState *who); diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index c803fcee9d..5c46ceb3e6 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -458,6 +458,15 @@ void migrate_set_parameter_strv(QTestState *who, const= char *parameter, qtest_qmp_assert_success(who, command, parameter); } =20 +void migrate_set_parameter_null(QTestState *who, const char *parameter) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: null } }", + parameter); + migrate_check_parameter_str(who, parameter, ""); +} + static long long migrate_get_parameter_bool(QTestState *who, const char *parameter) { diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 21e9fec87d..e0e8a7335c 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -507,6 +507,57 @@ static void test_precopy_tcp_tls_psk_mismatch(void) test_precopy_common(&args); } =20 +static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) +{ + struct TestMigrateTLSPSKData *data =3D + g_new0(struct TestMigrateTLSPSKData, 1); + + migrate_set_parameter_null(from, "tls-creds"); + migrate_set_parameter_null(to, "tls-creds"); + + return data; +} + +static void test_precopy_tcp_no_tls(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "tcp:127.0.0.1:0", + .start_hook =3D migrate_hook_start_no_tls, + .end_hook =3D migrate_hook_end_tls_psk, + }; + + test_precopy_common(&args); +} + +static void * +migrate_hook_start_tls_x509_no_host(QTestState *from, QTestState *to) +{ + TestMigrateTLSX509 args =3D { + .verifyclient =3D true, + .clientcert =3D true, + .authzclient =3D true, + }; + TestMigrateTLSX509Data *data =3D migrate_hook_start_tls_x509_common(fr= om, to, + &arg= s); + migrate_set_parameter_null(from, "tls-hostname"); + migrate_set_parameter_null(to, "tls-hostname"); + + return data; +} + +static void test_precopy_tcp_tls_no_hostname(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "tcp:127.0.0.1:0", + .start_hook =3D migrate_hook_start_tls_x509_no_host, + .end_hook =3D migrate_hook_end_tls_x509, + .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, + .start.hide_stderr =3D true, + }; + + test_precopy_common(&args); +} + #ifdef CONFIG_TASN1 static void test_precopy_tcp_tls_x509_default_host(void) { @@ -799,6 +850,11 @@ void migration_test_add_tls(MigrationTestEnv *env) return; } =20 + migration_test_add("/migration/precopy/tcp/no-tls", + test_precopy_tcp_no_tls); + migration_test_add("/migration/precopy/tcp/tls/no-hostname", + test_precopy_tcp_tls_no_hostname); + migration_test_add("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500357; cv=none; d=zohomail.com; s=zohoarc; b=mtKeRIdUQy42KnV07a5Q9JKALbRRk0X+Pjqmhz1XnIiXo3i80CRzI8I84r/8ZZp3wIeqycKuAATJjoF1Yr2sWJEfsjSv2m3C+ItLumLY3pLdenwIA+yzkFqctZezYR4anDPsNPvWrxl33dgZ4zuheqgvJpycfFJNhH0W57sTEHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500357; 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=SiKop/pkTYvinHIAY2aXedBPdBPIWINt60UXVR2YPEY=; b=B5CUGVqJsV89uxFy8YOuQ6ta91vlIVVKst2vlpxHAQEOE1+qJy1Rbr2nBIAYdDuRLtXs0pU/18dfeeTtRn4Xa5lkfU/vy+8BrX06lxMVQ8Xvutn/AvpfcAhprV/S7wAmvpkaZ6kXK+MkyiyiWfAq6WR+r+G9XgUJb9ZoP+Q8c9A= 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 1766500357584426.02519249184286; Tue, 23 Dec 2025 06:32:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QK-0003Fg-N8; Tue, 23 Dec 2025 09:31:40 -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 1vY3PL-0001IC-Sx for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:41 -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 1vY3PC-0003nG-Gk for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:34 -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-410-PPzBKl9KPLOzemJI1YU6LQ-1; Tue, 23 Dec 2025 09:30:27 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8bb3388703dso1752690485a.1 for ; Tue, 23 Dec 2025 06:30:27 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500229; 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=SiKop/pkTYvinHIAY2aXedBPdBPIWINt60UXVR2YPEY=; b=Bl+pzDhKxU6w56nJpKgEhZ2upn1Di0Kx7Xe4mjIm0XPtaQUPBm+7Wv1CIjK6Q8/WJwdN1h Oi1w7FRN0YVtaSpQJoIGCIbmwu0Ioojz9IgrncbfXms9cEggovrbvYzvEJvqQAnINN1ARY wBIHzWHYoOIdJmhvflMFTS7lXxzIp5E= X-MC-Unique: PPzBKl9KPLOzemJI1YU6LQ-1 X-Mimecast-MFC-AGG-ID: PPzBKl9KPLOzemJI1YU6LQ_1766500227 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500227; x=1767105027; 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=SiKop/pkTYvinHIAY2aXedBPdBPIWINt60UXVR2YPEY=; b=aiLUZk8uJsJWRF3f7LGVzN3M2scK+ezrTWn6pEwAhQjITYTM8DvkeAOxaK2+D+Neis bszLZqGTQs7AD0m9HWF4uY8ad+T8xJzJRHurX5MPnUVXYpETg2TAzbcZSjrLSEkzg136 cLhYb9F2Raxu2R2a8Lp4mcAJtOYwpVwTeYgLGKiwNeqc1V2Bh8b/qNxNKHBjUjPYP0nw 5yOg3gtH/uA4/GtKPmU5E4EhcMWh/aALvPa2fJpr8AnamexPzB8ug8bJEvxOkDBjR1JX 1UV7YIvOP+aC90UDygRX3vnxOVCj+o4OZ3R2fQo0CGvNZ0WtD/043HYbh6jECaFO8ZOW gWBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500227; x=1767105027; 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=SiKop/pkTYvinHIAY2aXedBPdBPIWINt60UXVR2YPEY=; b=XSK4x+7TmtKmNV2e82K96gUnxmDdqmqOBHjLttfCj5V7v9d0C95i/yuQJqbhLINGSp mThU+g07LcqoN8GxXSh1iK5oOLmeI5eGMlW+qs16u1mXrjjoFa6wNz7++U0U/pY/DXFL uJLdblcqrq5QbWcT/F8v9EzUC5xHRz5dwFNs7KO8yo0YXJgsSlUj7dO3ZUdwYMoTe5Xr nGqveejOLgb6mWDgvTGo6eB/7bUnYj2z5yoEw9hB8kKhe2BnX56aWqn0t51ScE3v+uCh FKYIweZtD7Pk8wNsEJ89yIIzKMASM8BvUOBHdvjBF9BHbYv8Hf0jjr1f6SznCmXukrol kkdA== X-Gm-Message-State: AOJu0YzTeXrSEdNHUVhqEYslCYgMPcsw6MZ5OTlOJk8Ml1zNBGghxHBV 0r4LdUJuRbH209WeyyW9xZq6bLAq2xKEiviz61E37yHLA7JhO5ehrgV6tF/lIErKfZWXOwt/Vke C/410UHsL9+Vx8rlbyAijV7kh5rkJ6IxbnRNjo+LMqkzgdHuHZAzT3q5YzdvSRWpwnCzvW5xvQS XKfn9HDwdBEnD8RO7GTW0ylD9dR2mEeK7fyHNykA== X-Gm-Gg: AY/fxX50nKtMHgqWtDTbzQ8GX+117GFPA9G44GaImoPf13Z00nPJ6KCN47N5TNFSgGd gnoTWX3ejU+wwaeZfzCvCbZ25YVAzNAXrYii8E/Ef6oAwlm/a11uHXqWB/cFjdHKeJZ9DzpK1A8 tR902hwKr8yRmtrkMJHImsGgiV1Vv2GcweNsaAebl2FanjO9wj30OTEHJdi3ufGNul0V0f9S82V XHVAcTwFu+sbRTkFswDgn51aUP8IjZ01PvMxD4xDQAXpZnfvlZXeQmQtIp3lKSHQGtsCl7b5I+B LRmmnCZcDAPN4dfqRA0qbu91tjvpFMQyR7zu1Gz+V6j9YbiA3eiRN29u9jRL+CGdn+ArvaBnfjv VIgY= X-Received: by 2002:a05:620a:1285:b0:8c0:f15f:b0e with SMTP id af79cd13be357-8c0f15f0c27mr1139557785a.80.1766500226488; Tue, 23 Dec 2025 06:30:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IH97n+WTi4MjSc01Tg8sbthygXJ+UGO3HXBS615L90p2n+dxlgJa1gXy1kohNcv0FC5ByTYKg== X-Received: by 2002:a05:620a:1285:b0:8c0:f15f:b0e with SMTP id af79cd13be357-8c0f15f0c27mr1139544585a.80.1766500225093; Tue, 23 Dec 2025 06:30:25 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 19/31] migration: Normalize tls arguments Date: Tue, 23 Dec 2025 09:29:47 -0500 Message-ID: <20251223142959.1460293-20-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500359210158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The migration parameters tls_creds, tls_authz and tls_hostname currently have a non-uniform handling. When used as arguments to migrate-set-parameters, their type is StrOrNull and when used as return value from query-migrate-parameters their type is a plain string. Not only having to convert between the types is cumbersome, but it also creates the issue of requiring two different QAPI types to be used, one for each command. MigrateSetParameters is used for migrate-set-parameters with the TLS arguments as StrOrNull while MigrationParameters is used for query-migrate-parameters with the TLS arguments as str. Since StrOrNull could be considered a superset of str, change the type of the TLS arguments in MigrationParameters to StrOrNull. Also ensure that QTYPE_QNULL is never used. 1) migrate-set-parameters will always write QTYPE_QSTRING to s->parameters, either an empty or non-empty string. 2) query-migrate-parameters will always return a QTYPE_QSTRING, either empty or non-empty. 3) the migrate_tls_* helpers will always return a non-empty string or NULL, for the internal migration code's consumption. Points (1) and (2) above help simplify the parameters validation and the query command handling because s->parameters is already kept in the format that query-migrate-parameters (and info migrate_paramters) expect. Point (3) is so people don't need to care about StrOrNull in migration code. This will allow the type duplication to be removed in the next patches. Note that the type of @tls_creds, @tls-hostname, @tls-authz changes from str to StrOrNull in introspection of the query-migrate-parameters command. We accept this imprecision to enable de-duplication. There's no need to free the TLS options in migration_instance_finalize() because they're freed by the qdev properties .release method. Temporary in this patch: migrate_params_test_apply() copies s->parameters into a temporary structure, so it's necessary to drop the references to the TLS options if they were not set by the user to avoid double-free. This is fixed in the next patches. Acked-by: Markus Armbruster Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-6-farosas@suse.de [peterx: in hmp_info_migrate_parameters(), remove an extra dump of max_postcopy_bandwidth, introduced likely by accident] Signed-off-by: Peter Xu --- qapi/migration.json | 6 +- migration/options.h | 1 + migration/migration-hmp-cmds.c | 6 +- migration/options.c | 144 +++++++++++++++++++-------------- migration/tls.c | 2 +- 5 files changed, 93 insertions(+), 66 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index cf023bd29d..30a0eb2d7e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1382,9 +1382,9 @@ '*cpu-throttle-initial': 'uint8', '*cpu-throttle-increment': 'uint8', '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'str', - '*tls-hostname': 'str', - '*tls-authz': 'str', + '*tls-creds': 'StrOrNull', + '*tls-hostname': 'StrOrNull', + '*tls-authz': 'StrOrNull', '*max-bandwidth': 'size', '*avail-switchover-bandwidth': 'size', '*downtime-limit': 'uint64', diff --git a/migration/options.h b/migration/options.h index a7b3262d1e..25fb316420 100644 --- a/migration/options.h +++ b/migration/options.h @@ -92,4 +92,5 @@ ZeroPageDetection migrate_zero_page_detection(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +void migrate_tls_opts_free(MigrationParameters *params); #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 79426bf5d7..edc561a34a 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -360,15 +360,15 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) assert(params->tls_creds); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds); + params->tls_creds->u.s); assert(params->tls_hostname); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname); + params->tls_hostname->u.s); assert(params->tls_authz); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz); + params->tls_authz->u.s); assert(params->has_max_bandwidth); monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), diff --git a/migration/options.c b/migration/options.c index d55f3104be..6ef3c56fb6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -167,9 +167,10 @@ const Property migration_properties[] =3D { DEFINE_PROP_SIZE("announce-step", MigrationState, parameters.announce_step, DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), - DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), - DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + DEFINE_PROP_STR_OR_NULL("tls-creds", MigrationState, parameters.tls_cr= eds), + DEFINE_PROP_STR_OR_NULL("tls-hostname", MigrationState, + parameters.tls_hostname), + DEFINE_PROP_STR_OR_NULL("tls-authz", MigrationState, parameters.tls_au= thz), DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), @@ -259,6 +260,11 @@ static void release_StrOrNull(Object *obj, const char = *name, void *opaque) =20 static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) { + /* + * Initialization to the empty string here is important so + * query-migrate-parameters doesn't need to deal with a NULL value + * when it's called before any TLS option has been set. + */ object_property_set_default_str(op, ""); } =20 @@ -450,13 +456,6 @@ bool migrate_rdma(void) return s->rdma_migration; } =20 -bool migrate_tls(void) -{ - MigrationState *s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -931,21 +930,38 @@ const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_authz; + if (*s->parameters.tls_authz->u.s) { + return s->parameters.tls_authz->u.s; + } + + return NULL; } =20 const char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_creds; + if (*s->parameters.tls_creds->u.s) { + return s->parameters.tls_creds->u.s; + } + + return NULL; } =20 const char *migrate_tls_hostname(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_hostname; + if (*s->parameters.tls_hostname->u.s) { + return s->parameters.tls_hostname->u.s; + } + + return NULL; +} + +bool migrate_tls(void) +{ + return !!migrate_tls_creds(); } =20 uint64_t migrate_vcpu_dirty_limit_period(void) @@ -985,6 +1001,25 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 +void migrate_tls_opts_free(MigrationParameters *params) +{ + qapi_free_StrOrNull(params->tls_creds); + qapi_free_StrOrNull(params->tls_hostname); + qapi_free_StrOrNull(params->tls_authz); +} + +/* normalize QTYPE_QNULL to QTYPE_QSTRING "" */ +static void tls_opt_to_str(StrOrNull *opt) +{ + if (!opt || opt->type =3D=3D QTYPE_QSTRING) { + return; + } + + qobject_unref(opt->u.n); + opt->type =3D QTYPE_QSTRING; + opt->u.s =3D g_strdup(""); +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -1000,10 +1035,9 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); + params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); + params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); + params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; params->has_avail_switchover_bandwidth =3D true; @@ -1063,9 +1097,6 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 void migrate_params_init(MigrationParameters *params) { - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - /* Set has_* up only for parameter checks */ params->has_throttle_trigger_threshold =3D true; params->has_cpu_throttle_initial =3D true; @@ -1243,7 +1274,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { + *params->tls_creds->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1305,18 +1336,24 @@ static void migrate_params_test_apply(MigrateSetPar= ameters *params, } =20 if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; + dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; + dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - dest->tls_authz =3D params->tls_authz->u.s; + dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1425,21 +1462,19 @@ static void migrate_params_apply(MigrateSetParamete= rs *params, Error **errp) } =20 if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + qapi_free_StrOrNull(s->parameters.tls_creds); + s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); } =20 if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + qapi_free_StrOrNull(s->parameters.tls_hostname); + s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, + params->tls_hostname); } =20 if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + qapi_free_StrOrNull(s->parameters.tls_authz); + s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); } =20 if (params->has_max_bandwidth) { @@ -1544,32 +1579,23 @@ void qmp_migrate_set_parameters(MigrateSetParameter= s *params, Error **errp) { MigrationParameters tmp; =20 - /* TODO Rewrite "" to null instead for all three tls_* parameters */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - if (params->tls_authz - && params->tls_authz->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_authz->u.n); - params->tls_authz->type =3D QTYPE_QSTRING; - params->tls_authz->u.s =3D strdup(""); - } + /* + * Convert QTYPE_QNULL and NULL to the empty string (""). Even + * though NULL is cleaner to deal with in C code, that would force + * query-migrate-parameters to convert it once more to the empty + * string, so avoid that. The migrate_tls_*() helpers that expose + * the options to the rest of the migration code already use + * return NULL when the empty string is found. + */ + tls_opt_to_str(params->tls_creds); + tls_opt_to_str(params->tls_hostname); + tls_opt_to_str(params->tls_authz); =20 migrate_params_test_apply(params, &tmp); =20 - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; + if (migrate_params_check(&tmp, errp)) { + migrate_params_apply(params, errp); } =20 - migrate_params_apply(params, errp); + migrate_tls_opts_free(&tmp); } diff --git a/migration/tls.c b/migration/tls.c index 284a6194b2..56b5d1cc90 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -130,7 +130,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, } =20 const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname && *tls_hostname) { + if (tls_hostname) { hostname =3D tls_hostname; } =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500321; cv=none; d=zohomail.com; s=zohoarc; b=dytmOZZ1qB4kX3AXCLbrAeAk7VFSYIVxRk5h3ysl+UoMUIjBgtkZw9JAblIP5Dxa7wJHV5Wu61Lr4A0Zvy3xMaXYhHTSfGf5IeQ4mBULGky/pjztySJms+in8Jz1U4bsnlU+afDnWkFn/kdot+OuJyuvlx6RFGaEXKDj3nTMIGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500321; 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=uP5Rm/AMKEfc2II3yNWrhClaDs/tXid3PE8jTqH0eCU=; b=Yklb/Lwa5t2S0vWGmcrhWmWxK3DODHVKa0p9OaQ4PEWZCYSQpQv5MlQhgttRdeQnmNG6QALa1iOyuUYXsxZhKBKNXZIuSVSvM5paqGuPzZfO0svI5gDkTQzcBH6M8FbtboAOqVZvjnhmUeaFYeFfPsPNR/6BgSQF9IwTT6VHSBI= 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 1766500321823500.65740498128594; Tue, 23 Dec 2025 06:32:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q9-0002t5-U4; Tue, 23 Dec 2025 09:31:31 -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 1vY3PL-0001IA-T2 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:41 -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 1vY3PE-0003nC-7b for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:34 -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-439-HtaoYnl8OByYd6SNy1twPQ-1; Tue, 23 Dec 2025 09:30:28 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8bb9f029f31so1351722785a.2 for ; Tue, 23 Dec 2025 06:30:28 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500229; 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=uP5Rm/AMKEfc2II3yNWrhClaDs/tXid3PE8jTqH0eCU=; b=LJFKxsBRCXjh2PolwiJA6Wl866ikHF4d/WpCvrrRGKNB3feY7SWa3ZftR1x7ohEfr8P5US skzxIeN7N6KeGjptpJj+ZQFARr0vfwiGGihE0P/NbmxCbM+90Us+mVdBMvIboLKi7HMb5/ kvArNloYsjSBG1AJQsAC9hX4OjUjM1U= X-MC-Unique: HtaoYnl8OByYd6SNy1twPQ-1 X-Mimecast-MFC-AGG-ID: HtaoYnl8OByYd6SNy1twPQ_1766500228 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500227; x=1767105027; 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=uP5Rm/AMKEfc2II3yNWrhClaDs/tXid3PE8jTqH0eCU=; b=qoOLHMZNqF3GwRbN0U81fWNbIvhHwiJQcMaET8cGnmyi+L/s6pQskb3BsyIl9Nlbzk 5BnTfzj03+3rYjM+eBaNCv5cPQT2eluA8sV4UpAubCOCuUeHvXWcfSqwG9nhN4DJS9lc Ty2/tSejkijKnbr8IYnXAAMoIOIE8Q9qH9a42K6syuxPO5hU70N3aP/o9j7ssQTT0Lte hApzgs3ZbEVBAXtLEUaSyMufCPd07UjjjatubmrNy0XNYhzZHv4aKmcBYbE1eiOrw5/M THIlEnMPdaXJfjfkC8N+Abw4OD9fkVrHtmFBP0HKFapT9pdrLYxdV7NaPQXbZ2Hxgby8 31KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500227; x=1767105027; 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=uP5Rm/AMKEfc2II3yNWrhClaDs/tXid3PE8jTqH0eCU=; b=JPpzN9TtcL4/nztNZyZ0YHXQ4rLkAIibS5U2cvQ4/ZNNH0mxRT4bPjtyyl3B+QER6b ozu4+xAgRYpE5mn39KRw+8KqUCQ7WibXi4xm2+w1e8/junjX3vVTCN3cCEZ0sHChfJh5 p1e81a4NxHIk9MzMdH3iXtT7QhIIoqGEJynYchTfjUKc7RGxQWWS1AvhcoS763HZMojD n5k7ouIrBIqY9KfmYkxBzr1M0GIjcCuCyi6vX0olsw3Q1wavOVqsksvWJCmQkYQ3fz9J RtDZ4Gaaluc9oK4j5AYuTVFFbR5AusbBqUX62MZi4Fh+axRf8rmgIpQmy/4NA/WExI3y mDRg== X-Gm-Message-State: AOJu0Yydsw2g5yGeyexdy0qhbbH6oQLpN8dL2wD/Lju3WriGUJrfOKuJ BXI2pABiiYYpzujFx/PLNGl2US4IMQRb16+P399+p+f2G18m3OE5Qfj+EY663yJ/eKwV1Pj3fal FJqEPB75vYxZjuTIm7ggNq6cY5DspRsS/Cka1SHnKILXzzLsYGSNxdqGV9nNKbtgj3Gc1RVHTzb pK4FgL6S0Lj/0y1vj46WvFjmR4wnYAJL1YsDzmHw== X-Gm-Gg: AY/fxX7Sql3m/jl+TSDjs+KhKO6HgYA92rf/pMVNf7VEM89JVLfGhboxEfHfWT/uU9D 8PUAP9IEWgYe+ptGGaGvHh0Uvf3qee8rQ/QuAyA5lxAsUr+cGCfOjYjuI8P/hKzJW5MYjcK6hwn AWZpf8J3Qv98uIaj5uFXhl1xU4zXIInZC8uF8DaUHAjZSUe/OdLm5RUQyLI5JiBazqbxBr11xZ5 KRxTz1XovTnt62EWlJDrSZsS6wSTcH7y1jSHvpAMUlHwV4Gdj0kljMt2dj0E4GMuSwib5nXqUjH iLcrJy12rA1Ry7y2QDzZNjVQ2f75vbcfUfnlSyuRP71UnHOlrdc2fEXg3zEel4MUfNtUpMyPJEo IHl8= X-Received: by 2002:a05:620a:2a05:b0:8b1:498b:77fe with SMTP id af79cd13be357-8c08fbeacbcmr2000518085a.33.1766500226999; Tue, 23 Dec 2025 06:30:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7JoiINpiIRX2McDs2eMb3j+/xxQ8GODxzZ1SfILKkkECLRksM5ouAD+JV+JwpkJtg6GvPyw== X-Received: by 2002:a05:620a:2a05:b0:8b1:498b:77fe with SMTP id af79cd13be357-8c08fbeacbcmr2000508285a.33.1766500226270; Tue, 23 Dec 2025 06:30:26 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 20/31] migration: Remove MigrateSetParameters Date: Tue, 23 Dec 2025 09:29:48 -0500 Message-ID: <20251223142959.1460293-21-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500322916158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Now that the TLS options have been made the same between migrate-set-parameters and query-migrate-parameters, a single type can be used. Remove MigrateSetParameters. The TLS options documentation from MigrationParameters were replaced with the ones from MigrateSetParameters which was more complete. Acked-by: Markus Armbruster Acked-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-7-farosas@suse.de Signed-off-by: Peter Xu --- qapi/migration.json | 239 +++------------------------------ migration/migration-hmp-cmds.c | 4 +- migration/options.c | 6 +- 3 files changed, 26 insertions(+), 223 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 30a0eb2d7e..fa4491b9b0 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -993,7 +993,23 @@ 'cpr-exec-command'] } =20 ## -# @MigrateSetParameters: +# @migrate-set-parameters: +# +# Set migration parameters. All arguments are optional. +# +# Since: 2.4 +# +# .. qmp-example:: +# +# -> { "execute": "migrate-set-parameters" , +# "arguments": { "multifd-channels": 5 } } +# <- { "return": {} } +## +{ 'command': 'migrate-set-parameters', 'boxed': true, + 'data': 'MigrationParameters' } + +## +# @MigrationParameters: # # @announce-initial: Initial delay (in milliseconds) before sending # the first announce (Since 4.0) @@ -1155,222 +1171,6 @@ # @unstable: Members @x-checkpoint-delay and # @x-vcpu-dirty-limit-period are experimental. # -# TODO: either fuse back into `MigrationParameters`, or make -# `MigrationParameters` members mandatory -# -# Since: 2.4 -## -{ 'struct': 'MigrateSetParameters', - 'data': { '*announce-initial': 'size', - '*announce-max': 'size', - '*announce-rounds': 'size', - '*announce-step': 'size', - '*throttle-trigger-threshold': 'uint8', - '*cpu-throttle-initial': 'uint8', - '*cpu-throttle-increment': 'uint8', - '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'StrOrNull', - '*tls-hostname': 'StrOrNull', - '*tls-authz': 'StrOrNull', - '*max-bandwidth': 'size', - '*avail-switchover-bandwidth': 'size', - '*downtime-limit': 'uint64', - '*x-checkpoint-delay': { 'type': 'uint32', - 'features': [ 'unstable' ] }, - '*multifd-channels': 'uint8', - '*xbzrle-cache-size': 'size', - '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'uint8', - '*multifd-compression': 'MultiFDCompression', - '*multifd-zlib-level': 'uint8', - '*multifd-qatzip-level': 'uint8', - '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], - '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection', - '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } - -## -# @migrate-set-parameters: -# -# Set various migration parameters. -# -# Since: 2.4 -# -# .. qmp-example:: -# -# -> { "execute": "migrate-set-parameters" , -# "arguments": { "multifd-channels": 5 } } -# <- { "return": {} } -## -{ 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrateSetParameters' } - -## -# @MigrationParameters: -# -# The optional members aren't actually optional. -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. -# (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage. -# At the tail stage of throttling, the Guest is very sensitive to -# CPU percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. -# (Since 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. An empty string -# means that QEMU will use plain text mode for migration, rather -# than TLS. (Since 2.7) -# -# Note: 2.8 omits empty @tls-creds instead. -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. (Since 2.7) -# -# Note: 2.8 omits empty @tls-hostname instead. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. **Note:** this does -# not limit the bandwidth during switchover, but only for -# calculations when making decisions to switchover. By default, -# this value is zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: the delay time between two COLO checkpoints. -# (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 -# means the best compression speed, and 9 means the best -# compression ratio which will consume more CPU. Defaults to 1. -# (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in `MigMode`. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. See -# description in `ZeroPageDetection`. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) -# -# @cpr-exec-command: Command to start the new QEMU process when @mode -# is @cpr-exec. The first list element is the program's filename, -# the remainder its arguments. (Since 10.2) -# -# Features: -# -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. -# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -1410,7 +1210,10 @@ ## # @query-migrate-parameters: # -# Return information about the current migration parameters +# Return information about the current migration parameters. Optional +# members of the return value are always present, except +# @block-bitmap-mapping, which is only present if it has been +# previously set. # # Since: 2.4 # diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index edc561a34a..8b1096db86 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -578,7 +578,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); - MigrateSetParameters *p =3D g_new0(MigrateSetParameters, 1); + MigrationParameters *p =3D g_new0(MigrationParameters, 1); uint64_t valuebw =3D 0; uint64_t cache_size; Error *err =3D NULL; @@ -765,7 +765,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) qmp_migrate_set_parameters(p, &err); =20 cleanup: - qapi_free_MigrateSetParameters(p); + qapi_free_MigrationParameters(p); visit_free(v); hmp_handle_error(mon, err); } diff --git a/migration/options.c b/migration/options.c index 6ef3c56fb6..b17347e43b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1312,7 +1312,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrateSetParameters *params, +static void migrate_params_test_apply(MigrationParameters *params, MigrationParameters *dest) { *dest =3D migrate_get_current()->parameters; @@ -1439,7 +1439,7 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, } } =20 -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +static void migrate_params_apply(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); =20 @@ -1575,7 +1575,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) } } =20 -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationParameters tmp; =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500449; cv=none; d=zohomail.com; s=zohoarc; b=KJZ1UWEmP0pBj+ejieGbb+rAg9t7abc0m0evFsy6svJYPd4Dyc5TU/kb7WYBhyJzqq4nTAXq9w1bDp9gBShjX7obGJNTownnRccAAsdl6KhnQXu5f6zy0NqWzQTnGBXP0tJHxHUBpcSnK8xzzl+Q/7V13fZ3dZu1jNVCbJqSjmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500449; 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=0FW6saTDWb9JM/IHJRxAm7DnbZ1DOTG3pr4vDqtJT2A=; b=GPk0I3S0wbSx2eEnhFfeqq19kdUUAfCCSw9mo0jY4iqk42cvaH7C9MhEPLqrWHJUWArVtEno3J+AfZD4DNZbaBaGsAHHpb7Z6CJHc3V38Paq5DFawjkgvrUMJei5LGS5ND3RtZclllqM7G77yoWcOQXoxD0q17U8BydxQSoyucs= 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 1766500449588237.24273656150422; Tue, 23 Dec 2025 06:34:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q0-0002Xc-Pm; Tue, 23 Dec 2025 09:31: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 1vY3PL-0001IB-T5 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:41 -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 1vY3PF-0003o0-Uh for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:36 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-QPACjXczMs61PzBYzkTbLw-1; Tue, 23 Dec 2025 09:30:29 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8bb3a245d0cso1115792885a.2 for ; Tue, 23 Dec 2025 06:30:29 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500233; 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=0FW6saTDWb9JM/IHJRxAm7DnbZ1DOTG3pr4vDqtJT2A=; b=DNZD/ATwOtBAqlPcO/fsReCXs8TUOfOpr7MhCj3+52Uk4gpNyqTQ7CLK8t73RYmkInVJaL GMz1kLSS1XOcFMxMDrDQ/fcB1sb3cm+jR2d14PmnaM8jXx74maTu1+bCWDbOBlLsOm26Y6 QFqD/EFRNXTfpSuS+YxHmx59sWrv5SA= X-MC-Unique: QPACjXczMs61PzBYzkTbLw-1 X-Mimecast-MFC-AGG-ID: QPACjXczMs61PzBYzkTbLw_1766500229 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500229; x=1767105029; 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=0FW6saTDWb9JM/IHJRxAm7DnbZ1DOTG3pr4vDqtJT2A=; b=GkXvtAxtsmwPkRl6hFHYt5V5Pw2C9dm67b3gUZ6Ix54XjybBsiR31TaCXRvWt1hV0o yCHonmoFO/DvD0M4fL5cw8QnocLnOzmi3IsfiY365qb9CooF8ycXb9eEGmd7gozsrUCE 5En137SifetWRdv21TsoQh/qb+wiGBq1n5SDTN3sh1pNt64NvD9ljOsWmLZyufXAQtTO B8LJznqRT2IGLuAXkolyVhjHE4rHpX/LWPx04cMFbn3rBD5R80VWnx4nspt9vuffXEzx 7JZiSun3Wi4ajPh+TWrcMthWCC+EZb0Guy4OXZHTY6gMIa1OfxMLhk8D9R8VUEzf6Jtj r83g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500229; x=1767105029; 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=0FW6saTDWb9JM/IHJRxAm7DnbZ1DOTG3pr4vDqtJT2A=; b=OIuvrlclF+As3XT2rMVzvtAOsva0xkWdArqwWyfO7NbgfuiMLc3QVRRlj6hLXIVKhf jxkSUOGeE2Hp3/CewHAfXGiC5BJEG/OwKOwAnbAll1UwsLKl2Vl3l4uQPQaz7m2eQ5Wf 8yt5dRn8cgEbAmckUOGsV75BND6FFF3iUNOX0bJD3up1BQ/xp3kcGs2fsyC5RCcBE5KF 6aqfAMHx/VrfDIxlw17qzrQXCGoILQHePoMKsT6mtT+Ayl/D0o9iuezhO5TVOdKUAG03 z43k/esjePL0rY+rKIVBgicAtjT3wVZ8OHhWMJlsni2koiGTQvlWn5lYpgA0E1t9OTw+ IYiw== X-Gm-Message-State: AOJu0YyxzCQcoqSLX60ymIzX+KlJlWWfBfvjM+mkAtnUMEEnt/NFlNH1 lQo7yb9RluMIg99tRiWKAc4rsX3Mt5n9JJne7CNYqB5QSMzLPVF//30lCgUw+PTJ/WZD+7jvKzH Rz5+XP2EiZU7OkW07MFjPOGDaWTeMIOO8W/1neELdvHvtEltGhs9eAE5rXFayKC7vte5OCBXvb3 ZNdf7zUN9BMGj2R/V4ox3ulWAmFRPrkizoHtAZ5Q== X-Gm-Gg: AY/fxX7jvEBJ70dTMLGvTALEZ1UoJIUxu/v/o7zc+2R8+BlIuLRGv849YT7KlWTXzc3 e3WJMm5QPfjLvh49m1Bsil/p1svpdZd5VWAL6kou4lFa5OQp73LxHE0Kt7UIS1GvbPqGMfm9xNY mnEH7OR79jHRJm8G2bNnwRQlvuj0AW+fkCNBv30STaUBc5W3vz7uFkufyRYBG+K9h8V4smnVF6t vZURTPkBJpQhtE94MQSuH/HBYYTxckB6pjl1c7RkiP+sciPYaiE68HGO7japuOv8D7fK0WNP+ke CxgiIzcwUM40IeykRhipFvZudkzhDw1wC26TpeiHPba3gq7/v2NBRIDYCgPerSjsMq6aOU3P0ro LKTk= X-Received: by 2002:a05:620a:454e:b0:8b2:a049:4ac0 with SMTP id af79cd13be357-8c08f675f0emr2415885385a.30.1766500228708; Tue, 23 Dec 2025 06:30:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFU7eZHtlrQXoBHzNAHPA8gIKc1tySdThp0bw/ZMDkXPVe7sE4YhiPF+GJIed8PRjgeZ6UO/w== X-Received: by 2002:a05:620a:454e:b0:8b2:a049:4ac0 with SMTP id af79cd13be357-8c08f675f0emr2415871485a.30.1766500227814; Tue, 23 Dec 2025 06:30:27 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Markus Armbruster Subject: [PULL 21/31] qapi/migration: Don't document MigrationParameter Date: Tue, 23 Dec 2025 09:29:49 -0500 Message-ID: <20251223142959.1460293-22-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500451530158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The MigrationParameter (singular) enumeration is not part of the migration QMP API, it's only used for nicely converting HMP strings into MigrationParameters (plural) members and for providing readline completion. Documenting this enum only serves to duplicate documentation between MigrationParameter and MigrationParameters. Add an exception to QAPIs pragma.json and stop documenting it. The generated "QEMU QMP Reference Manual" now lists the enum members as "Not documented." Tolerable. Acked-by: Markus Armbruster Acked-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-8-farosas@suse.de Signed-off-by: Peter Xu --- qapi/migration.json | 154 +------------------------------------------- qapi/pragma.json | 1 + 2 files changed, 3 insertions(+), 152 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index fa4491b9b0..201dedd982 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -806,158 +806,8 @@ ## # @MigrationParameter: # -# Migration parameters enumeration -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage. -# At the tail stage of throttling, the Guest is very sensitive to -# CPU percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. -# (Since 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. **Note:** this does -# not limit the bandwidth during switchover, but only for -# calculations when making decisions to switchover. By default, -# this value is zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 -# means the best compression speed, and 9 means the best -# compression ratio which will consume more CPU. Defaults to 1. -# (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in `MigMode`. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. See -# description in `ZeroPageDetection`. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) +# Migration parameters enumeration. The enumeration values mirror the +# members of @MigrationParameters. # # @cpr-exec-command: Command to start the new QEMU process when @mode # is @cpr-exec. The first list element is the program's filename, diff --git a/qapi/pragma.json b/qapi/pragma.json index 023a2ef7bc..193bc39059 100644 --- a/qapi/pragma.json +++ b/qapi/pragma.json @@ -59,6 +59,7 @@ 'IscsiTransport', 'KeyValueKind', 'MemoryDeviceInfoKind', + 'MigrationParameter', 'NetClientDriver', 'ObjectType', 'QKeyCode', --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500282; cv=none; d=zohomail.com; s=zohoarc; b=diC5LywFUW24u8AeDNgpH9KS1CPmjJQlncbtiBg02CEHslt83WluZjE89yliJQu0xV46bd7Y57Ru8hUUQRKtGGcTAZeFxi1qA5HpcgFpXJF5hAciYUql9rwQxu6xuY3EsXQ1UPtvYrXXtyg6YqaxeA9sQnVl4WuKflpaX7n4xBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500282; 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=VrUtnHfZ+2Rr8s/jaxbMJK+CYiAFQapL4Ex3k09w4fg=; b=l2gWm7LXg3MU2BY2FZCNXGNPE5GQgeFlw24xy+AjZnZ3qz0xYnRkLoNu3pmPdlFZGOBXlwQN1PNfzB4NbvMGi2dFhfk8CsPDBTF+gNoqwvj4V/VozLHzSLpeNc58v5WJrV9VvwzxyV08YKoJ4z/qFe9sTFC18cAVGa6sQBsxZGk= 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 1766500282102593.1543784020145; Tue, 23 Dec 2025 06:31:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Py-0002Po-83; Tue, 23 Dec 2025 09:31:18 -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 1vY3PP-0001Jx-TX for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:51 -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 1vY3PH-0003o2-Vr for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:41 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-M-U7SbaqMSOI4wFoe7Jfdg-1; Tue, 23 Dec 2025 09:30:30 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8bb0ae16a63so565656285a.3 for ; Tue, 23 Dec 2025 06:30:30 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500233; 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=VrUtnHfZ+2Rr8s/jaxbMJK+CYiAFQapL4Ex3k09w4fg=; b=a2awF837YPVn8jgpj2PQ1LZ6mBtkl8NPpieFppnU9bTV2q6nDWJVUG9YYOUkkLggOavoId k737IgvSx9jhlFCb0wrhh+kUc11++GFyAgZv0THvpsuL1yWW/0DFtgHA8hAIK7OW+tXDrM cT9NOX4wDtXgYQ4/64Dx3LnK00IuaO0= X-MC-Unique: M-U7SbaqMSOI4wFoe7Jfdg-1 X-Mimecast-MFC-AGG-ID: M-U7SbaqMSOI4wFoe7Jfdg_1766500230 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500230; x=1767105030; 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=VrUtnHfZ+2Rr8s/jaxbMJK+CYiAFQapL4Ex3k09w4fg=; b=imE84Muv7yAe27CvOSaL8jIeYZJ7c1KxgSqqyVCEzzqsmusnnHsu2UfpfkDwGtxVJx tc5dpj4lfZLHWul10RvuyLz6u52wAMt1NX9+z1ImFjLhJR3KMMh4RkQzZwb1mp9u20hY mpKH0klB9phFtby9GBCP879rBQWgQpXsa7mEGHUeuiU31eof+WQuu+qhAqwm6c4SclON CtXMCn0KpxWBNmHDgfPBzpqoGhYZHBFsqjh7qZ1m8QEndKJEOMwa1GFS2hVvTetRLgyr VK05WOyo+mEJsl4AGRpJFMF4nTdNIT+sl2nx8hmuMWLhzrumRkH+z0avRiEHQMBQIVhs 9zbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500230; x=1767105030; 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=VrUtnHfZ+2Rr8s/jaxbMJK+CYiAFQapL4Ex3k09w4fg=; b=HqaoF7rpuhF7yfY92iTIQeTFukkfyNh9giPENewzHbWhbobWFpMA0XvMIzx8yELl7y FbxhsTOJzzrkdzvW7bU7HgA4bK3MMIlqw+VZ/kPzQNyTRWSSW7gA7UpLNF+9fIlPDIW7 2kGGhi2gtsTa/qVrwZ49VKBvqKylS3CYCYFDAIdP7aOEDPuajCYIal2ltsUSK9PjnGxV mDrj+Pb8Zo5RJkixiVO3dLjfLzO5/xijFVwK6EBhvesA5QwbU0Frll6Cq+wJKbVy6cB6 MUOPMRc3QVRxAy/9dPKxAlrRSctcTLhRRQmUSX4u4nUtw2ElS2Upuyjdv4wRL2NnwvAR Bv0Q== X-Gm-Message-State: AOJu0YxAdC83jKdsuYeTqzqgw1tBz+jFrJ8bY74UauAMdzhx91wuJn4w K1SzKvIHRoILYflWRBsOm0xomXj3jruQ038Hx1qoAB1XXB9/S2O1ijQ8BKzE3+e7InHfkb7T8MR vfpHILzPNEReXoB6D1Ioa+jL65gHh1Y7/HfFDaYDvebAdxnoVX18N8IGUi9Sb8sAjIPiO5597OO +V1sJlFyO5w/Th6oSEh4VkR9ySTg+cGUbN3yunJw== X-Gm-Gg: AY/fxX4zfFsGPcfR1qV7zM7nWMmVlKMM8V0Srl+YLIlrh7dDfogzrTsRNCxqO69pkbA 8i7zzn8qPTdR+mONyDYQhaYysUoEUPCi0NvuWDe0upLIbZYsVLz8I2WaGl4J6eYOWimtnQqLnxk nlF4P6iqCpA5AIJIXyquzm0SZt8ozDct8ocfprzBmiWLH2wAD4H4VxurszNrE4OAcS9Jrl41zFX QX/InVrXicdvHMEmkAN2RAqSzrgFmmjzSDHPMzgJasQe+59rMK4hn1dRaZFq638Qe+5ExyEBBdU VbCJiqA6tPyUDtDiXG+lSW6LaexMzzKAR1othKrYDDng1pSvoGFBiHpuo0NkJg1vn25ahlvos2e G4B0= X-Received: by 2002:a05:620a:4623:b0:8b2:db27:425b with SMTP id af79cd13be357-8c09001917bmr2202458785a.74.1766500229601; Tue, 23 Dec 2025 06:30:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyZM/lqXXdAybYDoRiYNwYZ3m0+PNFkLIfesroNnhNllG70PiWbU8lt8g09kdd5rEm1kwdFw== X-Received: by 2002:a05:620a:4623:b0:8b2:db27:425b with SMTP id af79cd13be357-8c09001917bmr2202447785a.74.1766500228899; Tue, 23 Dec 2025 06:30:28 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 22/31] migration: Run a post update routine after setting parameters Date: Tue, 23 Dec 2025 09:29:50 -0500 Message-ID: <20251223142959.1460293-23-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500282621158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Some migration parameters are updated immediately once they are set via migrate-set-parameters. Move that work outside of migrate_params_apply() and leave that function with the single responsibility of setting s->parameters and not doing any side-effects. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-9-farosas@suse.de Signed-off-by: Peter Xu --- migration/options.c | 38 ++++++++++++++++++++++++++++---------- migration/ram.c | 2 +- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/migration/options.c b/migration/options.c index b17347e43b..cb127e9c72 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1125,6 +1125,31 @@ void migrate_params_init(MigrationParameters *params) params->has_cpr_exec_command =3D true; } =20 +static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) +{ + MigrationState *s =3D migrate_get_current(); + + if (new->has_max_bandwidth) { + if (s->to_dst_file && !migration_in_postcopy()) { + migration_rate_set(new->max_bandwidth); + } + } + + if (new->has_x_checkpoint_delay) { + colo_checkpoint_delay_set(); + } + + if (new->has_xbzrle_cache_size) { + xbzrle_cache_resize(new->xbzrle_cache_size, errp); + } + + if (new->has_max_postcopy_bandwidth) { + if (s->to_dst_file && migration_in_postcopy()) { + migration_rate_set(new->max_postcopy_bandwidth); + } + } +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1439,7 +1464,7 @@ static void migrate_params_test_apply(MigrationParame= ters *params, } } =20 -static void migrate_params_apply(MigrationParameters *params, Error **errp) +static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); =20 @@ -1479,9 +1504,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - migration_rate_set(s->parameters.max_bandwidth); - } } =20 if (params->has_avail_switchover_bandwidth) { @@ -1494,7 +1516,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_x_checkpoint_delay) { s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - colo_checkpoint_delay_set(); } =20 if (params->has_multifd_channels) { @@ -1514,13 +1535,9 @@ static void migrate_params_apply(MigrationParameters= *params, Error **errp) } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); } if (params->has_max_postcopy_bandwidth) { s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - migration_rate_set(s->parameters.max_postcopy_bandwidth); - } } if (params->has_max_cpu_throttle) { s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; @@ -1594,7 +1611,8 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) migrate_params_test_apply(params, &tmp); =20 if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params, errp); + migrate_params_apply(params); + migrate_post_update_params(params, errp); } =20 migrate_tls_opts_free(&tmp); diff --git a/migration/ram.c b/migration/ram.c index ecd81601e2..18e4e26eaf 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -176,7 +176,7 @@ static void XBZRLE_cache_unlock(void) /** * xbzrle_cache_resize: resize the xbzrle cache * - * This function is called from migrate_params_apply in main + * This function is called from migrate_post_update_params in main * thread, possibly while a migration is in progress. A running * migration may be using the cache and might finish during this call, * hence changes to the cache are protected by XBZRLE.lock(). --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500426; cv=none; d=zohomail.com; s=zohoarc; b=l0pT91grVJ8kl8tt17H/RJXp4wWm2xZej9xiVeOuxWhwgDdYlRUn9yc3O0EzvjdaLyT9DfdFOcm7jWTncOT5EA8tpgSaVP6MyS2ZPaAnrIcX4TYtVzO5+JKHNSiwyRMHaOgycd7WmIqqnp1hN4RJbllpPv5CPusw0vRLl/oxU4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500426; 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=IfXKt3fTkz6GEBBSc40+ZiXCkHpPU8KfJa3ty8O0Src=; b=Nii+xSITARY3l12mVrkoTM/K6Jj81sAGGnCkqDplC8gbMh7HsriC269C13V/wzDV9SJ/LU0SxWOj3TSQxz1hU8wQInj2uScbV5fCiAr6RGji+WyzW0mgXsG8IhktTkSL9koH+aclEWknwDVOd0ekLXmeqY6Hq7BlNnip5jMQiFw= 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 1766500426347545.77729527181; Tue, 23 Dec 2025 06:33:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Pw-0002Hc-Ud; Tue, 23 Dec 2025 09:31:17 -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 1vY3PP-0001Jz-Uk for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:51 -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 1vY3PL-0003oc-6e for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:42 -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-650-zmY5c-JZPACwIvWjfn2faQ-1; Tue, 23 Dec 2025 09:30:32 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-88a47331c39so129291776d6.2 for ; Tue, 23 Dec 2025 06:30:32 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500235; 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=IfXKt3fTkz6GEBBSc40+ZiXCkHpPU8KfJa3ty8O0Src=; b=TNBgyaHQgBSn+jplxhDlHBylRkG2Ap4pVm/3Z6r+co8dEXTru8ScrEUNwTxpsQCw9uRu8Y RNSZl5NITMw1f6NVijmROY9MtK4p5fYZnaStgX1bXq+Y/PGghjrVuf6est24yPSGP2PaQ0 AeZcJjlMZnCLpfIdty5KfkHw2+Vm33k= X-MC-Unique: zmY5c-JZPACwIvWjfn2faQ-1 X-Mimecast-MFC-AGG-ID: zmY5c-JZPACwIvWjfn2faQ_1766500231 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500231; x=1767105031; 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=IfXKt3fTkz6GEBBSc40+ZiXCkHpPU8KfJa3ty8O0Src=; b=SwqMNvbALc1HzmG1/R2oqv1PDVWKndG9yTO4N6YXcZVeO6PqYx70pjX5lb401LBsz4 w7l9L3OuDGgUrQYZgJcR9ETGWXORYb9gk1l/mFNk17Sn9NkvDQgSIujEUHH5r9LBy4u2 pyLqwm2mfKevv8foysu6zlPM0uiOM91xwFX048lf2i1RxtAJWsCjEkOzVOAGH3WiTGcI ILDXLSe4xFV01teWofHbWWX/QltPpddqP08jzgaT9NMCx+zFDE5rztcxdkdl2tfYp6bn 2FhQj84I8Hi51iklfD2/3PtmZV2E0/9yQmmOQP90p5kQmrWOatEt5VslQrr3ylHfwjEn A4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500231; x=1767105031; 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=IfXKt3fTkz6GEBBSc40+ZiXCkHpPU8KfJa3ty8O0Src=; b=FZltey5s4cJvGOJAimkNAX5JHxta6Y1pj7h5+B1oULmDP73sFxhwQoS4C3ngDrA5qj lJNf1ZFeTLRd/Lef8IfrFmurUHboO9+h0HaJBgnSN3eQazbI6TWKgKJOY2leQSB58r6A VTK0h8g32KjL99PnLnB8pEtjHt2eN5vtRY2eqLWV1XYQXRmgcbTrFrxlC3m/io3ZmrEF DEr6/NnuxYICsD4H8j85oAEKDWrFE1Sj41tDY1BWepmnw5Wq79Rx3sR2Byd+ZXASv1yk Vcl+CXqsx7aS4EjRcNMjG3yHr6FKyQci/flaLJPkInUQBqWBnI3Wor4BVkgpKe2tyTFV aiCw== X-Gm-Message-State: AOJu0YxI8IJOyh/SO6ZITJzqi/7mYo0EVR5d9j1CxWPCQMO9C5/z438b 6r+lO2YY+KVtnVYTwIRu+5OT205C5ZeuaLCiNQmyxIAHPQcFTu38yILgMEQhxthVJxVjCHjt90a avzaJTE/tAT6qJSntVYFiXEHx3BBDnhkorGp+TFJF+WMPPeHq54YqFAMZYVZz84lS/OuUthI5L8 jbtVGvm93pShhLgIfQZc7dCWgp4sgynMJ84pYXyQ== X-Gm-Gg: AY/fxX7JlEaciUhU9wiIHx7xIGPeojVkVEu1Q0zacYrTgvZYEY5T9c5wRplhnfWNwoT HkIFUy2fq8xQGDOiEorRqUyi9tjMX9jJRJMT3uk/IYyehIvL+xQHMpbGhoefePXWCR2Jk0Q9gdM idZs6NylKccAq7jcGUqyUhejTuFo7x5D/DUE6+VjdkqHmI96QOpjgMjWKUMtTBr3i19Ewrm1msI C6BJ952qwGfpB/bzTzhaH+LMe8NW2y1M041HvAhtqkP/iWEYkOUZYfMgC1VCtprbjd4e6gZOAAJ myKKp5cR0Th7qHCv879PzWYTb135pvovgH9xKHycdAM52gxifFu5Wpq3qKmhca+u9Ku+3PczmIC JsAs= X-Received: by 2002:a05:6214:470b:b0:7f1:c596:e1cc with SMTP id 6a1803df08f44-88d820420fdmr210815866d6.19.1766500231024; Tue, 23 Dec 2025 06:30:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz4NM9DJFprTzwKshkpulvy61pZsg1Jf3XqV4v1bxRwK5O/21xkcLsoi0oiMx2JrXZ7Qn8Xg== X-Received: by 2002:a05:6214:470b:b0:7f1:c596:e1cc with SMTP id 6a1803df08f44-88d820420fdmr210814646d6.19.1766500230171; Tue, 23 Dec 2025 06:30:30 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Kevin Wolf Subject: [PULL 23/31] migration: Add a flag to track block-bitmap-mapping input Date: Tue, 23 Dec 2025 09:29:51 -0500 Message-ID: <20251223142959.1460293-24-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500427505158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The QAPI converts an empty list on the block-bitmap-mapping input into a NULL BitmapMigrationNodeAliasList. The empty list is a valid input for the block-bitmap-mapping option, so commit 3cba22c9ad ("migration: Fix block_bitmap_mapping migration") started using the s->parameters.has_block_bitmap_mapping field to tell when the user has passed in an empty list vs. when no list has been passed at all. Using s->parameters.has_block_bitmap_mapping field is only possible because MigrationParameters has had its members made optional due to historical reasons. In order to make improvements to the way configuration options are set for a migration, we'd like to reduce the open-coded usage of the has_* fields of the global configuration object (s->parameters). Add a separate boolean to track the status of the block_bitmap_mapping option. No functional change intended. (this was verified to not regress iotest 300, which is the test that 3cba22c9ad refers to) CC: Kevin Wolf Acked-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-10-farosas@suse.de Signed-off-by: Peter Xu --- migration/migration.h | 7 +++++++ migration/migration-hmp-cmds.c | 3 ++- migration/options.c | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index e4b4f25deb..4d42e8f9a7 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -514,6 +514,13 @@ struct MigrationState { QemuEvent postcopy_package_loaded_event; =20 GSource *hup_source; + + /* + * The block-bitmap-mapping option is allowed to be an empty list, + * therefore we need a way to know whether the user has given + * anything as input. + */ + bool has_block_bitmap_mapping; }; =20 void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 8b1096db86..a2863e6a2f 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -321,6 +321,7 @@ static void monitor_print_cpr_exec_command(Monitor *mon= , strList *args) void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) { MigrationParameters *params; + MigrationState *s =3D migrate_get_current(); =20 params =3D qmp_query_migrate_parameters(NULL); =20 @@ -404,7 +405,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); =20 - if (params->has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; =20 monitor_printf(mon, "%s:\n", diff --git a/migration/options.c b/migration/options.c index cb127e9c72..20e9438656 100644 --- a/migration/options.c +++ b/migration/options.c @@ -786,7 +786,7 @@ bool migrate_has_block_bitmap_mapping(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.has_block_bitmap_mapping; + return s->has_block_bitmap_mapping; } =20 uint32_t migrate_checkpoint_delay(void) @@ -1071,7 +1071,7 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; =20 - if (s->parameters.has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { params->has_block_bitmap_mapping =3D true; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, @@ -1559,7 +1559,7 @@ static void migrate_params_apply(MigrationParameters = *params) qapi_free_BitmapMigrationNodeAliasList( s->parameters.block_bitmap_mapping); =20 - s->parameters.has_block_bitmap_mapping =3D true; + s->has_block_bitmap_mapping =3D true; s->parameters.block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500357; cv=none; d=zohomail.com; s=zohoarc; b=PrM4uSrPUzuI+ENg007+CFSzRPx3BTYZCegFtxT701G/GCJKobrq0g3LZUxypsHRcIXgcsbuO+6jVIPNpKh2METm87zFY0sPYKI4Y8U/DMPnFLeOb7BXkdvIWq0hRLyHAOGw70WZZMjV1URa3b+cmCrz1kP698xvdf/bON3tia0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500357; 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=Z7WbYF7qYMna7oUmNsPZRA2X5VE2aXwMx0VCq9+LsYw=; b=i2JLrQl+OdibIClXh5dMuvdtzHptT91tWvCbDSDdQAZ4SlhCXWo+n6O67mHypdMNyLBitBMeaiHLyE4Oq0TUVrii3oNBYfG0tNfpNOGJCk8dV791tEuO5GzsmBCLfAJoO4Sj8fllMsLtTtR0T1spldZPu9WlJ+szFjkdQGyrbz4= 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 1766500357340331.331457435487; Tue, 23 Dec 2025 06:32:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Q9-0002tD-UY; Tue, 23 Dec 2025 09:31:32 -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 1vY3PT-0001KQ-Qr for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:53 -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 1vY3PL-0003p5-Rv for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:46 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-iZ6Rz83vOgKfPi2HNrbAqg-1; Tue, 23 Dec 2025 09:30:35 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b6963d1624so1222449385a.0 for ; Tue, 23 Dec 2025 06:30:35 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500237; 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=Z7WbYF7qYMna7oUmNsPZRA2X5VE2aXwMx0VCq9+LsYw=; b=CAQxgr+XrKXF20CIMIQ3Pg6Wx6M3Olg5fjTp8okqdNX297S7H5/fZf9X5yEADt5IbU8rcS o+kmdfci8iGRPncsDthoCfRVKwuPMAfjcWEd+1cBXrkjzcV18qq/J37X3nHI0w4fZmrsUc k0lkwVTtM2khNhNhFsoE0HVZqlK5INM= X-MC-Unique: iZ6Rz83vOgKfPi2HNrbAqg-1 X-Mimecast-MFC-AGG-ID: iZ6Rz83vOgKfPi2HNrbAqg_1766500234 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500234; x=1767105034; 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=Z7WbYF7qYMna7oUmNsPZRA2X5VE2aXwMx0VCq9+LsYw=; b=bkxJF/tozMGbZXCrWJru8jnukgt4y8u87a3psDmlXO0Ag4vY18HaKSGCtyCLUtgOrl VnZm04VT9ImdVAnZX5F2HjKtKZJCaJYUqg88JWlzbW+YhebcufiGS9VLjoYkdCBSQvqj /62+upUjLoF/fldsWBACopNy1X+Ky6uaslJwsce2uskiz5kJBgKmmsEUQgq2/AygcqXL FR0RO0tfKVOemOxxNmcV5EB9nyWK1pfTS8K3CHjpOMiI1f5AMQCxbI7BOIXRhVCPeoFO ozcpYBWmM7+r1//myx30jFLz2i/NX5vf5tpYiw11wWn21/cyaBwzSOts+/emu0//67ao +QPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500234; x=1767105034; 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=Z7WbYF7qYMna7oUmNsPZRA2X5VE2aXwMx0VCq9+LsYw=; b=ltERQ0Lmq17txr2fJxkeOGGfgfk8TEwVrpJ4JTkQSqQlCaPU/6icL89TT+ZEihPbUq QvsP/JzCjg3uInOjJPbTbHFFbbgQxIKWpfvHo2z6dVZH5g27E/2Yx7c5KoRTO8eVhqWc rp1JjH9VpNOtq7ElIGW7WEJF/WBUL8u5/rian0GrYhQq0WDps0leimlHPGNivvs5sRfz a8nhRlSy+0vbWNTl2omzYwNLyizGLCBTB/ubDOPM2WJRHghVDPhAxELaxHPiKQ2UODYj 2I10Bh753XqWBCBjXsolbIP4jqVvYjBIt3+HbJXLWAHNi99PrWGqJS6TobDdSK0sDRDg Ml9w== X-Gm-Message-State: AOJu0Yx1XQho8MeVLNAIXAZftz8v2m+ZfO3mXbnAnxTXuD5Pk8iztxl9 xizmpUt3LwB0XvMH23J4Z5RM5hCkkFjFZboBxCoydDjU/dtDEyBrmgxmKKqIeMnR62vRNRQXnEW TXA2qj4LIHi3gD3ASvr6NGOeH398Ue2mHFlCV3SvbgNUIp1NEkAim9c18Lx1wqBEufyMostC7ay DrNF6yG/q1OdL5kypBkCyktScRlnVt3LB85ud1SA== X-Gm-Gg: AY/fxX6SDVHJ+OfEg0LiOuTOEpW0LccxmxrI4FHo5Tj98Sxxl1ea+rRWHnsgjY/orku T48YtObwPlnvwh5y0N6SFFc/2KhLUBouVhFMUtSPGkGq+jm0F1gQeTsO3jYixXB2foesnG8/T4n 3xxBUwsYIwr4qDfSFgiI0Q7zP+ay7ZNaq2/l2M6FAbnbZotvNAkPHYkOg87yyRLJkluHEWmIE6L PyRyYoM9pEsAkA/XzY5BrOHFCbPx6dDV+QDF/4rGkJ8yJd+opjPdQMToO00mkh1auW4Da19B7Af ynW3w5FA24Hdm1vOXmtzpEGcmVAeteGwZmEAS6LbK72JKDXbfHQaq0lrTCpCVvnb5sI/JMFnqjT 14JI= X-Received: by 2002:a05:620a:46a6:b0:892:25d5:2ec with SMTP id af79cd13be357-8c08f668c10mr2222175185a.27.1766500233827; Tue, 23 Dec 2025 06:30:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHT4fG0zo4SG3pvlNLbarIY23bYy/HxTwhLrFb1xh0SOh5+I1KaL6w0oS41wx3cAsfbJqe40g== X-Received: by 2002:a05:620a:46a6:b0:892:25d5:2ec with SMTP id af79cd13be357-8c08f668c10mr2222141085a.27.1766500231367; Tue, 23 Dec 2025 06:30:31 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 24/31] migration: Remove checks for s->parameters has_* fields Date: Tue, 23 Dec 2025 09:29:52 -0500 Message-ID: <20251223142959.1460293-25-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500359145158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The migration parameters validation produces a temporary structure which is the merge of the current parameter values (s->parameters, MigrationParameters) with the new parameters set by the user (former MigrateSetParameters). When copying the values from s->parameters into the temporary structure, the has_* fields are copied along, but when merging the user-input values they are not. During migrate_params_check(), only the parameters that have the corresponding has_* field will be checked, so only the parameters that were initialized in migrate_params_init() will be validated. This causes (almost) all of the migration parameters to be validated every time a parameter is set, regardless of which fields the user touched, but it also skips validation of any values that are not set in migrate_params_init(). It's not clear what was the intention of the original code, whether to validate all fields always, or only validate what the user input changed. Since the current situation is closer to the former option, make the choice of validating all parameters by removing the checks for the has_* fields when validating. Note that bringing the user input into the temporary structure for validation still needs to look at the has_* fields, otherwise any parameters not set by the user (i.e. 0) would override the corresponding value in s->parameters. The empty migrate_params_init() will be kept because subsequent patches will add code to it. Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-11-farosas@suse.de Signed-off-by: Peter Xu --- migration/migration.c | 2 +- migration/options.c | 102 ++++++++++++------------------------------ 2 files changed, 30 insertions(+), 74 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f1378c3bf4..754abe0b5a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2118,7 +2118,7 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) } =20 if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC && - !s->parameters.has_cpr_exec_command) { + !s->parameters.cpr_exec_command) { error_setg(errp, "cpr-exec mode requires setting cpr-exec-command"= ); return false; } diff --git a/migration/options.c b/migration/options.c index 20e9438656..35fbe9a6ef 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1097,32 +1097,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) =20 void migrate_params_init(MigrationParameters *params) { - /* Set has_* up only for parameter checks */ - params->has_throttle_trigger_threshold =3D true; - params->has_cpu_throttle_initial =3D true; - params->has_cpu_throttle_increment =3D true; - params->has_cpu_throttle_tailslow =3D true; - params->has_max_bandwidth =3D true; - params->has_downtime_limit =3D true; - params->has_x_checkpoint_delay =3D true; - params->has_multifd_channels =3D true; - params->has_multifd_compression =3D true; - params->has_multifd_zlib_level =3D true; - params->has_multifd_qatzip_level =3D true; - params->has_multifd_zstd_level =3D true; - params->has_xbzrle_cache_size =3D true; - params->has_max_postcopy_bandwidth =3D true; - params->has_max_cpu_throttle =3D true; - params->has_announce_initial =3D true; - params->has_announce_max =3D true; - params->has_announce_rounds =3D true; - params->has_announce_step =3D true; - params->has_x_vcpu_dirty_limit_period =3D true; - params->has_vcpu_dirty_limit =3D true; - params->has_mode =3D true; - params->has_zero_page_detection =3D true; - params->has_direct_io =3D true; - params->has_cpr_exec_command =3D true; } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) @@ -1158,34 +1132,31 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) { ERRP_GUARD(); =20 - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { + if (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "throttle_trigger_threshold", "an integer in the range of 1 to 100"); return false; } =20 - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { + if (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { + if (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + if (params->max_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1193,8 +1164,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_avail_switchover_bandwidth && - (params->avail_switchover_bandwidth > SIZE_MAX)) { + if (params->avail_switchover_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "avail_switchover_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1202,8 +1172,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "downtime_limit", "an integer in the range of 0 to " @@ -1213,93 +1182,82 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) =20 /* x_checkpoint_delay is now always positive */ =20 - if (params->has_multifd_channels && (params->multifd_channels < 1)) { + if (params->multifd_channels < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "a value between 1 and 255"); return false; } =20 - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { + if (params->multifd_zlib_level > 9) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", "a value between 0 and 9"); return false; } =20 - if (params->has_multifd_qatzip_level && - ((params->multifd_qatzip_level > 9) || - (params->multifd_qatzip_level < 1))) { + if (params->multifd_qatzip_level > 9 || + params->multifd_qatzip_level < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", "a value between 1 and 9"); return false; } =20 - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { + if (params->multifd_zstd_level > 20) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", "a value between 0 and 20"); return false; } =20 - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { + if (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "a power of two no less than the target page size"); return false; } =20 - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { + if (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_cpu_throttle", "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 - if (params->has_announce_initial && - params->announce_initial > 100000) { + if (params->announce_initial > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_initial", "a value between 0 and 100000"); return false; } - if (params->has_announce_max && - params->announce_max > 100000) { + if (params->announce_max > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_max", "a value between 0 and 100000"); return false; } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { + if (params->announce_rounds > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_rounds", "a value between 0 and 1000"); return false; } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { + if (params->announce_step < 1 || + params->announce_step > 10000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_step", "a value between 0 and 10000"); return false; } =20 - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); return false; } =20 #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || - *params->tls_creds->u.s)) { + (params->multifd_compression || *params->tls_creds->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1313,23 +1271,21 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) return false; } =20 - if (params->has_x_vcpu_dirty_limit_period && - (params->x_vcpu_dirty_limit_period < 1 || - params->x_vcpu_dirty_limit_period > 1000)) { + if (params->x_vcpu_dirty_limit_period < 1 || + params->x_vcpu_dirty_limit_period > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x-vcpu-dirty-limit-period", "a value between 1 and 1000"); return false; } =20 - if (params->has_vcpu_dirty_limit && - (params->vcpu_dirty_limit < 1)) { + if (params->vcpu_dirty_limit < 1) { error_setg(errp, "Parameter 'vcpu_dirty_limit' must be greater than 1 MB= /s"); return false; } =20 - if (params->has_direct_io && params->direct_io && !qemu_has_direct_io(= )) { + if (params->direct_io && !qemu_has_direct_io()) { error_setg(errp, "No build-time support for direct-io"); return false; } --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500429; cv=none; d=zohomail.com; s=zohoarc; b=AgI8VWNDJqMFqEB5aSg73d+jPeUoa7kwvGNpRGbsO16s+X4uw+W/0zbE6AfrhlDeGg1EbJ3RpJUkcElHeF03srYV9RJ7gPPXDB6UnjWC3SMAhUbpyHx7sqJU/2fjEt1sCgUc92YSNjen6hAlJ00ipeYS1zLWcS1OSdA7g7KWb5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500429; 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=/g1e2RcMyr3RE9l6mWQowsXU+sG/GbnP/uOGtbzUCGU=; b=ChZrsnldd5/nEFtdlTgSRrW/6bog5s5XOBKpfsdaBlF8FxeuBJNqkIutym4qItJ7uuceteuFVkiBCGkyiTPifiredDgE/9yu1zMfKMY1vwGAk5/r5Fg9fAyklOof8vdp4mea36dYCC9+mk7v+eZmr7oasTdhd3LnTez9H11ra+A= 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 1766500429790462.9553452271525; Tue, 23 Dec 2025 06:33:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QR-0003pX-IH; Tue, 23 Dec 2025 09:31:47 -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 1vY3PR-0001K6-Um for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:51 -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 1vY3PL-0003ot-RQ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:44 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-226-sVbzgi3PMQahHjRX7rTBHw-1; Tue, 23 Dec 2025 09:30:34 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8bbe16e0a34so1182825685a.1 for ; Tue, 23 Dec 2025 06:30:34 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500236; 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=/g1e2RcMyr3RE9l6mWQowsXU+sG/GbnP/uOGtbzUCGU=; b=VNAiiXx2K7sJjaQG1gIXpELThLRuwpDC1ytY+My/ycyue89bolfbbnbL3QziG7CsTLRSU6 j7SGipB74wi6IN5Gj+sLTXTY3B+0aIJ3gUNFTGDFHAL1J65BTIHtYVI8bqwEzrLoSPhfG9 BIUgPQkhW5ERKSGaSMzZPmKVZBi0SKA= X-MC-Unique: sVbzgi3PMQahHjRX7rTBHw-1 X-Mimecast-MFC-AGG-ID: sVbzgi3PMQahHjRX7rTBHw_1766500234 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500233; x=1767105033; 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=/g1e2RcMyr3RE9l6mWQowsXU+sG/GbnP/uOGtbzUCGU=; b=SXNGX7djAMJfaXEv4SMIwkEhfvAwMZC+vGH0gvODvplfic3IBbOQMHEIK2zif2zpL9 R3ctRzJgQbJMhu8sfQpsLmWXmXYYfxMx2qwRZMcoE24a/nbFmUj3vXhxt3gpS+r0oy28 rivLvOnZrTyznCLDJgOJLCnG24M2A2Vy6GOa19HrVBXAaPj+PWGMoH4v9ogP55eTO5oO SKQl4UV2p12pcdB1ptOfaWwmNUuMuwiQe2CkVxW9YjrcMGFlhqr8sZ9sSpB0YCFo04v2 GeIdNdNqmKLRX8WYAeckEFO8F2ZOxsTiP+XLNd74mrk7d0GLh0OXh8A45Kh5lK4i04hR 9jMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500233; x=1767105033; 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=/g1e2RcMyr3RE9l6mWQowsXU+sG/GbnP/uOGtbzUCGU=; b=qsF/xfN4OrtfkUc/jy955nCcYaR6/AO2hsdLM8BRgfpuQNRjoYfc23ik6475n81hn2 KN/pkDIG+/GrzFnw3IHHWgV0Y12mMFspwM7nxlqIIo88OPpdXk+Ly1z4C3XPgb2OPP2R DKveAlXWMGKOxnvat+dYNxQznpTtGU8mGSdQOJziFAt0EP7VYgKfz5hpuwBuQQoiPqa3 dZaCoBcIhlTlB0ziU7MCvCd6Fs5ZBhD7BA1SEIJPHi+XueIA5SatgpYXqmD9hJ99twhE JSZfwvZ3Z1r6/WF7ybPHhi7xTSECfPxjc7UMCNmJb2quA4tUxr/SJhgATWGZbjxhTQ79 O7oA== X-Gm-Message-State: AOJu0YyM7zqZpUbDHAKtvtEiBwIRYePTgCluESK7owqq+GIIkp5Lo6H6 lp525FY6vLfAs1NX7HVZ5+lgDlS4NCXLi03K3/68057pVlKZHNfviH0mHRB/RVSaLuTcSIkw2mt 6Pn7yO+K4S1uZX6XpiWqvpZ5CzB1+IFFUYNaiBTX7gJGHuSrumb9TjK6kw6Yby9UMwDaK/yOKJo uTEcbM2n750FrQxtSnCIyY6rqP+hovhutAw8D4wQ== X-Gm-Gg: AY/fxX7qzoiN7tmAQQBVaCqEA3i3KCPrU5M4he4Z6jXXFjegH7QI2XVoCb+FS1JdC6I xc+dFzNg7AIwbM3vfHv68K8pZrr762EpQkBysUPpgq+r4SQ0+Yyj+hlJwF2pXtT/XeRwlS+k12f 8iUuDmdTuXqBWiXdY9ge34NaGRdZhYY3XY/+5ccf00mFq39T//yN7ihI58ceD/8de7u4OpSjuZI 5qbbuhPDPFHE5YIBSp8V4vGRzMRiNbfzfzkVluSZqJcInYz+hUk3VDlKfyHnBcZIgMJ1woXvOGd MPk2jYFoJMcaPY6ewH+v0pVsGagcyh/uBTspEpxkJJnOZCfmMY0wY6RoAaj2XiJYMC7Tj2txXro VRL8= X-Received: by 2002:a05:620a:29c4:b0:811:8bbe:7a3c with SMTP id af79cd13be357-8bee76c9096mr2672330285a.23.1766500233040; Tue, 23 Dec 2025 06:30:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIAhZajexBkeW+o28RuHCxW/3WqbnMAWo3/m28v3MnRpaw3CaulsnjbAwwnxpp6jlvUH+3Aw== X-Received: by 2002:a05:620a:29c4:b0:811:8bbe:7a3c with SMTP id af79cd13be357-8bee76c9096mr2672322285a.23.1766500232399; Tue, 23 Dec 2025 06:30:32 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 25/31] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Date: Tue, 23 Dec 2025 09:29:53 -0500 Message-ID: <20251223142959.1460293-26-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500431431158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The QERR_INVALID_PARAMETER_VALUE macro is documented as not to be used in new code. Remove the usage from migration/options.c. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-12-farosas@suse.de Signed-off-by: Peter Xu --- migration/migration.c | 3 +-- migration/options.c | 56 +++++++++++++++--------------------------- migration/page_cache.c | 6 ++--- migration/ram.c | 3 +-- 4 files changed, 24 insertions(+), 44 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 754abe0b5a..635851fe8c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2325,8 +2325,7 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { - error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", - "a valid migration protocol"); + error_setg(&local_err, "uri is not a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); } diff --git a/migration/options.c b/migration/options.c index 35fbe9a6ef..4652478e6a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1134,120 +1134,105 @@ bool migrate_params_check(MigrationParameters *pa= rams, Error **errp) =20 if (params->throttle_trigger_threshold < 1 || params->throttle_trigger_threshold > 100) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", + error_setg(errp, "Option throttle_trigger_threshold expects " "an integer in the range of 1 to 100"); return false; } =20 if (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", + error_setg(errp, "Option cpu_throttle_initial expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", + error_setg(errp, "Option cpu_throttle_increment expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->max_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", + error_setg(errp, "Option max_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->avail_switchover_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "avail_switchover_bandwidth", + error_setg(errp, "Option avail_switchover_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", + error_setg(errp, "Option downtime_limit expects " "an integer in the range of 0 to " stringify(MAX_MIGRATE_DOWNTIME)" ms"); return false; } =20 - /* x_checkpoint_delay is now always positive */ - if (params->multifd_channels < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", + error_setg(errp, "Option multifd_channels expects " "a value between 1 and 255"); return false; } =20 if (params->multifd_zlib_level > 9) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + error_setg(errp, "Option multifd_zlib_level expects " "a value between 0 and 9"); return false; } =20 if (params->multifd_qatzip_level > 9 || params->multifd_qatzip_level < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", + error_setg(errp, "Option multifd_qatzip_level expects " "a value between 1 and 9"); return false; } =20 if (params->multifd_zstd_level > 20) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + error_setg(errp, "Option multifd_zstd_level expects " "a value between 0 and 20"); return false; } =20 if (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", + error_setg(errp, "Option xbzrle_cache_size expects " "a power of two no less than the target page size"); return false; } =20 if (params->max_cpu_throttle < params->cpu_throttle_initial || params->max_cpu_throttle > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", + error_setg(errp, "max_Option cpu_throttle expects " "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 if (params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", + error_setg(errp, "Option announce_initial expects " "a value between 0 and 100000"); return false; } if (params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", + error_setg(errp, "Option announce_max expects " "a value between 0 and 100000"); - return false; + return false; } if (params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", + error_setg(errp, "Option announce_rounds expects " "a value between 0 and 1000"); - return false; + return false; } if (params->announce_step < 1 || params->announce_step > 10000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", + error_setg(errp, "Option announce_step expects " "a value between 0 and 10000"); - return false; + return false; } =20 if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { @@ -1273,8 +1258,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) =20 if (params->x_vcpu_dirty_limit_period < 1 || params->x_vcpu_dirty_limit_period > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "x-vcpu-dirty-limit-period", + error_setg(errp, "Option x-vcpu-dirty-limit-period expects " "a value between 1 and 1000"); return false; } diff --git a/migration/page_cache.c b/migration/page_cache.c index 6d4f7a9bbc..650b15e48c 100644 --- a/migration/page_cache.c +++ b/migration/page_cache.c @@ -45,15 +45,13 @@ PageCache *cache_init(uint64_t new_size, size_t page_si= ze, Error **errp) PageCache *cache; =20 if (new_size < page_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is smaller than one target page size"); + error_setg(errp, "cache size is smaller than target page size"); return NULL; } =20 /* round down to the nearest power of 2 */ if (!is_power_of_2(num_pages)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is not a power of two number of pages"); + error_setg(errp, "number of pages is not a power of two"); return NULL; } =20 diff --git a/migration/ram.c b/migration/ram.c index 18e4e26eaf..df7e154877 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -193,8 +193,7 @@ int xbzrle_cache_resize(uint64_t new_size, Error **errp) =20 /* Check for truncation */ if (new_size !=3D (size_t)new_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "exceeding address space"); + error_setg(errp, "xbzrle cache size integer overflow"); return -1; } =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500449; cv=none; d=zohomail.com; s=zohoarc; b=NX2cFLOVVh4GOzhlmDJZ5c3FEJsfpLXksrWsTa0IAN64/kqGrUaVKF+LQtcGLZfa7Vaj+jvx/Fqbyi8ll0tsm0RZ/3ChO7rCtv73UqRIwgta28ODKimxd4uyuTHH+s9ZCI8MWHpVqEIK0QiG0rzJO/w0qK4kr3jc1pkkELQgmKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500449; 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=16WwaROPOGxqzPPrcHj/Vz1tZC3raJ52XyW9rKxC2Ho=; b=cwPOZWR3GWXHdOLcN4y6Dik0RuvPQBt0/lpPymIyDWw3RUVc6GAIyQU6AYjOC7jNEGFxEmZxeGdxp6w8ZXQMamie36gbXgoyu+epccjdFPCSsK1+UbEOA1Br+VkzNYW73NCgK5jiqEtutYWNeqaTDRz1eo8cUYzbt8qo8ukuQ5k= 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 1766500449488705.4272473634908; Tue, 23 Dec 2025 06:34:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QQ-0003e5-83; Tue, 23 Dec 2025 09:31:46 -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 1vY3PT-0001KR-Qp for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:53 -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 1vY3PL-0003pH-S9 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:45 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541-7DOr1DeaPC2Om_7I1aABDg-1; Tue, 23 Dec 2025 09:30:36 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b234bae2a7so1193323885a.3 for ; Tue, 23 Dec 2025 06:30:36 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500238; 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=16WwaROPOGxqzPPrcHj/Vz1tZC3raJ52XyW9rKxC2Ho=; b=D+gsi6ZW4HC55heW3oFunQEnBGeE/9HkuDBctYPWMb3zQMKMegphWHAMVP3+2kJAFDnRaE gCIfkwZz4FLKW0hGnRRiS1sLb4ccoSQvQ20QO5qw9utfMKc/on1vYfTsdoDIvjKMifDS5x El99sZoejMGVaOF8CrwCCVbTl5Yg21s= X-MC-Unique: 7DOr1DeaPC2Om_7I1aABDg-1 X-Mimecast-MFC-AGG-ID: 7DOr1DeaPC2Om_7I1aABDg_1766500235 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500235; x=1767105035; 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=16WwaROPOGxqzPPrcHj/Vz1tZC3raJ52XyW9rKxC2Ho=; b=J3i0ANvp0gBBKwOQluATsoZGNLKcS9GXnZ6pI7+8DJo6nLENJFUtfxsFMcF6exBSlg Qq/Cylz0FLD+EmiFMkhaPLGRahRvfCd0w0eSS4JZjonp7h1GTwUTu2/TN+yLcJPE0Qp+ wRlTmgpQcPAuzYoIk2eUHwyYq09JgVDYxRJO3waDL4t83jD6X5VavWw7kwCUwBcZkVaz Wzacby436nogoBY2q9VnQEqYRB9CCSvqLVGt1QRDW6m3UBtQpWGKhIk0OTXRIEoJHNP+ aPqnahZfVGS3zhVKe4qFdUys0q111tXDX7MTwSBsnqwTkN+IIMu0omlp7MIN6zbtinhU OcbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500235; x=1767105035; 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=16WwaROPOGxqzPPrcHj/Vz1tZC3raJ52XyW9rKxC2Ho=; b=T4CdHsRU1g5XWGvUM2OYOQYFZONy4OyJ151DxEvXNUpWN8nC7yMY1gb0t8FyZj68lp Shp/JWURJe4rrBvCe9AEwU5kQJphRaklnIQlq2eanhyJGFJG00dWTdFG+ms6uSs70F+m QpKUHrO+dnalggqel/mCti/GyqGWTWfAy7NTwcnFh38wUA7h3NIluZdMjFAJWWLmvS1d DPYcOcx5J7T5FODjsP2w/Ss933ARmwm2gwe9k8C+kCi49SiwmnQO+wEFPgp1ozhyq7hN wXTchBX24kVZ0p8q9j6IOzL0a1o2QIa6SAZKad0360cuzIUFC5C5lGBY0WzZopUGBbRI iqrQ== X-Gm-Message-State: AOJu0Yx/KwcfA2+5sy946hBOLOUYssqZZMrfBxEpWvcXAMR4Ggrr1kql hRzQ08jAHT5ppWEhp2ibHy/4gsy50ACVMewz15KQJ4hpzwLBED+kr96UIA2mBXp8CkARjZRoU7m ktyTWaXZaxKUH3eZtMckLsXfjX0N51F0WJ9caSyhLCIGiqkW5OwT4l7Fqa1EDPL4BZ9msVC5Iqa fj6xY3Nx7PPM8AQbnw5takSR3OLSNZFLPULwsPRg== X-Gm-Gg: AY/fxX7FYcwl0REFQ5wOkqFmokbQ1Ooe/vZ5R+noc+ELm52rJJhdlyCK0zFELESPLV3 yotLsn5HZQfKpWmZS87BpeN2DCJaHwwCIGnAuC1q6hzObeVKbjvM8RmXZwUv7+vuzY0zh1uJ3bB xhNy1mrO4fQbXd1Uz9isjNa2FCGeQFGNn0VNQAGhrToJzwqO22V1dUIsvBJClFHgWpvUUuukZcX iAkcTJkfS/WjyjBnqDMBZ5L4YCOsjNqKVZNbTRM1BmrpP6j4Wk/TEta4Oy8FY7IQUABUCPzaRO0 hhK5w1YiEM+854wQl4VUzpV9q21AvJOKRrOD/SxCoOBpFT3gz91gIsm8BLlzgCfVcTYkxwUTDg/ P1vo= X-Received: by 2002:a05:620a:4445:b0:8b2:ea3f:2f91 with SMTP id af79cd13be357-8c08fbc1f3bmr2153028485a.81.1766500234661; Tue, 23 Dec 2025 06:30:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGk0DIg/kA/mqtXdQCOTyF3N+cNqou0KdevcnVKKJys/3bzrDl1HkuPrUWXrabPQAuOsWupvg== X-Received: by 2002:a05:620a:4445:b0:8b2:ea3f:2f91 with SMTP id af79cd13be357-8c08fbc1f3bmr2153018785a.81.1766500233833; Tue, 23 Dec 2025 06:30:33 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Kevin Wolf Subject: [PULL 26/31] migration: Extract code to mark all parameters as present Date: Tue, 23 Dec 2025 09:29:54 -0500 Message-ID: <20251223142959.1460293-27-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500451550158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas MigrationParameters needs to have all of its has_* fields marked as true when used as the return of query_migrate_parameters because the corresponding QMP command has all of its members non-optional by design, despite them being marked as optional in migration.json. Extract this code into a function and make it assert if any field is missing. With this we ensure future changes will not inadvertently leave any parameters missing. Note that the block-bitmap-mapping is a special case because the empty list is considered a valid value, so it has historically not been present in the command's output if it has never been set. CC: Kevin Wolf Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-13-farosas@suse.de Signed-off-by: Peter Xu --- migration/options.c | 89 ++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/migration/options.c b/migration/options.c index 4652478e6a..418cb44413 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1020,6 +1020,44 @@ static void tls_opt_to_str(StrOrNull *opt) opt->u.s =3D g_strdup(""); } =20 +/* + * query-migrate-parameters expects all members of MigrationParameters + * to be present, but we cannot mark them non-optional in QAPI because + * the structure is also used for migrate-set-parameters, which needs + * the optionality. Force all parameters to be seen as present + * now. Note that this depends on some form of default being set for + * every member of MigrationParameters, currently done during qdev + * init using migration_properties defined in this file. The TLS + * options are a special case because they don't have a default and + * need to be normalized before use. + */ +static void migrate_mark_all_params_present(MigrationParameters *p) +{ + int len, n_str_args =3D 3; /* tls-creds, tls-hostname, tls-authz */ + bool *has_fields[] =3D { + &p->has_throttle_trigger_threshold, &p->has_cpu_throttle_initial, + &p->has_cpu_throttle_increment, &p->has_cpu_throttle_tailslow, + &p->has_max_bandwidth, &p->has_avail_switchover_bandwidth, + &p->has_downtime_limit, &p->has_x_checkpoint_delay, + &p->has_multifd_channels, &p->has_multifd_compression, + &p->has_multifd_zlib_level, &p->has_multifd_qatzip_level, + &p->has_multifd_zstd_level, &p->has_xbzrle_cache_size, + &p->has_max_postcopy_bandwidth, &p->has_max_cpu_throttle, + &p->has_announce_initial, &p->has_announce_max, &p->has_announce_r= ounds, + &p->has_announce_step, &p->has_block_bitmap_mapping, + &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, + &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, + &p->has_cpr_exec_command, + }; + + len =3D ARRAY_SIZE(has_fields); + assert(len + n_str_args =3D=3D MIGRATION_PARAMETER__MAX); + + for (int i =3D 0; i < len; i++) { + *has_fields[i] =3D true; + } +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -1027,70 +1065,53 @@ MigrationParameters *qmp_query_migrate_parameters(E= rror **errp) =20 /* TODO use QAPI_CLONE() instead of duplicating it inline */ params =3D g_malloc0(sizeof(*params)); - params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->has_cpu_throttle_initial =3D true; params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->has_cpu_throttle_increment =3D true; params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); - params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; - params->has_avail_switchover_bandwidth =3D true; params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->has_downtime_limit =3D true; params->downtime_limit =3D s->parameters.downtime_limit; - params->has_x_checkpoint_delay =3D true; params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->has_multifd_channels =3D true; params->multifd_channels =3D s->parameters.multifd_channels; - params->has_multifd_compression =3D true; params->multifd_compression =3D s->parameters.multifd_compression; - params->has_multifd_zlib_level =3D true; params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->has_multifd_qatzip_level =3D true; params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->has_multifd_zstd_level =3D true; params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->has_max_postcopy_bandwidth =3D true; params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->has_max_cpu_throttle =3D true; params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->has_announce_initial =3D true; params->announce_initial =3D s->parameters.announce_initial; - params->has_announce_max =3D true; params->announce_max =3D s->parameters.announce_max; - params->has_announce_rounds =3D true; params->announce_rounds =3D s->parameters.announce_rounds; - params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; - - if (s->has_block_bitmap_mapping) { - params->has_block_bitmap_mapping =3D true; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - } - - params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->has_vcpu_dirty_limit =3D true; params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->has_mode =3D true; params->mode =3D s->parameters.mode; - params->has_zero_page_detection =3D true; params->zero_page_detection =3D s->parameters.zero_page_detection; - params->has_direct_io =3D true; params->direct_io =3D s->parameters.direct_io; - params->has_cpr_exec_command =3D true; params->cpr_exec_command =3D QAPI_CLONE(strList, s->parameters.cpr_exec_command); + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); + + migrate_mark_all_params_present(params); + + /* + * The block-bitmap-mapping breaks the expected API of + * query-migrate-parameters of having all members present. To keep + * compatibility, only emit this field if it's actually been + * set. The empty list is a valid value. + */ + if (!s->has_block_bitmap_mapping) { + params->has_block_bitmap_mapping =3D false; + qapi_free_BitmapMigrationNodeAliasList(params->block_bitmap_mappin= g); + } =20 return params; } --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500441; cv=none; d=zohomail.com; s=zohoarc; b=ZQUM5w2g3GJcqRfd1qVyh/Fc4nUATPx/vLl9Yfh8Ey6cKpwWBg9qU5eEoV8fGpRsmXVRSng7wVdxE27PXw7zeEcOCdcw3RnCtWXyKQJxkv/bfcolNi0xPY3Ji6SnXU4/kOZirbHUjWM+rQSnp1QrfmcAUzGDzL6dsKNGeb1n93E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500441; 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=Q7BRFh1Cw0AiV8Ulykk8MuKNbm9xn6mz3jfv8tqNVkE=; b=IeSbSQiqSRhr3uLSJZxVLHCpwG+ZoqYHeswtwqYnKkv5t+zwxkk7K4f8ZzsKEr8/8C354bTXHsQ93bihBO1oHWM8+iLbeswsNiVKDWmAqabIlI7wwyCwg/MPcnQtfCH/aD6LDsXxgrKnR1G5E1aFRG7A6i7lZvQ804iZgHtTcFQ= 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 1766500441736436.68417664089156; Tue, 23 Dec 2025 06:34:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QR-0003om-9h; Tue, 23 Dec 2025 09:31:47 -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 1vY3PP-0001Jy-U2 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:51 -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 1vY3PL-0003pO-Kl for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:42 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-m5uXLypZPbClcAxZ6zUngA-1; Tue, 23 Dec 2025 09:30:37 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b2e19c8558so154802485a.2 for ; Tue, 23 Dec 2025 06:30:37 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500239; 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=Q7BRFh1Cw0AiV8Ulykk8MuKNbm9xn6mz3jfv8tqNVkE=; b=gwu1zxy6cPZ4nSObPw9grcGsOoEpzCgMBC+sXItiwnbUfkTCL9hUVeP/LzuUCwYUfDYhLh EjxkiSp2DUj1G59LUO8AccVQ+jaeqip4GUSH+dh7zHeAS4HJZHZ8fESL6ujIXK3jJBCque N498AnRZi8vMF2KhhkUkW2IyF6tEYLU= X-MC-Unique: m5uXLypZPbClcAxZ6zUngA-1 X-Mimecast-MFC-AGG-ID: m5uXLypZPbClcAxZ6zUngA_1766500237 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500237; x=1767105037; 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=Q7BRFh1Cw0AiV8Ulykk8MuKNbm9xn6mz3jfv8tqNVkE=; b=YAooTl7GMC+fUPmy/SeM8/GbRiobA3zjsLykigPRHAY/NyN71VLfyFAdKxcdKrqnpE 4QlLfkoWEewieGgIcGMH2nCGzxMGXMXtil2Uk6D1EmUXv/aHbnQknmkW8pZrNGR1BeIe Exeu1udh78gMhv4086kpoDmUVmx8/rkzMxAEaILiiUGdY4KEYqF8007tNzH1z/A/MhQF NeFYXa+bLwu19D42oxDKp0bqjn3FnGXKa6vP/baxVUEMEsoX32E8f3hHdbbVCehqthnW L6nziQ3CkcZ5eHJh2nhMKxChn6yLhXN8ZX59Me51nCvTpqCvYe9R0hPvXhHYQGFGaiPt 1z3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500237; x=1767105037; 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=Q7BRFh1Cw0AiV8Ulykk8MuKNbm9xn6mz3jfv8tqNVkE=; b=cgxBDKH6OcuVG2Hi1MV3oTiNmWaEtClE7yHQqFM9w/AYVJj9a66TZqxp52m6A8jpam btrF9ZIZpYoGSHmoQNtpnt/05vB6lF576Xx7HUuohPJlTzQZxHz+NxqKeKa3AdysLNrj K5yZxVkJEC1KRJV6ccnMGtCaMrxyD1rzSmREF6Ug9K7Qjdi4vzNfFd4cEirm8I8de7GX iemKOpPvkBeK/XLEqjwb2gflUDRg+MyrAXv0prv1XuAgbRjM2Izjb4X+0O89yjGpSBXQ r4OI5Tf53/FtqRwc7UKoDyYXFCMEs8+5SKn2taK5jmX+SWzHPo1tO6HCaxonelvqaxsa KCTA== X-Gm-Message-State: AOJu0Yy9fz76JZBX9yMQo0szXmJBYlB9eKbslN7iV9T6zErgrYSM35MC mU5qK4bLyYjIkAYbtxqW3fcf9IObU01MkzsCDWKC+QsnrNFBzW08U7FrG4FdY0xmj1y24H3Ldd6 d+07prX4hnwPFVKeR21m75Wcl7KkbLjl0wC7PWu43knRq5lwmdCrz5sjEs36JG6TUP6PzZ3cDXZ ze9XdNA6SlMbcnXSnvp6+znXLtybERYat4TeM6qA== X-Gm-Gg: AY/fxX5CoPObH6fTROQpP2MLHmSCDuWlJDfIEELnyzFtSHVuGqxAH17rQ3s9ZG5Dpd6 NNxw8PDE1s0cronxM+90sGmcweJxqxGMtI2J0nUlMQ9Irq07+FtvJbzRKg50SSq2l4OsFnacPHQ r/U2a6N2hpJadHijR8YudTfixdCSn7GyuOw6fxGzLngVDDyPs1KwUgvNmkbzRKvQ/zZ5S+EIHk/ 0CMJsFJFcqLxAGj7YAH9J18nN/tZlJ0PKEjtyFaz0PJqxpLHmsaluuFFFPkfkWcvFWfBqUNOkJr g94yYt+ZiO3WKMvPwl1+rpkEZqYXKMJ2eW80jb+kigWCJFk/pZ3sPqbiq6wyLYb0TEowJWgxaik 9mL8= X-Received: by 2002:a05:620a:4511:b0:8b2:e6dc:179c with SMTP id af79cd13be357-8c08fc01245mr2117571985a.1.1766500235322; Tue, 23 Dec 2025 06:30:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGE/m5+hbdU6IYIF3l+ih6LwIq1h9kdlQLZpO/pAsFDMJUtfOkmx0Gkb6s4QYKzJs8eT8QSQ== X-Received: by 2002:a05:620a:4511:b0:8b2:e6dc:179c with SMTP id af79cd13be357-8c08fc01245mr2117564385a.1.1766500234755; Tue, 23 Dec 2025 06:30:34 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 27/31] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Date: Tue, 23 Dec 2025 09:29:55 -0500 Message-ID: <20251223142959.1460293-28-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500443483158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas QAPI_CLONE_MEMBERS is a better option than copying parameters one by one because it operates on the entire struct and follows pointers. It also avoids the need to alter this function every time a new parameter is added. For this to work, the has_* fields of s->parameters need to be already set beforehand, so move migrate_mark_all_params_present() to the init routine. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-14-farosas@suse.de Signed-off-by: Peter Xu --- migration/options.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/migration/options.c b/migration/options.c index 418cb44413..9a5a39c886 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1060,47 +1060,9 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) =20 MigrationParameters *qmp_query_migrate_parameters(Error **errp) { - MigrationParameters *params; MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - params =3D g_malloc0(sizeof(*params)); - - params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); - params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); - params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); - params->max_bandwidth =3D s->parameters.max_bandwidth; - params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->downtime_limit =3D s->parameters.downtime_limit; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->multifd_channels =3D s->parameters.multifd_channels; - params->multifd_compression =3D s->parameters.multifd_compression; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->announce_initial =3D s->parameters.announce_initial; - params->announce_max =3D s->parameters.announce_max; - params->announce_rounds =3D s->parameters.announce_rounds; - params->announce_step =3D s->parameters.announce_step; - params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->mode =3D s->parameters.mode; - params->zero_page_detection =3D s->parameters.zero_page_detection; - params->direct_io =3D s->parameters.direct_io; - params->cpr_exec_command =3D QAPI_CLONE(strList, - s->parameters.cpr_exec_command); - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - - migrate_mark_all_params_present(params); + MigrationParameters *params =3D QAPI_CLONE(MigrationParameters, + &s->parameters); =20 /* * The block-bitmap-mapping breaks the expected API of @@ -1118,6 +1080,7 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 void migrate_params_init(MigrationParameters *params) { + migrate_mark_all_params_present(params); } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500487; cv=none; d=zohomail.com; s=zohoarc; b=MjdVjI5w/GfdNPsT98a4PJ0uxJ4O/PFn/XkBDkapvsRlCMslu0pHQ+7MRnBWG8pzMODSRprODdFFZM+FEO7kaJLnplzT8w48L7qBP3XyzDSu1LUZ+7BM7c4jTnXld0Jv2NfWRauJ8bMe+arM5s83DbxMz637KuBzbp99ss15A/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500487; 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=i+mbJkrstaIb7ND8mcI8yplZbeO1dtLYkHR6poh1ISc=; b=m0GWLGQrmiKsEPzbY7skNqTEt0qZj17KshNXpB0I+LoKeEApmfaoOD/Xx6EeBYoyTAG8j/fdJOm5r5cRxOZ/lY8c0E5uj0jd67C6J5Abgw1fI7RCrXTuIyjkxk7bcyQiKDL1ngyz/MUNPzgksov+sWCu8X0aARsZsUa1Nrpy0/M= 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 1766500487971204.73601242107907; Tue, 23 Dec 2025 06:34:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QQ-0003c5-4b; Tue, 23 Dec 2025 09:31:46 -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 1vY3Pc-0001PG-AJ for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:31:00 -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 1vY3PR-0003ra-Me for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:51 -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-624-YO-QPMDWNPu7ZBbRbjvXmQ-1; Tue, 23 Dec 2025 09:30:42 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8b9ff555d2dso1203535085a.0 for ; Tue, 23 Dec 2025 06:30:41 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500244; 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=i+mbJkrstaIb7ND8mcI8yplZbeO1dtLYkHR6poh1ISc=; b=L4uVKizQAURCTIpEeLj6KYe4HCIR/ph4EmDAtB5CHEqE5bI0YGlaaqNw7upnJH5KQlCfLn 4J6IjFTE72UnlYq08ovirkYlchbH+A5Y9ZWCiacAmivDtl0B1COFny3IyZ350RrsJW5HhB /CMNIjMiI1TWP3iImgqR+uQRCVvn8j4= X-MC-Unique: YO-QPMDWNPu7ZBbRbjvXmQ-1 X-Mimecast-MFC-AGG-ID: YO-QPMDWNPu7ZBbRbjvXmQ_1766500241 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500241; x=1767105041; 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=i+mbJkrstaIb7ND8mcI8yplZbeO1dtLYkHR6poh1ISc=; b=TRfTV0TOwtAre+EBeSEeLmo4j54npU6RjOhLWwd5BKF507sGk2rTw065i91PHHIHd5 Ki9wSCFBI4PO88BMVjihtN5+9iHAGqH1qegg9YrsxmBF3cPSAuMpI6BuI/8FEoNCqiho 1qVN8VrV0L4XWTa6B5+DJTP5E8v3PakJOvn+Wx5TPuoaSDifSOCDo/wcEHXwQnSNBQOg z2MkmdvXiz/fXAWigJxovWJ54yS74BbPzfmvvnMOx0E0Bqqcg8TKCF6Ev6AswcmRzz6q 43TLGgzkAGDaes84sXZotJ68sMCwPd0vi6zHiRPZYmKvHSGpxXAesyCt7cqjdsedqvcy j17g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500241; x=1767105041; 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=i+mbJkrstaIb7ND8mcI8yplZbeO1dtLYkHR6poh1ISc=; b=Pw4q75YB9GOdfbUubhT681X3HFVDEscnNq/CCxYrMni02O/scRWFmKy/8X8gdaqGvy no3ka6mxBVx6RT7Sxa+85CHy91Js9e4ogAIfLYGilS/heCpdRgql4wkfeI773NiL4IWe mZmX02JePUIieK4KjGQFBH9yOor+7lugI1Y+TXPWkhnEJvurwjCkgKHAoCjQBUwyn7Yd JRVWo+esBRCy5g2G6bn8UzbFzNhKSWEnl9JIoqfO00qnrMto1Qm7LNu4TLJm+Nc67iuI HpFuXmOBINT7z2wjUdFTkKqQQSHjwwIMMef+kqyt+b7B0j1flIn+6e/dvNmWzXIhTCPQ NS1w== X-Gm-Message-State: AOJu0YzskDRQAjGzhSPXGxTUDLTXuVz6ZdL9fwB9oP6VD2/4vh0X3uSx 5HU9R/KXjJAxDOd7J0kYiYEVbve4ouz5DxYzco9JGK9PE+c5pOAuDE17sC52ah5/hGlB0RHLlCw phbM47RCIJmOfuJTtSROgRHvIFWSFqbUq8DiRVQxtUcNAM23CbLf4votiTHSGUDmnrMgvTrTQ/5 cCGTAjf4a5yzQ++yPEia1phjVRnLuZUMc31Odg2g== X-Gm-Gg: AY/fxX6HJsKGa9YPbYj8DaQyf4/fdRM86gMut6oS1pIkfegT1LyjC7UulbiFm6REaz2 B7fifRmusAlweyRyc/hZ98/CUv5AohysPAumpyU4SIbSNPdv+qg+zILUSb5fYbLrn2m5ToDH7fq nX+jLfj/H0GDdqR7ciXnqZlAO3lRkPS9hHZSWRFGP+sNL5xlfKm+/7Mz9OIb3Ovszlz7hf4L1yx OvpHDpZwwpZJIO/7e3IBIIgXl5RoHmC1BilEwt4vSMUNmoUn4nBiegyMHEqUNN61QJbglLC0Lg1 Swh8nabs3oj1VmdIMAUL63qLlV9L7a6eAJLwHUd8yrccbybZEffqpgS8wE5RDxFj7rbTeIINcOI yDuM= X-Received: by 2002:a05:620a:2956:b0:8a1:426a:2cca with SMTP id af79cd13be357-8c08fa98cc6mr2100080485a.41.1766500237859; Tue, 23 Dec 2025 06:30:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWFtr4k+zHwZYzTo59XrWtxFAK+61blFvyMij+m7whmuVI0O4jmLu/a1FMTJnZPkxuT0Qm5Q== X-Received: by 2002:a05:620a:2956:b0:8a1:426a:2cca with SMTP id af79cd13be357-8c08fa98cc6mr2100064685a.41.1766500236598; Tue, 23 Dec 2025 06:30:36 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 28/31] tests/qtest/migration: Pass MigrateCommon into test functions Date: Tue, 23 Dec 2025 09:29:56 -0500 Message-ID: <20251223142959.1460293-29-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500489816158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas With the upcoming addition of the config QDict, the tests will need a better way of managing the memory of the test data than putting the test arguments on the stack of the test functions. The config QDict will need to be merged into the arguments of migrate_qmp* functions, which causes a refcount increment, so the test functions would need to allocate and deref the config QDict themselves. A better approach is to already pass the arguments into the test functions and do the memory management in the existing wrapper. There is already migration_test_destroy(), which is called for every test. Do the following: - merge the two existing wrappers, migration_test_wrapper() and migration_test_wrapper_full(). The latter was pioneer in passing data into the tests, but now all tests will receive data, so we don't need it anymore. The usage of migration_test_wrapper_full() was in passing a slightly different test name string into the cancel tests, so still keep the migration_test_add_suffix() function. - add (char *name, MigrateCommon *args) to the signature of all test functions. - alter any code to stop allocating args on the stack and instead use the object that came as parameter. - pass args around as needed. - while here, order args (MigrateCommon) before args->start (MigrateStart) and put a blank like in between. No functional change. Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-26-farosas@suse.de [peterx: fix a conflict with newly added mapped-ram+ignore-share test] Signed-off-by: Peter Xu --- tests/qtest/migration/migration-util.h | 8 +- tests/qtest/migration/compression-tests.c | 131 +++--- tests/qtest/migration/cpr-tests.c | 75 ++-- tests/qtest/migration/file-tests.c | 206 +++++----- tests/qtest/migration/migration-util.c | 26 +- tests/qtest/migration/misc-tests.c | 112 +++-- tests/qtest/migration/postcopy-tests.c | 82 ++-- tests/qtest/migration/precopy-tests.c | 348 +++++++--------- tests/qtest/migration/tls-tests.c | 477 ++++++++++------------ 9 files changed, 652 insertions(+), 813 deletions(-) diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index 44815e9c42..e73d69bab0 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -15,6 +15,8 @@ =20 #include "libqtest.h" =20 +#include "migration/framework.h" + typedef struct QTestMigrationState { bool stop_seen; bool resume_seen; @@ -50,9 +52,11 @@ static inline bool probe_o_direct_support(const char *tm= pfs) =20 bool ufd_version_check(bool *uffd_feature_thread_id); bool kvm_dirty_ring_supported(void); -void migration_test_add(const char *path, void (*fn)(void)); + +void migration_test_add(const char *path, + void (*fn)(char *name, MigrateCommon *args)); void migration_test_add_suffix(const char *path, const char *suffix, - void (*fn)(void *)); + void (*fn)(char *name, MigrateCommon *args)= ); char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); =20 diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index b827665b8e..845e622cd5 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -31,30 +31,25 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState = *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zstd"); } =20 -static void test_multifd_tcp_zstd(void) +static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_postcopy_tcp_zstd(void) +static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, - }; - - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_ZSTD */ =20 @@ -69,16 +64,14 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qatzip= "); } =20 -static void test_multifd_tcp_qatzip(void) +static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif =20 @@ -90,16 +83,14 @@ migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *= from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qpl"); } =20 -static void test_multifd_tcp_qpl(void) +static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_QPL */ =20 @@ -111,16 +102,14 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "uadk"); } =20 -static void test_multifd_tcp_uadk(void) +static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_UADK */ =20 @@ -132,25 +121,23 @@ migrate_hook_start_xbzrle(QTestState *from, return NULL; } =20 -static void test_precopy_unix_xbzrle(void) +static void test_precopy_unix_xbzrle(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_xbzrle, - .iterations =3D 2, - .start =3D { - .caps[MIGRATION_CAPABILITY_XBZRLE] =3D true, - }, - /* - * XBZRLE needs pages to be modified when doing the 2nd+ round - * iteration to have real data pushed to the stream. - */ - .live =3D true, - }; - - test_precopy_common(&args); + + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_xbzrle; + args->iterations =3D 2; + /* + * XBZRLE needs pages to be modified when doing the 2nd+ round + * iteration to have real data pushed to the stream. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_XBZRLE] =3D true; + + test_precopy_common(args); } =20 static void * @@ -167,16 +154,14 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zlib"); } =20 -static void test_multifd_tcp_zlib(void) +static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 static void migration_test_add_compression_smoke(MigrationTestEnv *env) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 2a186c6f35..0d97b5b89f 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -27,21 +27,19 @@ static void *migrate_hook_start_mode_reboot(QTestState = *from, QTestState *to) return NULL; } =20 -static void test_mode_reboot(void) +static void test_mode_reboot(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .start.mem_type =3D MEM_TYPE_SHMEM, - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_mode_reboot, - .start =3D { - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_mode_reboot; + + args->start.mem_type =3D MEM_TYPE_SHMEM; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + test_file_common(args, true); } =20 static void *test_mode_transfer_start(QTestState *from, QTestState *to) @@ -55,7 +53,7 @@ static void *test_mode_transfer_start(QTestState *from, Q= TestState *to) * migration, and cannot connect synchronously to the monitor, so defer * the target connection. */ -static void test_mode_transfer_common(bool incoming_defer) +static void test_mode_transfer_common(MigrateCommon *args, bool incoming_d= efer) { g_autofree char *cpr_path =3D g_strdup_printf("%s/cpr.sock", tmpfs); g_autofree char *mig_path =3D g_strdup_printf("%s/migsocket", tmpfs); @@ -85,31 +83,31 @@ static void test_mode_transfer_common(bool incoming_def= er) opts_target =3D g_strdup_printf("-incoming cpr,addr.transport=3Dsocket= ," "addr.type=3Dfd,addr.str=3D%d %s", cpr_sockfd, opts); - MigrateCommon args =3D { - .start.opts_source =3D opts, - .start.opts_target =3D opts_target, - .start.defer_target_connect =3D true, - .start.mem_type =3D MEM_TYPE_MEMFD, - .listen_uri =3D incoming_defer ? "defer" : uri, - .connect_channels =3D connect_channels, - .cpr_channel =3D cpr_channel, - .start_hook =3D test_mode_transfer_start, - }; - - if (test_precopy_common(&args) < 0) { + + args->listen_uri =3D incoming_defer ? "defer" : uri; + args->connect_channels =3D connect_channels; + args->cpr_channel =3D cpr_channel; + args->start_hook =3D test_mode_transfer_start; + + args->start.opts_source =3D opts; + args->start.opts_target =3D opts_target; + args->start.defer_target_connect =3D true; + args->start.mem_type =3D MEM_TYPE_MEMFD; + + if (test_precopy_common(args) < 0) { close(cpr_sockfd); unlink(cpr_path); } } =20 -static void test_mode_transfer(void) +static void test_mode_transfer(char *name, MigrateCommon *args) { - test_mode_transfer_common(NULL); + test_mode_transfer_common(args, false); } =20 -static void test_mode_transfer_defer(void) +static void test_mode_transfer_defer(char *name, MigrateCommon *args) { - test_mode_transfer_common(true); + test_mode_transfer_common(args, true); } =20 static void set_cpr_exec_args(QTestState *who, MigrateCommon *args) @@ -225,22 +223,21 @@ static void *test_mode_exec_start(QTestState *from, Q= TestState *to) return NULL; } =20 -static void test_mode_exec(void) +static void test_mode_exec(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); g_autofree char *listen_uri =3D g_strdup_printf("defer"); =20 - MigrateCommon args =3D { - .start.only_source =3D true, - .start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults", - .start.mem_type =3D MEM_TYPE_MEMFD, - .connect_uri =3D uri, - .listen_uri =3D listen_uri, - .start_hook =3D test_mode_exec_start, - }; + args->connect_uri =3D uri; + args->listen_uri =3D listen_uri; + args->start_hook =3D test_mode_exec_start; + + args->start.only_source =3D true; + args->start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults"; + args->start.mem_type =3D MEM_TYPE_MEMFD; =20 - test_cpr_exec(&args); + test_cpr_exec(args); } =20 void migration_test_add_cpr(MigrationTestEnv *env) diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index c196a703ff..5d1b861cf6 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -20,16 +20,14 @@ =20 static char *tmpfs; =20 -static void test_precopy_file(void) +static void test_precopy_file(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; =20 - test_file_common(&args, true); + test_file_common(args, true); } =20 #ifndef _WIN32 @@ -66,107 +64,94 @@ static void *migrate_hook_start_file_offset_fdset(QTes= tState *from, return NULL; } =20 -static void test_precopy_file_offset_fdset(void) +static void test_precopy_file_offset_fdset(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_file_offset_fdset, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_file_offset_fdset; =20 - test_file_common(&args, false); + test_file_common(args, false); } #endif =20 -static void test_precopy_file_offset(void) +static void test_precopy_file_offset(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D%d", tmp= fs, FILE_TEST_FILENAME, FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - }; =20 - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + test_file_common(args, false); } =20 -static void test_precopy_file_offset_bad(void) +static void test_precopy_file_offset_bad(char *name, MigrateCommon *args) { /* using a value not supported by qemu_strtosz() */ g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D0x20M", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .result =3D MIG_TEST_QMP_ERROR, - }; =20 - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->result =3D MIG_TEST_QMP_ERROR; + + test_file_common(args, false); } =20 -static void test_precopy_file_mapped_ram_live(void) +static void test_precopy_file_mapped_ram_live(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, false); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, false); } =20 -static void test_precopy_file_mapped_ram(void) +static void test_precopy_file_mapped_ram(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, true); } =20 -static void test_multifd_file_mapped_ram_live(void) +static void test_multifd_file_mapped_ram_live(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, false); } =20 -static void test_multifd_file_mapped_ram(void) +static void test_multifd_file_mapped_ram(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, true); } =20 static void *migrate_hook_start_multifd_mapped_ram_dio(QTestState *from, @@ -178,26 +163,23 @@ static void *migrate_hook_start_multifd_mapped_ram_di= o(QTestState *from, return NULL; } =20 -static void test_multifd_file_mapped_ram_dio(void) +static void test_multifd_file_mapped_ram_dio(char *name, MigrateCommon *ar= gs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_dio, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_dio; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 - test_file_common(&args, true); + test_file_common(args, true); } =20 #ifndef _WIN32 @@ -252,45 +234,41 @@ static void *migrate_hook_start_multifd_mapped_ram_fd= set(QTestState *from, return NULL; } =20 -static void test_multifd_file_mapped_ram_fdset(void) +static void test_multifd_file_mapped_ram_fdset(char *name, MigrateCommon *= args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset, - .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset; + args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_file_common(args, true); } =20 -static void test_multifd_file_mapped_ram_fdset_dio(void) +static void test_multifd_file_mapped_ram_fdset_dio(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio, - .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio; + args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 - test_file_common(&args, true); + test_file_common(args, true); } #endif /* !_WIN32 */ =20 @@ -303,20 +281,18 @@ static void migration_test_add_file_smoke(MigrationTe= stEnv *env) test_multifd_file_mapped_ram_dio); } =20 -static void test_precopy_file_mapped_ram_ignore_shared(void) +static void +test_precopy_file_mapped_ram_ignore_shared(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, - }, - }; - - test_file_common(&args, true); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + test_file_common(args, true); } =20 void migration_test_add_file(MigrationTestEnv *env) diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index 642cf50c8d..c2462306a1 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -235,14 +235,15 @@ char *resolve_machine_version(const char *alias, cons= t char *var1, =20 typedef struct { char *name; - void (*func)(void); - void (*func_full)(void *); + MigrateCommon *data; + void (*func)(char *name, MigrateCommon *args); } MigrationTest; =20 static void migration_test_destroy(gpointer data) { MigrationTest *test =3D (MigrationTest *)data; =20 + g_free(test->data); g_free(test->name); g_free(test); } @@ -251,11 +252,14 @@ static void migration_test_wrapper(const void *data) { MigrationTest *test =3D (MigrationTest *)data; =20 + test->data =3D g_new0(MigrateCommon, 1); + g_test_message("Running /%s%s", qtest_get_arch(), test->name); - test->func(); + test->func(test->name, test->data); } =20 -void migration_test_add(const char *path, void (*fn)(void)) +void migration_test_add(const char *path, + void (*fn)(char *name, MigrateCommon *args)) { MigrationTest *test =3D g_new0(MigrationTest, 1); =20 @@ -266,26 +270,18 @@ void migration_test_add(const char *path, void (*fn)(= void)) migration_test_destroy); } =20 -static void migration_test_wrapper_full(const void *data) -{ - MigrationTest *test =3D (MigrationTest *)data; - - g_test_message("Running /%s%s", qtest_get_arch(), test->name); - test->func_full(test->name); -} - void migration_test_add_suffix(const char *path, const char *suffix, - void (*fn)(void *)) + void (*fn)(char *name, MigrateCommon *args)) { MigrationTest *test =3D g_new0(MigrationTest, 1); =20 g_assert(g_str_has_suffix(path, "/")); g_assert(!g_str_has_prefix(suffix, "/")); =20 - test->func_full =3D fn; + test->func =3D fn; test->name =3D g_strconcat(path, suffix, NULL); =20 - qtest_add_data_func_full(test->name, test, migration_test_wrapper_full, + qtest_add_data_func_full(test->name, test, migration_test_wrapper, migration_test_destroy); } =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 20edaa51f5..810e9e6549 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -22,14 +22,13 @@ =20 static char *tmpfs; =20 -static void test_baddest(void) +static void test_baddest(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .hide_stderr =3D true - }; QTestState *from, *to; =20 - if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } migrate_qmp(from, to, "tcp:127.0.0.1:0", NULL, "{}"); @@ -38,24 +37,23 @@ static void test_baddest(void) } =20 #ifndef _WIN32 -static void test_analyze_script(void) +static void test_analyze_script(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - }; QTestState *from, *to; g_autofree char *uri =3D NULL; g_autofree char *file =3D NULL; int pid, wstatus; const char *python =3D g_getenv("PYTHON"); =20 + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + if (!python) { g_test_skip("PYTHON variable not set"); return; } =20 /* dummy url */ - if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { + if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } =20 @@ -92,16 +90,15 @@ static void test_analyze_script(void) } #endif =20 -static void test_ignore_shared(void) +static void test_ignore_shared(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; - MigrateStart args =3D { - .mem_type =3D MEM_TYPE_SHMEM, - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, - }; =20 - if (migrate_start(&from, &to, uri, &args)) { + args->start.mem_type =3D MEM_TYPE_SHMEM; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + if (migrate_start(&from, &to, uri, &args->start)) { return; } =20 @@ -161,45 +158,37 @@ static void do_test_validate_uuid(MigrateStart *args,= bool should_fail) migrate_end(from, to, false); } =20 -static void test_validate_uuid(void) +static void test_validate_uuid(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 11111111-1111-1111-1111-111111111111", - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.opts_target =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 -static void test_validate_uuid_error(void) +static void test_validate_uuid_error(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr =3D true, - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.opts_target =3D "-uuid 22222222-2222-2222-2222-22222222222= 2"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, true); + do_test_validate_uuid(&args->start, true); } =20 -static void test_validate_uuid_src_not_set(void) +static void test_validate_uuid_src_not_set(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr =3D true, - }; + args->start.opts_target =3D "-uuid 22222222-2222-2222-2222-22222222222= 2"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 -static void test_validate_uuid_dst_not_set(void) +static void test_validate_uuid_dst_not_set(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .hide_stderr =3D true, - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 static void do_test_validate_uri_channel(MigrateCommon *args) @@ -226,34 +215,27 @@ static void do_test_validate_uri_channel(MigrateCommo= n *args) migrate_end(from, to, false); } =20 -static void test_validate_uri_channels_both_set(void) +static void test_validate_uri_channels_both_set(char *name, MigrateCommon = *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "defer", - .connect_uri =3D "tcp:127.0.0.1:0", - .connect_channels =3D ("[ { ""'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]"), - }; - - do_test_validate_uri_channel(&args); + args->listen_uri =3D "defer", + args->connect_uri =3D "tcp:127.0.0.1:0", + args->connect_channels =3D ("[ { ""'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), + + args->start.hide_stderr =3D true; + + do_test_validate_uri_channel(args); } =20 -static void test_validate_uri_channels_none_set(void) +static void test_validate_uri_channels_none_set(char *name, MigrateCommon = *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "defer", - }; - - do_test_validate_uri_channel(&args); + args->listen_uri =3D "defer"; + args->start.hide_stderr =3D true; + + do_test_validate_uri_channel(args); } =20 static void migration_test_add_misc_smoke(MigrationTestEnv *env) diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 3773525843..7ae4d765d7 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -20,67 +20,51 @@ #include "qemu/range.h" #include "qemu/sockets.h" =20 -static void test_postcopy(void) +static void test_postcopy(char *name, MigrateCommon *args) { - MigrateCommon args =3D { }; - - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_suspend(void) +static void test_postcopy_suspend(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start.suspend_me =3D true, - }; + args->start.suspend_me =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_preempt(void) +static void test_postcopy_preempt(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_recovery(void) +static void test_postcopy_recovery(char *name, MigrateCommon *args) { - MigrateCommon args =3D { }; - - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_recovery_fail_handshake(void) +static void test_postcopy_recovery_fail_handshake(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY, - }; + args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_recovery_fail_reconnect(void) +static void test_postcopy_recovery_fail_reconnect(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH, - }; + args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_preempt_recovery(void) +static void test_postcopy_preempt_recovery(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 static void migration_test_add_postcopy_smoke(MigrationTestEnv *env) @@ -94,27 +78,19 @@ static void migration_test_add_postcopy_smoke(Migration= TestEnv *env) } } =20 -static void test_multifd_postcopy(void) +static void test_multifd_postcopy(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_multifd_postcopy_preempt(void) +static void test_multifd_postcopy_preempt(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; - - test_postcopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_common(args); } =20 void migration_test_add_postcopy(MigrationTestEnv *env) diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 57ca623de5..086d06a31c 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -35,68 +35,64 @@ =20 static char *tmpfs; =20 -static void test_precopy_unix_plain(void) +static void test_precopy_unix_plain(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * The simplest use case of precopy, covering smoke tests of - * get-dirty-log dirty tracking. - */ - .live =3D true, - }; =20 - test_precopy_common(&args); + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * The simplest use case of precopy, covering smoke tests of + * get-dirty-log dirty tracking. + */ + args->live =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_suspend_live(void) +static void test_precopy_unix_suspend_live(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * despite being live, the test is fast because the src - * suspends immediately. - */ - .live =3D true, - .start.suspend_me =3D true, - }; =20 - test_precopy_common(&args); + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * despite being live, the test is fast because the src + * suspends immediately. + */ + args->live =3D true; + + args->start.suspend_me =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_suspend_notlive(void) +static void test_precopy_unix_suspend_notlive(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - .start.suspend_me =3D true, - }; =20 - test_precopy_common(&args); + args->listen_uri =3D uri; + args->connect_uri =3D uri; + args->start.suspend_me =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_dirty_ring(void) +static void test_precopy_unix_dirty_ring(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .start =3D { - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * Besides the precopy/unix basic test, cover dirty ring interface - * rather than get-dirty-log. - */ - .live =3D true, - }; =20 - test_precopy_common(&args); + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * Besides the precopy/unix basic test, cover dirty ring interface + * rather than get-dirty-log. + */ + args->live =3D true; + + args->start.use_dirty_ring =3D true; + + test_precopy_common(args); } =20 #ifdef CONFIG_RDMA @@ -162,7 +158,7 @@ static int new_rdma_link(char *buffer, bool ipv6) return -1; } =20 -static void __test_precopy_rdma_plain(bool ipv6) +static void __test_precopy_rdma_plain(MigrateCommon *args, bool ipv6) { char buffer[128] =3D {}; =20 @@ -187,50 +183,43 @@ static void __test_precopy_rdma_plain(bool ipv6) **/ g_autofree char *uri =3D g_strdup_printf("rdma:%s:29200", buffer); =20 - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + args->listen_uri =3D uri; + args->connect_uri =3D uri; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_rdma_plain(void) +static void test_precopy_rdma_plain(char *name, MigrateCommon *args) { - __test_precopy_rdma_plain(false); + __test_precopy_rdma_plain(args, false); } =20 -static void test_precopy_rdma_plain_ipv6(void) +static void test_precopy_rdma_plain_ipv6(char *name, MigrateCommon *args) { - __test_precopy_rdma_plain(true); + __test_precopy_rdma_plain(args, true); } #endif =20 -static void test_precopy_tcp_plain(void) +static void test_precopy_tcp_plain(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_switchover_ack(void) +static void test_precopy_tcp_switchover_ack(char *name, MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start =3D { - .caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true, - .caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true, - }, - /* - * Source VM must be running in order to consider the switchover A= CK - * when deciding to do switchover or not. - */ - .live =3D true, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + /* + * Source VM must be running in order to consider the switchover ACK + * when deciding to do switchover or not. + */ + args->live =3D true; =20 - test_precopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true; + args->start.caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true; + + test_precopy_common(args); } =20 #ifndef _WIN32 @@ -291,15 +280,14 @@ static void migrate_hook_end_fd(QTestState *from, qobject_unref(rsp); } =20 -static void test_precopy_fd_socket(void) +static void test_precopy_fd_socket(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .connect_uri =3D "fd:fd-mig", - .start_hook =3D migrate_hook_start_fd, - .end_hook =3D migrate_hook_end_fd, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->connect_uri =3D "fd:fd-mig"; + args->start_hook =3D migrate_hook_start_fd; + args->end_hook =3D migrate_hook_end_fd; + + test_precopy_common(args); } =20 static void *migrate_hook_start_precopy_fd_file(QTestState *from, @@ -331,15 +319,14 @@ static void *migrate_hook_start_precopy_fd_file(QTest= State *from, return NULL; } =20 -static void test_precopy_fd_file(void) +static void test_precopy_fd_file(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .connect_uri =3D "fd:fd-mig", - .start_hook =3D migrate_hook_start_precopy_fd_file, - .end_hook =3D migrate_hook_end_fd, - }; - test_file_common(&args, true); + args->listen_uri =3D "defer"; + args->connect_uri =3D "fd:fd-mig"; + args->start_hook =3D migrate_hook_start_precopy_fd_file; + args->end_hook =3D migrate_hook_end_fd; + + test_file_common(args, true); } #endif /* _WIN32 */ =20 @@ -358,10 +345,9 @@ static void test_precopy_fd_file(void) * To make things even worse, we need to run the initial stage at * 3MB/s so we enter autoconverge even when host is (over)loaded. */ -static void test_auto_converge(void) +static void test_auto_converge(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateStart args =3D {}; QTestState *from, *to; int64_t percentage; =20 @@ -374,7 +360,7 @@ static void test_auto_converge(void) uint64_t prev_dirty_sync_cnt, dirty_sync_cnt; int max_try_count, hit =3D 0; =20 - if (migrate_start(&from, &to, uri, &args)) { + if (migrate_start(&from, &to, uri, &args->start)) { return; } =20 @@ -486,76 +472,68 @@ migrate_hook_start_precopy_tcp_multifd_no_zero_page(Q= TestState *from, return NULL; } =20 -static void test_multifd_tcp_uri_none(void) +static void test_multifd_tcp_uri_none(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_zero_page_legacy(void) +static void test_multifd_tcp_zero_page_legacy(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_l= egacy, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_= legacy; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_no_zero_page(void) +static void test_multifd_tcp_no_zero_page(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pag= e, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pa= ge; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_channels_none(void) +static void test_multifd_tcp_channels_none(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd, - .live =3D true, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .connect_channels =3D ("[ { 'channel-type': 'main'," + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; + args->live =3D true; + args->connect_channels =3D ("[ { 'channel-type': 'main'," " 'addr': { 'transport': 'socket'," " 'type': 'inet'," " 'host': '127.0.0.1'," - " 'port': '0' } } ]"), - }; - test_precopy_common(&args); + " 'port': '0' } } ]"); + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 /* @@ -569,14 +547,13 @@ static void test_multifd_tcp_channels_none(void) * * And see that it works */ -static void test_multifd_tcp_cancel(bool postcopy_ram) +static void test_multifd_tcp_cancel(MigrateCommon *args, bool postcopy_ram) { - MigrateStart args =3D { - .hide_stderr =3D true, - }; QTestState *from, *to, *to2; =20 - if (migrate_start(&from, &to, "defer", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "defer", &args->start)) { return; } =20 @@ -621,11 +598,9 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) */ wait_for_migration_status(from, "cancelled", NULL); =20 - args =3D (MigrateStart){ - .only_target =3D true, - }; + args->start.only_target =3D true; =20 - if (migrate_start(&from, &to2, "defer", &args)) { + if (migrate_start(&from, &to2, "defer", &args->start)) { return; } =20 @@ -656,14 +631,14 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) migrate_end(from, to2, true); } =20 -static void test_multifd_precopy_tcp_cancel(void) +static void test_multifd_precopy_tcp_cancel(char *name, MigrateCommon *arg= s) { - test_multifd_tcp_cancel(false); + test_multifd_tcp_cancel(args, false); } =20 -static void test_multifd_postcopy_tcp_cancel(void) +static void test_multifd_postcopy_tcp_cancel(char *name, MigrateCommon *ar= gs) { - test_multifd_tcp_cancel(true); + test_multifd_tcp_cancel(args, true); } =20 static void test_cancel_src_after_failed(QTestState *from, QTestState *to, @@ -786,17 +761,15 @@ static void test_cancel_src_pre_switchover(QTestState= *from, QTestState *to, (const char * []) { "completed", NULL }); } =20 -static void test_cancel_src_after_status(void *opaque) +static void test_cancel_src_after_status(char *test_path, MigrateCommon *a= rgs) { - const char *test_path =3D opaque; g_autofree char *phase =3D g_path_get_basename(test_path); g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; - MigrateStart args =3D { - .hide_stderr =3D true, - }; =20 - if (migrate_start(&from, &to, "defer", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "defer", &args->start)) { return; } =20 @@ -980,7 +953,7 @@ static void dirtylimit_stop_vm(QTestState *vm) unlink(path); } =20 -static void test_vcpu_dirty_limit(void) +static void test_vcpu_dirty_limit(char *name, MigrateCommon *args) { QTestState *vm; int64_t origin_rate; @@ -1107,7 +1080,7 @@ static void migrate_dirty_limit_wait_showup(QTestStat= e *from, * And see if dirty limit migration works correctly. * This test case involves many passes, so it runs in slow mode only. */ -static void test_dirty_limit(void) +static void test_dirty_limit(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -1128,17 +1101,15 @@ static void test_dirty_limit(void) */ const int64_t expected_threshold =3D max_bandwidth * downtime_limit / = 1000; int max_try_count =3D 10; - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + + args->start.hide_stderr =3D true; + args->start.use_dirty_ring =3D true; + + args->listen_uri =3D uri; + args->connect_uri =3D uri; =20 /* Start src, dst vm */ - if (migrate_start(&from, &to, args.listen_uri, &args.start)) { + if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } =20 @@ -1146,7 +1117,7 @@ static void test_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); =20 /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; @@ -1179,22 +1150,19 @@ static void test_dirty_limit(void) /* Assert dirty limit is not in service */ g_assert_cmpint(throttle_us_per_full, =3D=3D, 0); =20 - args =3D (MigrateCommon) { - .start =3D { - .only_target =3D true, - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + args->listen_uri =3D uri; + args->connect_uri =3D uri; + + args->start.only_target =3D true; + args->start.use_dirty_ring =3D true; =20 /* Restart dst vm, src vm already show up so we needn't wait anymore */ - if (migrate_start(&from, &to, args.listen_uri, &args.start)) { + if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } =20 /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index e0e8a7335c..6a20c65104 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -362,149 +362,128 @@ migrate_hook_end_tls_x509(QTestState *from, } #endif /* CONFIG_TASN1 */ =20 -static void test_postcopy_tls_psk(void) +static void test_postcopy_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_preempt_tls_psk(void) +static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_common(args); } =20 -static void test_postcopy_recovery_tls_psk(void) +static void test_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_multifd_postcopy_recovery_tls_psk(void) +static void test_multifd_postcopy_recovery_tls_psk(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 /* This contains preempt+recovery+tls test altogether */ -static void test_postcopy_preempt_all(void) -{ - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; +static void test_postcopy_preempt_all(char *name, MigrateCommon *args) +{ + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(&args); + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_recovery_common(args); } =20 -static void test_multifd_postcopy_preempt_recovery_tls_psk(void) +static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, + MigrateCommon *= args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(&args); + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_recovery_common(args); } =20 -static void test_precopy_unix_tls_psk(void) +static void test_precopy_unix_tls_psk(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_precopy_unix_tls_x509_default_host(void) +static void test_precopy_unix_tls_x509_default_host(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_tls_x509_override_host(void) +static void test_precopy_unix_tls_x509_override_host(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 -static void test_precopy_tcp_tls_psk_match(void) +static void test_precopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_psk_mismatch(void) +static void test_precopy_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_psk_mismatch, - .end_hook =3D migrate_hook_end_tls_psk, - .result =3D MIG_TEST_FAIL, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_psk_mismatch; + args->end_hook =3D migrate_hook_end_tls_psk; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) @@ -518,15 +497,13 @@ static void *migrate_hook_start_no_tls(QTestState *fr= om, QTestState *to) return data; } =20 -static void test_precopy_tcp_no_tls(void) +static void test_precopy_tcp_no_tls(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_no_tls, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_no_tls; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 static void * @@ -545,107 +522,96 @@ migrate_hook_start_tls_x509_no_host(QTestState *from= , QTestState *to) return data; } =20 -static void test_precopy_tcp_tls_no_hostname(void) +static void test_precopy_tcp_tls_no_hostname(char *name, MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_no_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - .start.hide_stderr =3D true, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_no_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + + args->start.hide_stderr =3D true; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_precopy_tcp_tls_x509_default_host(void) +static void test_precopy_tcp_tls_x509_default_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_override_host(void) +static void test_precopy_tcp_tls_x509_override_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_mismatch_host(void) +static void test_precopy_tcp_tls_x509_mismatch_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_mismatch_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_mismatch_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + + args->start.hide_stderr =3D true; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_friendly_client(void) +static void test_precopy_tcp_tls_x509_friendly_client(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_friendly_client, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_friendly_client; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_hostile_client(void) +static void test_precopy_tcp_tls_x509_hostile_client(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_hostile_client, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_hostile_client; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_allow_anon_client(void) +static void test_precopy_tcp_tls_x509_allow_anon_client(char *name, + MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_allow_anon_client, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_allow_anon_client; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_reject_anon_client(void) +static void test_precopy_tcp_tls_x509_reject_anon_client(char *name, + MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_reject_anon_client, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_reject_anon_client; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; =20 - test_precopy_common(&args); + args->start.hide_stderr =3D true; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 @@ -707,77 +673,70 @@ migrate_hook_start_multifd_tls_x509_reject_anon_clien= t(QTestState *from, } #endif /* CONFIG_TASN1 */ =20 -static void test_multifd_tcp_tls_psk_match(void) +static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_psk_mismatch(void) +static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch, - .end_hook =3D migrate_hook_end_tls_psk, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; + args->end_hook =3D migrate_hook_end_tls_psk; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_postcopy_tcp_tls_psk_match(void) +static void test_multifd_postcopy_tcp_tls_psk_match(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_multifd_tcp_tls_x509_default_host(void) -{ - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); +static void test_multifd_tcp_tls_x509_default_host(char *name, + MigrateCommon *args) +{ + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_override_host(void) +static void test_multifd_tcp_tls_x509_override_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_mismatch_host(void) +static void test_multifd_tcp_tls_x509_mismatch_host(char *name, + MigrateCommon *args) { /* * This has different behaviour to the non-multifd case. @@ -792,45 +751,41 @@ static void test_multifd_tcp_tls_x509_mismatch_host(v= oid) * to load migration state, and thus just aborts the migration * without exiting. */ - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_allow_anon_client(void) +static void test_multifd_tcp_tls_x509_allow_anon_client(char *name, + MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cli= ent, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_reject_anon_client(void) +static void test_multifd_tcp_tls_x509_reject_anon_client(char *name, + MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_cl= ient, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500451; cv=none; d=zohomail.com; s=zohoarc; b=dBUzq13grvlyR+n7fZtPRoM0/MZtFKqvU1oiunxQTditf4EuFNwUjTVUKY2X6kMo5PlmFB6FqKnwH1lAxiFXlIwKCeX5S/QAgNsB57ze2TweLt4zqUsevXoCVwkJ+tOSSxHnYSxt3FtENeS2yxgDMBUacr/WSgxnlJHcWOtVJiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500451; 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=Fp4ZOzYBAvn1TvsTfSPIyPaAQ9Z1cZ4fCzi5usLsWzY=; b=GiSQ2M/YL1xJw1xBFRMMEGKEyFMbCgRk3SqN/OgHeY9LLDIM2QNqhj9JsPesDk36zY6jY5uma/imotK3PjeMSWm84ziSEkNgzSSkyVxctemc52Flo9daWhcb0Mg4S0sCLAqBzYD9McmqXs9gF8kOvlsnkTMFBy7T9gs84xlIwXI= 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 176650045127238.3530723652799; Tue, 23 Dec 2025 06:34:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QM-0003Jc-O8; Tue, 23 Dec 2025 09:31:44 -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 1vY3Pb-0001P0-4J for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:59 -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 1vY3PT-0003rv-KE for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:49 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-E9te049kN_O0ZUW3ppeKrQ-1; Tue, 23 Dec 2025 09:30:44 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b9ff555d2dso1203549785a.0 for ; Tue, 23 Dec 2025 06:30:44 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500245; 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=Fp4ZOzYBAvn1TvsTfSPIyPaAQ9Z1cZ4fCzi5usLsWzY=; b=MLGtMDWeZhb4THRwL/oOFIr7dKy/iJGqcW6Y+SP5hjCC5A8mQzE5iq63L+RQlXQdoAQ+Du nVBHpkiDxEjg5hUOIm92gLXv8luEuPxXFuVPNXhj+O18B+UzmiGZ4xSPPSAuHAWJ++c8JQ fqFod5BqfhRwcrWSFINnPTax+o4Th8Q= X-MC-Unique: E9te049kN_O0ZUW3ppeKrQ-1 X-Mimecast-MFC-AGG-ID: E9te049kN_O0ZUW3ppeKrQ_1766500244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500243; x=1767105043; 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=Fp4ZOzYBAvn1TvsTfSPIyPaAQ9Z1cZ4fCzi5usLsWzY=; b=EPMYWjP2UxbSXMvVxgTKV6VcQieUXo5cnlDn/C0mzoRjpJTBEhab5pgIciBO+0OuPK Dxj5zXvcR5Sg8O/UmkJRR9EQQvoo26+ecu2y1vYJQ833fFiZscOsg6pYpKRjUQfyGnSf 4hJwO473NeRj6X3iKRdHO58kd07aTXUJ1WxMCHnti2Ri/9pblriO/nroa/ESVE1bB7Qh 8qHtySGorkGZsm7iR5is4dE5soyLHRksqjZaWKbYPPZtR1tlXkh5gvChhMselIXHqyI8 SFp4MlCtV1rqUWlGXopy/Se2y4AIN2RyR7+aLyXt2KEixICRUg8em8Whc+k27yy5T8Zu Swmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500243; x=1767105043; 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=Fp4ZOzYBAvn1TvsTfSPIyPaAQ9Z1cZ4fCzi5usLsWzY=; b=gODdo9DOvPl+sThA+VJ3bjpbqxoeg6x/t4Th03PZl9raw9rsxRQi02xHx+6K7i9BUo 61XpBQkhAja/mJdssOXW+nM93GAM3NutVd5DPlMIrwgbYC7p8c5u74P79rupzILBtYsa ruFQl+qVu9PUiM1ERfTATdG/dQQ/UDf7PWt15AKgbr0A7mwQghwSs2lN/eBUjZxGXz3m saDBrmRpZai3sHlQ/XuaKxx/pQqSBUF+dQMJh+7+z+tBzSWs422Bau738Jj1C7iA509j lCXIvSduqoZdMDwgcRIn8nXUv7dwKWHhXfXgPTKvexoxxjHlZM+QHYpKGTIgvgl4vXY3 tzPg== X-Gm-Message-State: AOJu0YyCdvFDA6X0I8I97N+ZZlF0yUC2eU8FcGL3UOgvHsx1kXwqT8UR SqapwsnThsN5OgySd9Nnb5biCxIVMYsvZOeG0k2zrYofBlyUdAm74qMcPbO/y9osArOHCHq0aYN SBz4FKi3RWLNZNS7hFoeCHorU+0TG3E/PsWM5JaoK2zasoXLVRFll+dF87BbIxHq7bdoIFOpW1A zet3JzdR9k9feW0GxT/qh/d2xlMNd9EfTuVFxvLA== X-Gm-Gg: AY/fxX4aPso2OMJFkw08zQLMdhk4DpZ7s20hp8BUTu0v+2Kxso83P3VD7Wdr+R/D872 VAAEFAlDRSjinUupSgqxdgwCEYzhp/m0saf5/K3H4z2tijVnVei57p3sPNg2CikoTMM4+ho6P+z 4YPXoJWVdvJtbCyrIva9tPh8lSjbFCL/2HQ48Pj5QiC8Z3zIHCwoh/UMfi/JseYnu/5dew080gr THMc9Afpp5aw9a++ebzAQpLYTP7k4GVFBtASjcr6ekgjhAysKc70DWBk2l8wHA5LdBZaGrFETl/ JpOtqpYe1VWU/RlcHruK6wEAoFUwnoLved50573zgW5LD/cmCbOvq9tK4RRTRIWcIBzfZb2vcuF wt7Q= X-Received: by 2002:a05:620a:198e:b0:8b2:e533:66f7 with SMTP id af79cd13be357-8c08f655061mr2161591985a.10.1766500238481; Tue, 23 Dec 2025 06:30:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0WAclwNbrI8wZapYDsbuZMhGhvONV2TlgDZ65d9ODeSK2sQgfCqNT+jy1Rx8a+pm0u3Ksog== X-Received: by 2002:a05:620a:198e:b0:8b2:e533:66f7 with SMTP id af79cd13be357-8c08f655061mr2161583985a.10.1766500237925; Tue, 23 Dec 2025 06:30:37 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu Subject: [PULL 29/31] tests/qtest/migration: Pass MigrateStart into cancel tests Date: Tue, 23 Dec 2025 09:29:57 -0500 Message-ID: <20251223142959.1460293-30-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500451471158500 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Pass the "args" parameter to the cancel tests so they can access the config object which will be part of this struct. Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251215220041.12657-27-farosas@suse.de Signed-off-by: Peter Xu --- tests/qtest/migration/precopy-tests.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 086d06a31c..aca7ed51ef 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -642,7 +642,8 @@ static void test_multifd_postcopy_tcp_cancel(char *name= , MigrateCommon *args) } =20 static void test_cancel_src_after_failed(QTestState *from, QTestState *to, - const char *uri, const char *phas= e) + const char *uri, const char *phas= e, + MigrateStart *args) { /* * No migrate_incoming_qmp() at the start to force source into @@ -669,7 +670,8 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, } =20 static void test_cancel_src_after_cancelled(QTestState *from, QTestState *= to, - const char *uri, const char *p= hase) + const char *uri, const char *p= hase, + MigrateStart *args) { migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 @@ -693,7 +695,8 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, } =20 static void test_cancel_src_after_complete(QTestState *from, QTestState *t= o, - const char *uri, const char *ph= ase) + const char *uri, const char *ph= ase, + MigrateStart *args) { migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 @@ -714,7 +717,8 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, } =20 static void test_cancel_src_after_none(QTestState *from, QTestState *to, - const char *uri, const char *phase) + const char *uri, const char *phase, + MigrateStart *args) { /* * Test that cancelling without a migration happening does not @@ -735,7 +739,8 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, } =20 static void test_cancel_src_pre_switchover(QTestState *from, QTestState *t= o, - const char *uri, const char *ph= ase) + const char *uri, const char *ph= ase, + MigrateStart *args) { migrate_set_capability(from, "pause-before-switchover", true); migrate_set_capability(to, "pause-before-switchover", true); @@ -775,20 +780,20 @@ static void test_cancel_src_after_status(char *test_p= ath, MigrateCommon *args) =20 if (g_str_equal(phase, "cancelling") || g_str_equal(phase, "cancelled")) { - test_cancel_src_after_cancelled(from, to, uri, phase); + test_cancel_src_after_cancelled(from, to, uri, phase, &args->start= ); =20 } else if (g_str_equal(phase, "completed")) { - test_cancel_src_after_complete(from, to, uri, phase); + test_cancel_src_after_complete(from, to, uri, phase, &args->start); =20 } else if (g_str_equal(phase, "failed")) { - test_cancel_src_after_failed(from, to, uri, phase); + test_cancel_src_after_failed(from, to, uri, phase, &args->start); =20 } else if (g_str_equal(phase, "none")) { - test_cancel_src_after_none(from, to, uri, phase); + test_cancel_src_after_none(from, to, uri, phase, &args->start); =20 } else { /* any state that comes before pre-switchover */ - test_cancel_src_pre_switchover(from, to, uri, phase); + test_cancel_src_pre_switchover(from, to, uri, phase, &args->start); } =20 migrate_end(from, to, false); --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500276; cv=none; d=zohomail.com; s=zohoarc; b=WV8Fp24L6M4oD2bKLosN9fFhwi1ahcN60EfvPZ4kCaY1qDAG3HzCubuzuTJkeQV7hjgY5QduNCxYRaTM5c5Ual66K65xUH/6SrMBMcCNJAeDlkH2M9aVNRjEWm3q4ouBeIJtd4mONoceCLxTcrbh6secM5MKwKS06Jm6/0bGGuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500276; 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=DCIAkPoZCfy6QtVMzxUWVZjrB/qkNczGej6JkiZHhTQ=; b=PZ72c6mlYYWZZXXM5yTKunNdcb212kt5km2wrwB1EeWNMCfpNsxyhD6iuOwBXrJFbCA67M+68Ms5eMuP7WToyMzvzQlu+ar/P87CZ/lhDT1vvtCA4HfCA83mZMTjt2p8j2Io+AoHUPFwvRpsIMMQgQhG+Qy91DC1xUqrdXjRwbc= 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 1766500276087248.87738689491914; Tue, 23 Dec 2025 06:31:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3Ps-0001rz-OY; Tue, 23 Dec 2025 09:31: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 1vY3Pb-0001P2-57 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:31:00 -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 1vY3PT-0003qx-Je for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:49 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-zAn1yh5yO9aNavYE_942-w-1; Tue, 23 Dec 2025 09:30:42 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b245c49d0cso1158076185a.3 for ; Tue, 23 Dec 2025 06:30:41 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500243; 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=DCIAkPoZCfy6QtVMzxUWVZjrB/qkNczGej6JkiZHhTQ=; b=aB+iAyJTPUrEZUUqGQWcCoNqpWtPoqhUdurIWBK2G8pEtBnEbNT+ML+tVtJkjJiu7TkLfK ML+XTSSPlIxSqxXtMLxFPWNoeclAtQrOBT6npBD4qfT3jpWPW7l/rYT97biax4M6n1JNYc Cakqhz9mIs1mfwl+lwzxB1Cf3j+Jzmc= X-MC-Unique: zAn1yh5yO9aNavYE_942-w-1 X-Mimecast-MFC-AGG-ID: zAn1yh5yO9aNavYE_942-w_1766500241 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500241; x=1767105041; 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=DCIAkPoZCfy6QtVMzxUWVZjrB/qkNczGej6JkiZHhTQ=; b=VM+GNHiRnwqqdfaGwACeXT6oQBl5tpOzpwHeewMof0WgAkQA31ltVyLW0/uyeIP7EN mCVnYmjeM8nHJuy/qXXtOMYHzIXjgE0x04XfhTGpavZyCQOgCiiQioOWpHdsucFbXhuM sTH7oqkeK2vNH7ybl+jb9M+bXrE7yRQa9ZUWJCa8YYFuj4ZCcydVbu4Y1Ea08jEKp2FY 0cfrIuVO2Oz9b8yFtWYBWSt61NnQSPH4Zbv/sUps+XnjWMoYHX1Z6GEKjun06z258G4P NxRztKP6WeqpIzseS12rQfYMGvUIY4cj0KGO/AuKASqlJRFxteN/ducF3CoEkfRFaA0o t2Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500241; x=1767105041; 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=DCIAkPoZCfy6QtVMzxUWVZjrB/qkNczGej6JkiZHhTQ=; b=uW09jeJ6p3AU/pg2+7NHpL5RyhDmZ57yMjs1qLELp9mOlgWTBltL/SAQJPyWOlocXd N1DJh4H+WKsxoIys0BSwfj6HxRqLTM7kdu7zcn2aYeI1O0hPwqj7OjgD2xaQokKtCL7G MVhjyHnOlKCVe/Twe2Qg/+/fjJ5Tl2ghPanj8d6Aycbq0Ri+bh1HyyzKmxCiJS/KQ8If au1yyCdZdSatJAasthE0Ng1jYHzefa5WclBgIikiXSNHMv2EpJbkLq9nm0CfeP5Hr8uO l3X6zTu+kx5kJyA/XgXmWLKxRTzBRhVknOej3gKjuUlrOvpDl4ABUnkes9i36zVxqMXp 6nVA== X-Gm-Message-State: AOJu0Yyz/YtPo0pMZ/hONmrOU/T/iSAeyUhFJROs+ByJL4/rOsWGSSr5 dJhvtdJOgOGAmr6NriEtXTDfMpKZm8SsyXmrV6oW6egOejY3MB2ychZX3kXPK8uftOYMydA4nMq C/3XKhrSpXo3UVLEZQ8w5eJ8pXUYacRrpQLZkpIix++ndDh/F0pwdYV2zGXei5zps9MJ5dhxjZf 7OjiiSJZIqoosPNy6xMH4q4HD9yCnfgbxlkp8DMg== X-Gm-Gg: AY/fxX5Y52g9zqY2GoqSrJKaOFvNaxlftbc/Np8cKprfNOhQJwNnIhZfOy32v1G+WTc 097zC9hrF4mI4oxp7tcSLkj4YHCRqlocxBl5hcBx3gedWFwh92Zw9NX9ena3SEJG+5aCLTvx/z3 ev0PGRokFouXK+XBrwcBpFvc3UEmBEAyaMzGJISg3NwOZvwCn7WV9mKTwf3OJSnWDsEmsqlfB1o 7Mgbq/2GqkzS4eRBPPspsi5qmuF4QWN21kaAhIfmEzTjTgZ7au2MhNp1mWfPC2lQjg7HA5cyCx3 h9z/F+nTd+a8X9KxO9ePSEh/h1KCKWo7rTxF5WjnguWNuKb21TMOPHqa4aOIgLGBQbbh/ef5Zuq BRJU= X-Received: by 2002:a05:620a:29d3:b0:8b1:59d9:f1f2 with SMTP id af79cd13be357-8c08f667426mr1955963985a.24.1766500240585; Tue, 23 Dec 2025 06:30:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnmNZlWx21tX5PSPF0NGo1pc9kuQXDaLZuw/cfWz7mqfucJxxRykWn+Tw3Pqmt2tUw4tQKwg== X-Received: by 2002:a05:620a:29d3:b0:8b1:59d9:f1f2 with SMTP id af79cd13be357-8c08f667426mr1955941385a.24.1766500239052; Tue, 23 Dec 2025 06:30:39 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , Chuang Xu Subject: [PULL 30/31] migration: merge fragmented clear_dirty ioctls Date: Tue, 23 Dec 2025 09:29:58 -0500 Message-ID: <20251223142959.1460293-31-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500276802158500 Content-Type: text/plain; charset="utf-8" From: Chuang Xu In our long-term experience in Bytedance, we've found that under the same load, live migration of larger VMs with more devices is often more difficult to converge (requiring a larger downtime limit). Through some testing and calculations, we conclude that bitmap sync time affects the calculation of live migration bandwidth. When the addresses processed are not aligned, a large number of clear_dirty ioctl occur (e.g. a 4MB misaligned memory can generate 2048 clear_dirty ioctls from two different memory_listener), which increases the time required for bitmap_sync and makes it more difficult for dirty pages to converge. For a 64C256G vm with 8 vhost-user-net(32 queue per nic) and 16 vhost-user-blk(4 queue per blk), the sync time is as high as *73ms* (tested with 10GBps dirty rate, the sync time increases as the dirty page rate increases), Here are each part of the sync time: - sync from kvm to ram_list: 2.5ms - vhost_log_sync:3ms - sync aligned memory from ram_list to RAMBlock: 5ms - sync misaligned memory from ram_list to RAMBlock: 61ms Attempt to merge those fragmented clear_dirty ioctls, then syncing misaligned memory from ram_list to RAMBlock takes only about 1ms, and the total sync time is only *12ms*. Signed-off-by: Chuang Xu Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251218114220.83354-1-xuchuangxclwt@byteda= nce.com [peterx: drop var "offset" in physical_memory_sync_dirty_bitmap] Signed-off-by: Peter Xu --- include/system/physmem.h | 7 +++--- accel/tcg/cputlb.c | 5 +++-- migration/ram.c | 19 +++++----------- system/memory.c | 2 +- system/physmem.c | 48 +++++++++++++++++++++++++++------------- 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/include/system/physmem.h b/include/system/physmem.h index 879f6eae38..a59724ef10 100644 --- a/include/system/physmem.h +++ b/include/system/physmem.h @@ -39,9 +39,10 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned lon= g *bitmap, =20 void physical_memory_dirty_bits_cleared(ram_addr_t start, ram_addr_t lengt= h); =20 -bool physical_memory_test_and_clear_dirty(ram_addr_t start, - ram_addr_t length, - unsigned client); +uint64_t physical_memory_test_and_clear_dirty(ram_addr_t start, + ram_addr_t length, + unsigned client, + unsigned long *bmap); =20 DirtyBitmapSnapshot * physical_memory_snapshot_and_clear_dirty(MemoryRegion *mr, hwaddr offset, diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd1606c856..c8827c8b0d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -857,8 +857,9 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUS= tate *src_cpu, void tlb_protect_code(ram_addr_t ram_addr) { physical_memory_test_and_clear_dirty(ram_addr & TARGET_PAGE_MASK, - TARGET_PAGE_SIZE, - DIRTY_MEMORY_CODE); + TARGET_PAGE_SIZE, + DIRTY_MEMORY_CODE, + NULL); } =20 /* update the TLB so that writes in physical page 'phys_addr' are no longer diff --git a/migration/ram.c b/migration/ram.c index df7e154877..c403fd73a6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -941,7 +941,6 @@ static uint64_t physical_memory_sync_dirty_bitmap(RAMBl= ock *rb, ram_addr_t start, ram_addr_t length) { - ram_addr_t addr; unsigned long word =3D BIT_WORD((start + rb->offset) >> TARGET_PAGE_BI= TS); uint64_t num_dirty =3D 0; unsigned long *dest =3D rb->bmap; @@ -993,19 +992,11 @@ static uint64_t physical_memory_sync_dirty_bitmap(RAM= Block *rb, memory_region_clear_dirty_bitmap(rb->mr, start, length); } } else { - ram_addr_t offset =3D rb->offset; - - for (addr =3D 0; addr < length; addr +=3D TARGET_PAGE_SIZE) { - if (physical_memory_test_and_clear_dirty( - start + addr + offset, - TARGET_PAGE_SIZE, - DIRTY_MEMORY_MIGRATION)) { - long k =3D (start + addr) >> TARGET_PAGE_BITS; - if (!test_and_set_bit(k, dest)) { - num_dirty++; - } - } - } + num_dirty =3D physical_memory_test_and_clear_dirty( + start + rb->offset, + length, + DIRTY_MEMORY_MIGRATION, + dest); } =20 return num_dirty; diff --git a/system/memory.c b/system/memory.c index 8b84661ae3..666364392d 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2424,7 +2424,7 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwad= dr addr, { assert(mr->ram_block); physical_memory_test_and_clear_dirty( - memory_region_get_ram_addr(mr) + addr, size, client); + memory_region_get_ram_addr(mr) + addr, size, client, NULL); } =20 int memory_region_get_fd(MemoryRegion *mr) diff --git a/system/physmem.c b/system/physmem.c index c9869e4049..26bf30af17 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1089,19 +1089,30 @@ void physical_memory_set_dirty_range(ram_addr_t sta= rt, ram_addr_t length, } } =20 -/* Note: start and end must be within the same ram block. */ -bool physical_memory_test_and_clear_dirty(ram_addr_t start, +/* + * Note: start and end must be within the same ram block. + * + * @bmap usage: + * - When @bmap is provided, set bits for dirty pages, but + * only count those pages if the bit wasn't already set in @bmap. + * - When @bmap is NULL, count all dirty pages in the range. + * + * @return: + * - Number of dirty guest pages found within [start, start + length). + */ +uint64_t physical_memory_test_and_clear_dirty(ram_addr_t start, ram_addr_t length, - unsigned client) + unsigned client, + unsigned long *bmap) { DirtyMemoryBlocks *blocks; unsigned long end, page, start_page; - bool dirty =3D false; + uint64_t num_dirty =3D 0; RAMBlock *ramblock; uint64_t mr_offset, mr_size; =20 if (length =3D=3D 0) { - return false; + return 0; } =20 end =3D TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; @@ -1118,12 +1129,19 @@ bool physical_memory_test_and_clear_dirty(ram_addr_= t start, while (page < end) { unsigned long idx =3D page / DIRTY_MEMORY_BLOCK_SIZE; unsigned long offset =3D page % DIRTY_MEMORY_BLOCK_SIZE; - unsigned long num =3D MIN(end - page, - DIRTY_MEMORY_BLOCK_SIZE - offset); =20 - dirty |=3D bitmap_test_and_clear_atomic(blocks->blocks[idx], - offset, num); - page +=3D num; + if (bitmap_test_and_clear_atomic(blocks->blocks[idx], offset, = 1)) { + if (bmap) { + unsigned long k =3D page - (ramblock->offset >> TARGET= _PAGE_BITS); + if (!test_and_set_bit(k, bmap)) { + num_dirty++; + } + } else { + num_dirty++; + } + } + + page++; } =20 mr_offset =3D (ram_addr_t)(start_page << TARGET_PAGE_BITS) - rambl= ock->offset; @@ -1131,18 +1149,18 @@ bool physical_memory_test_and_clear_dirty(ram_addr_= t start, memory_region_clear_dirty_bitmap(ramblock->mr, mr_offset, mr_size); } =20 - if (dirty) { + if (num_dirty) { physical_memory_dirty_bits_cleared(start, length); } =20 - return dirty; + return num_dirty; } =20 static void physical_memory_clear_dirty_range(ram_addr_t addr, ram_addr_t = length) { - physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_MIGRAT= ION); - physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_VGA); - physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_CODE); + physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_MIGRAT= ION, NULL); + physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_VGA, N= ULL); + physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_CODE, = NULL); } =20 DirtyBitmapSnapshot *physical_memory_snapshot_and_clear_dirty --=20 2.50.1 From nobody Mon Feb 9 00:26:18 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=1766500444; cv=none; d=zohomail.com; s=zohoarc; b=lczIfZy6+UmTtLzazPawlPoU0acOtABYDUJY4rOSmihr4iqe0X4flQODy3ShJWIZi6x6YcZEyGjD+sV1K5RFeFoabtU3vh8Vo2BKJ4yxn/3ud9GDnJW+9HRxJdGeGr0N/aTVobFjMuIpnhV07aPUH2PCHV3+lg35sXWw+QfKav4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766500444; 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=zi9Y9cTPFP/vgj+iqezmt6CCctlne0VxIJRp1HznPmw=; b=mVvYrAHr2ysFcto2OJFOlRDsHanIL3FfSSg+tatj+BaR4fQFbd7hYCaYuU7mVUJ2iYhLXdlOKS/g2mEKCuoa0d+k2m9kR2kteTK+MgHExjPwz5mLHWFXuc1BbjUvuO3Gofy4igAr6VnTQQgsINFRTtYHkgjooN2gQFaLEOidc2E= 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 1766500444187990.3439342274041; Tue, 23 Dec 2025 06:34:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vY3QM-0003Je-PC; Tue, 23 Dec 2025 09:31:44 -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 1vY3Pb-0001P1-56 for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:31:00 -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 1vY3PR-0003r6-Mx for qemu-devel@nongnu.org; Tue, 23 Dec 2025 09:30:49 -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-591-eBmN_ywhNKyogKfKaqmXGg-1; Tue, 23 Dec 2025 09:30:42 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b9fa6f808cso1432442185a.1 for ; Tue, 23 Dec 2025 06:30:42 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm1096163285a.4.2025.12.23.06.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 06:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766500243; 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=zi9Y9cTPFP/vgj+iqezmt6CCctlne0VxIJRp1HznPmw=; b=QVfbpuhIFgdQl4wgwuTKQQAAnX6is2HCaskgY2yIYuJdef0PBBf8fo12f6gOid27CVS45i jUvJeRrnEB8Mez9EX5R+1zX4XZu9WCb2cPj30RlCnSAL3V6JIN8MJwMWnPr4NztdWxFp7R fwS8vNSeJiIAXiHIHDJUKjCZEDJ90s0= X-MC-Unique: eBmN_ywhNKyogKfKaqmXGg-1 X-Mimecast-MFC-AGG-ID: eBmN_ywhNKyogKfKaqmXGg_1766500242 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766500241; x=1767105041; 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=zi9Y9cTPFP/vgj+iqezmt6CCctlne0VxIJRp1HznPmw=; b=sKy59Y5dC7+yrxfqJblQ8nYLnc1nbXL44zpnapsIlf3GYASLR4SqGmfAtUMZQ5XBgD yaSYXhhS8W52z8UpClShwNQGhmHUGhjbt6ZuAzKstnFF9NRFVgtGLHV4j84G3Xmpdj8u m5He83siR8i/x5Dy34HcRcE2FVHcTKTG9Qw9FrgZ9vKY0Z3UxRmCITpKasXnAOdOV425 I+hNMCTpC1aQGqz6PIUtDXDTrqWCF73/yaaiUl1YgX+CO1ZyLMxxl+1EicXJ81cVa4De FkW4AGXgwUuuSGhJMkHuh0vwrxGv/e1q3rBmueSgIW4WL2scrNirmIzOaFpBFNBDfjFL sBmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766500241; x=1767105041; 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=zi9Y9cTPFP/vgj+iqezmt6CCctlne0VxIJRp1HznPmw=; b=Wxf75m5K971tzCeNd6Fv5VLp80AuMxx1J4kPwJ184XVdU15WnzZgEC1wuR1g9mBHYy otU5KyZRCjyajU4XCWu7lKwnnYXccY+uMHEeLmWLEcXeg9e+kaCS+8owx1fItQpIY4LD WWijQl1rs3OR8pJdndcqNwPSb8k+9rGVKyQ73uQsQuNMq/qQdtWVyJ8Bro7LcNtqia89 KM/gaDC1P8D0YeztBOrKtLdr/8DB5l9LqBWqN/C3JLXj29aZtsPAmu6w2KhzIBar2lMx PnVacouFDQCFIfU+LABFkWz5T7vX7Chf6HlyvM3nLYcaVO2+X44ntn5Wn7ReedReYkBY 7S1Q== X-Gm-Message-State: AOJu0YzvGDUkXIOhTgnQgVcXLwNAANv9ur2SGdFatK64WcfvSQs2jPaq 1FgXc2EnM0qTjsPer4bKcWf7OuhfMyO0RQZYpQqPbhJIjRR2jjMK091aIXPBm+PiacLZG/gZ4Mc 9QXGSYDuGvy0gqDWQWgOQm1KIx9ciCmja5kGNTLAi+Qm3yGwBJKrIIKyoNX1KhS9JMpVDJkumEh 5q+ZdHrT+/iLbyXOSU+7JsYxa1p7y4nGKvsAJmBA== X-Gm-Gg: AY/fxX6ralQSGpcrtssg7dap86M7zkoIL5yoP03RU6Q8SrLUcXRel75C7qjKbx4c4dc worK56k735Vt70lgGgfpGqyRtgHAcYvLgtZkVuVg/1PZ0jMygeWKBKfu3fFXxR/9YaTcrnvoeNm 0B0q0GO7i9boh7GwtfEF7cN4KlOwMTD8IltyBPnb6suWVXkjPEPiAhwVbSOe5nPh9Xq2aYvLDrf N+Kcz5BDyZqk7NAUdqHC1Lac/EZh15kYBPpBDH/w67UNwP9Y8+M+O+Nns8uBZ+AaoAOItz37joL qnYRI6fnXd3XwxJST012kzKMmbHMZdNSXLOy2b3gS4CWfkd8LNhgmGCsWDB+UJARRwSK/DDiflC Kwds= X-Received: by 2002:a05:620a:4714:b0:8b2:5649:25ef with SMTP id af79cd13be357-8c08fbdd370mr2322115685a.21.1766500240850; Tue, 23 Dec 2025 06:30:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHn6xigRA/tigcXQrX9DxF4E7YVSpCnsWjYCFxRtSTceB3ib8b5i2Gi4l8un5kaKYwxa8m0/w== X-Received: by 2002:a05:620a:4714:b0:8b2:5649:25ef with SMTP id af79cd13be357-8c08fbdd370mr2322106585a.21.1766500240226; Tue, 23 Dec 2025 06:30:40 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Xu , "David Hildenbrand (Red Hat)" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 31/31] MAINTAINERS: remove David from "Memory API" section Date: Tue, 23 Dec 2025 09:29:59 -0500 Message-ID: <20251223142959.1460293-32-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251223142959.1460293-1-peterx@redhat.com> References: <20251223142959.1460293-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 (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-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: 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: 1766500445431158500 From: "David Hildenbrand (Red Hat)" I don't have a lot of capacity to do any maintanance (or even review) of "Memory API" lately, so remove myself. Fortunately we still do have two other maintainers and one reviewer :) Cc: Paolo Bonzini Cc: Peter Xu Cc: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Hildenbrand (Red Hat) Link: https://lore.kernel.org/r/20251222141438.409218-1-david@kernel.org Signed-off-by: Peter Xu --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index dc6235e174..2dc3625a68 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3251,7 +3251,6 @@ T: git https://gitlab.com/stsquad/qemu gdbstub/next Memory API M: Paolo Bonzini M: Peter Xu -M: David Hildenbrand R: Philippe Mathieu-Daud=C3=A9 S: Supported F: include/system/ioport.h --=20 2.50.1