From nobody Fri Nov 14 22:20:19 2025 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=1762204258; cv=none; d=zohomail.com; s=zohoarc; b=eQpqym6E2gcrjORIIGYvDF73neV203NHH4sr5ms8gupXAbzneWOb4RaX27mRXqWz5tePYYHFaqBhRJmT89PxGD3ti1+1gsTo3qw6I06nrZezuO9Khm6GrrRtndeDpeNutttBWsJuQ9pCXzbmIM9Teb9NFy2LIOirIqMXpyK6nqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204258; 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=HlbfcBz1rjrLqAgM/bLe8/TJucjYOTnKZj3amceTg+k=; b=HI46aUOGv+hv3J56i5R0RQOYAgdtVSkp60bCkell6/BfBMi68rFJ058n/v8fSKdG9WrXihMsNy7iPo+fWSferBKe0TBBA4acsBc8OJP+un7NC7cMibL466SfOQEXJw65xCTb1am6KIe8MTjC+S+ixGhvbc4XyUJQdpmtqaTtUIQ= 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 1762204258441906.5526710271176; Mon, 3 Nov 2025 13:10:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lC-0000t0-4P; Mon, 03 Nov 2025 16:06:42 -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 1vG1lA-0000sb-KT for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06: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 1vG1l7-00059P-DR for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:40 -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-371-QoRJrcAnNTaoCC1_iF5ORw-1; Mon, 03 Nov 2025 16:06:31 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8a9d56c36caso2242910185a.3 for ; Mon, 03 Nov 2025 13:06:31 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203992; 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=HlbfcBz1rjrLqAgM/bLe8/TJucjYOTnKZj3amceTg+k=; b=I6+BHB0+4s3qQDm8Gz4jL+CrUrfy6tmhxwz6m5L7DQCcoXuM90Q7kPavWIId5bhwwSdpYg h2Fpvrc7tylFioFeSvh2kd190rklkgPmG3Ycqf98qz6axgG4rD4+cJGfnFCQItLVJp6ePf 88XG3XWdP6ubSiG7BqIGFedx5wZ4aZ8= X-MC-Unique: QoRJrcAnNTaoCC1_iF5ORw-1 X-Mimecast-MFC-AGG-ID: QoRJrcAnNTaoCC1_iF5ORw_1762203991 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203990; x=1762808790; 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=HlbfcBz1rjrLqAgM/bLe8/TJucjYOTnKZj3amceTg+k=; b=EA8vK6bsjK9AmCAzP+m4XMqvB2sx00LuqydP+5S4Q+tPrTUzIOIUKpSwUMOgDiiKGi uotMn8R1UmcQRoXnZ2foGv8lM1QJGywoMT2IDnkdC+l06I3BDN+IYn7AOhaNtsa/sZOi HfFMQJKucGf2P6CfarlgZ4qgu0CQ7RX5kL4yf25NH4GEioN7gmtldy2EV1mE4rLaMYpj +XXW1Cazp745Txz3ldEAWx2JL9yaYHGJmaqEB9FqQdlSi0ZRWnAl74DoYeAM6ZOm6t7J 6pf59AsIbym0oOvTH/0l+hFBBxHRd5kgEH+O0hAx42towFo0G4q9BLYHViqYskwsKebF 7yrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203990; x=1762808790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HlbfcBz1rjrLqAgM/bLe8/TJucjYOTnKZj3amceTg+k=; b=r+ptbFMF4fnsZ/JboTAzB5K3QjRF3CVB6TF1XXU6gzfOg5Apte4BXXetBSZLZEzKQO 24U0pjLqLVa2+ROqpReG+xC7pQppmBr8t7eYfZieaPVOdutNVMmfwh/pOtlXNHNETStw 8qa+0aqQU7A1SbNBfiXjGdzwSwO2poalz2nlGE4T9n9mGXtloSCxO81LKARpdiLijeTU sLbD8N8TzypS9HD8bmnqcdLu7jb0rLv7Q2vAQASrnKuHk5yVKIJa6PMc0OR9B7tW+FcQ bnpU73NDoEjue2/hoEXTgz+j96zljt5GOF3XdLl7vHjg34jI25LvsiFGDgXT/lrA3XK1 c2lQ== X-Gm-Message-State: AOJu0Yyz2Xpuvjqfo4xn9UtVHhk0CpGo/ZFPaTxB9ha6hoqNi/H6XNIG XlHibwvIm5/tscznqLIY8rm286St/lLGvILppdpOPCSO/dH2dw4sxzH8k3g6QVe0QNtobOZ4pLB q39mmP62zmKSeRW9xW8jYqkOjvWi99U+gBAZ9JrVDYruu0/58+CX6KyEBPns2EnON6eofntFUvL m5PHHN4R0VKNSGjGF4tW4WYKt/il36GytT3IA6MQ== X-Gm-Gg: ASbGncu8rgzojc0B5XvESwMImKDAbbXRBd0HJcFq/nHbLjP7t2KbR1z3eOub8jkcQZo VVnqR27BWSP0PwgaR/lk5L7uTfDCn98lLdXf9Ephqb0IYLRVlTLJaLsb2kAD3VLemXrHeusuBmD VPJoUAnxz0J8R2JGGHk0OHXOD1CLS2JP8MhGQJaJ6XlhjyYb83Dl5v5w1zpKvgu1hbwsKAL7x+w oxVKWSLRgaAzebDpBu2nxJ6NXdUDLCXoHRu8ugriPp94YNojAdoVeoX3rSepZX+aqvYzz3EVNkE +rwRtcLfv/dpvWqqIlXkgCVShr5rFa/Wc82fwumJtC2S1CcgPKAKfLoYEAQ/nFHM X-Received: by 2002:a05:620a:3193:b0:8a2:4d02:eeb3 with SMTP id af79cd13be357-8ab98eba6f4mr1528914185a.11.1762203990085; Mon, 03 Nov 2025 13:06:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAi6PZSb3lH+72mA2t3DewjjKP/jqPOHNARdPJnGTlNfevW6GO/eoZ4nQQP+ac80RbqPx7hQ== X-Received: by 2002:a05:620a:3193:b0:8a2:4d02:eeb3 with SMTP id af79cd13be357-8ab98eba6f4mr1528907485a.11.1762203989410; Mon, 03 Nov 2025 13:06:29 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini Subject: [PULL 01/36] migration/savevm: Add a compatibility check for capabilities Date: Mon, 3 Nov 2025 16:05:50 -0500 Message-ID: <20251103210625.3689448-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204261685154100 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas It has always been possible to enable arbitrary migration capabilities and attempt to take a snapshot of the VM with the savevm/loadvm commands as well as their QMP counterparts snapshot-save/snapshot-load. Most migration capabilities are not meant to be used with snapshots and there's a risk of crashing QEMU or producing incorrect behavior. Ideally, every migration capability would either be implemented for savevm or explicitly rejected. Add a compatibility check routine and reject the snapshot command if an incompatible capability is enabled. For now only act on the the two that actually cause a crash: multifd and mapped-ram. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2881 Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251007184213.5990-1-farosas@suse.de Signed-off-by: Peter Xu --- migration/options.h | 1 + migration/options.c | 27 +++++++++++++++++++++++++++ migration/savevm.c | 8 ++++++++ 3 files changed, 36 insertions(+) diff --git a/migration/options.h b/migration/options.h index 82d839709e..a7b3262d1e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -59,6 +59,7 @@ bool migrate_tls(void); =20 bool migrate_rdma_caps_check(bool *caps, Error **errp); bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); +bool migrate_can_snapshot(Error **errp); =20 /* parameters */ =20 diff --git a/migration/options.c b/migration/options.c index 5183112775..d9227809d7 100644 --- a/migration/options.c +++ b/migration/options.c @@ -445,11 +445,38 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_sna= pshot, MIGRATION_CAPABILITY_VALIDATE_UUID, MIGRATION_CAPABILITY_ZERO_COPY_SEND); =20 +/* Snapshot compatibility check list */ +static const +INITIALIZE_MIGRATE_CAPS_SET(check_caps_savevm, + MIGRATION_CAPABILITY_MULTIFD, + MIGRATION_CAPABILITY_MAPPED_RAM, +); + static bool migrate_incoming_started(void) { return !!migration_incoming_get_current()->transport_data; } =20 +bool migrate_can_snapshot(Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + int i; + + for (i =3D 0; i < check_caps_savevm.size; i++) { + int incomp_cap =3D check_caps_savevm.caps[i]; + + if (s->capabilities[incomp_cap]) { + error_setg(errp, + "Snapshots are not compatible with %s", + MigrationCapability_str(incomp_cap)); + return false; + } + } + + return true; +} + + bool migrate_rdma_caps_check(bool *caps, Error **errp) { if (caps[MIGRATION_CAPABILITY_XBZRLE]) { diff --git a/migration/savevm.c b/migration/savevm.c index 7b35ec4dd0..aafa40d779 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -3322,6 +3322,10 @@ bool save_snapshot(const char *name, bool overwrite,= const char *vmstate, =20 GLOBAL_STATE_CODE(); =20 + if (!migrate_can_snapshot(errp)) { + return false; + } + if (migration_is_blocked(errp)) { return false; } @@ -3507,6 +3511,10 @@ bool load_snapshot(const char *name, const char *vms= tate, int ret; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + if (!migrate_can_snapshot(errp)) { + return false; + } + if (!bdrv_all_can_snapshot(has_devices, devices, errp)) { return false; } --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204275; cv=none; d=zohomail.com; s=zohoarc; b=GRPvAiv4k90vb+L4UbaHbE6Hv+A0xeIajLyWZ0ZhaBD0P1a0gWWrmp8kMYAn43MMH6WCFsRO+s5sLy7pTMeyu1i/Ga8Kwd29lFL7oRE+vPvjHB/rg3QJRxuToI3rdjWKZzmOUh0O10JAhzLDuWqvsCtQl2cOjuboNiOlpimORuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204275; 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=bkV4KzvoIdiR+K7onoBHG3vVuiufpb0vv5OwoxQKG/g=; b=BoxtjrM75ue2jgOLeDvkYAnfaLHN7RygY+vp0KX0OyB4Dd59HIneQado+yaarHuHSySBLvsIZN9ZBawVdZWWVYnMpQZ4fHgzCtLEPXXZNF6HfJbA5uo2nnIqZ3qRQCFdn1A31FLYfFiYMm6ETuQFblb6lvEZVTgQmaQZZe2gcLM= 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 176220427583975.9840736816459; Mon, 3 Nov 2025 13:11:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lJ-0000uK-6F; Mon, 03 Nov 2025 16:06:49 -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 1vG1lG-0000tu-Rk for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:46 -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 1vG1l7-0005A3-Gv for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06: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-638-lenT4ApKMXG5eO3XGuhVsg-1; Mon, 03 Nov 2025 16:06:32 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b12cde7f76so30919685a.0 for ; Mon, 03 Nov 2025 13:06:32 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203993; 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=bkV4KzvoIdiR+K7onoBHG3vVuiufpb0vv5OwoxQKG/g=; b=efbcoPExnMp+bEFVLTYMOtumV3cXU3eyOqe2M/cti7AiDdafls3bCc1/pcxiQ/onf/acsu 4zS4pVNNdY/dayLsGB8LyahM4LaUF1Ox1sNtMnahRmNt08u0m7y3ZEcgy5hjjaDTcCx+5P 2XySgiqgJlXLyqhKof/JlnkaWj5amYM= X-MC-Unique: lenT4ApKMXG5eO3XGuhVsg-1 X-Mimecast-MFC-AGG-ID: lenT4ApKMXG5eO3XGuhVsg_1762203992 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203991; x=1762808791; 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=bkV4KzvoIdiR+K7onoBHG3vVuiufpb0vv5OwoxQKG/g=; b=PogixB+XOxrx9/PQks6Gt/zNak5ppbDyypRIkmkKjRZKcqGC31mF/AdmCb53I7OvXP QNkD2BxCCy0XZMlS7yY500cd0ZOIDE95Z+9LvlNNKw2QHaq+X6DEK4nTi4XAnEQvD8fw c9iwYbEKIhLvAp8fXHcPemdmm2hRrRBPXcxwmafvmGv7Z3Q33d4m86pV7XNBa8z4vEp8 hwbrAoMd6zEzIiJPFePVEm6dN+N+1EVmCvANuS0O9eKue7sL0Rtm+rbW7X6nra2eyyd6 vQVQjuYZKR5PHEba8wm9c8I9WlIoNkNhmVoL6ds3pc+PsWgT9Z7wG/am6qHchsN2lRSO 5QXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203991; x=1762808791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bkV4KzvoIdiR+K7onoBHG3vVuiufpb0vv5OwoxQKG/g=; b=CJDYFk3j5iCDVrMSmvSC9ajYVKxDqIRkuSwoU36GJKNXmCT7CVMmy1Dj8cJOGVzAi3 4aamM9q8KQeqjwRq6NVsT6GCrAExQs7Lic0lQPsDKT6soEzCArkTQNidl1CpwWvPFG+n GyeWdXd9OPB6Tw04fzHBb+SyftYQwf0locCH4JVGEn+omyCfaMnfVheX6XlaMFiOJpFy Vd7MpQEZiKKoTKfotUMeMucwze59z/yJHTJhRnBhuXtxlI2KeYYMKRTe+aFfgMDhE+Fn Ht5oH1BNBj4AeYchKZotXsIGHUQUqLrcdGbH8WfiYPzA4LvLhJAIdphkMS8AXtlIS4BH 8Y0A== X-Gm-Message-State: AOJu0YxZAd9Ma351WTemqs/wLFWa+QJ3b+YgTLhJk/7OtLlEg+FNtxqE E3FB7+MxRftJh7kfcCPF2d6CWqaNrwgrOCiaEFVQCnKYM40IzVhVBEeduX9ZS2QI22OYqiPW8s+ khwM06j1Lo5CfzUIuKUDjflUAmFA+S0URe79jidZhjKwiH6aD4etzkBOvfnUMjkBWrGpJRgZgN2 KEQlHpQlKtTsVB2zvy342ybj85JVve/od7nyZVtA== X-Gm-Gg: ASbGnctmJQbgkZjmP2sSQmKonOV7Wtu4Pw78oZtS/mlz54BEr+j4UkxdR35RsDit8b9 qyWLtmLAxgvJv5NAVgIsFgPX2l5UyS2w/kaTUueJ2iZkRHu8trFXwSQyjtICgN3ZQ3uTR2lHeJX RgDD5yVC34nNQxnvsdChkpz9siAgbAFZZnmTgy5VfYzXUN1TDNbq7ubePvM6+2W5Pd5+k01Orf1 dPMOzHMDzniEa1OwrAKPED2URPbW+pzVH/6mmLFrcaSxD8sY2An82b/UV6VewAFaCTku+OF5369 Ga67IbQDtTTrFmX+tZi3MdSHCghjIM86o8OcPmrjjxVb0TC8w8FUEmXhrdB9BI0x X-Received: by 2002:a05:620a:4150:b0:88e:1123:ec9 with SMTP id af79cd13be357-8b10c4da943mr112983385a.36.1762203991132; Mon, 03 Nov 2025 13:06:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZkquQMB2TG93+OLIiIpDHl7iwVIn6fYDjWhnANh3yXuSMx6xT4s98ZXy7Dd6zCQnT5QsB1Q== X-Received: by 2002:a05:620a:4150:b0:88e:1123:ec9 with SMTP id af79cd13be357-8b10c4da943mr112977485a.36.1762203990567; Mon, 03 Nov 2025 13:06:30 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Steve Sistare , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/36] MAINTAINERS: update cpr reviewers Date: Mon, 3 Nov 2025 16:05:51 -0500 Message-ID: <20251103210625.3689448-3-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204277763154100 From: Steve Sistare Update cpr reviewers. Some of these files overlap with migration files, but some do not. Signed-off-by: Steve Sistare Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/1760098600-399192-1-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index ee058e2fef..12ec2d6860 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3114,7 +3114,8 @@ T: git https://gitlab.com/jsnow/qemu.git jobs T: git https://gitlab.com/vsementsov/qemu.git block =20 CheckPoint and Restart (CPR) -R: Steve Sistare +R: Peter Xu +R: Fabiano Rosas S: Supported F: hw/vfio/cpr* F: include/hw/vfio/vfio-cpr.h --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204495; cv=none; d=zohomail.com; s=zohoarc; b=EYZ9nq82ELYmhMpTpfs0TFFWBKYZKG7eWD5h0puOeTClYGHRDb7kn9gSYnJX8KOdlvB6L6jwXqxFjKXqT2kC6dMQkB14IE0FCxG3Q0zm/dAMEcq9h8be5GLbfmbDIkfpUc6Ol4EFEeTXKxRIHDar/ZVby7LjpDb9UhO/EbbvtBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204495; 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=UWwOXYFZuCEMUZuqr0lusb7WtZ16ba8bYn8YGVwOYII=; b=nTB/DXFyqTqeVoaxEfBqM7zpsnx0sveglYTYEpNKcuvrsd77PEBzC4aMKYGV4vUyDH4EgzclpiEGQqCVVFStwAAnZ/1GWTqIaKUR+vCJXavw2JpRHLKmJMHLa9OE+hVjWUlnyHZNwghuW34qeIsT5sT+zBB293uPIhO+GqSUu3Y= 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 1762204495881450.53008335608774; Mon, 3 Nov 2025 13:14:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lN-0000vL-MQ; Mon, 03 Nov 2025 16:06:53 -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 1vG1lJ-0000uT-P0 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:50 -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 1vG1l8-0005As-2M for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:49 -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-642-oMymz0LMMG2evwwpvfR8MQ-1; Mon, 03 Nov 2025 16:06:34 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8a65ae81245so1487403885a.3 for ; Mon, 03 Nov 2025 13:06:34 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203995; 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=UWwOXYFZuCEMUZuqr0lusb7WtZ16ba8bYn8YGVwOYII=; b=DqrJcqwiapYfspwAogCFQOmQWiQ/VIldarWNtmpW9vkFdCKRuXAynk7Ju1XRc++MFRGdnV V3z3iF7SxbHcQLtdn7STQ8lcN/Swcn/S/QNh1STFwna+8Dby8EgXD4EgEfSjqlAglZMH8n fdMCoigF0Gza7Vcp2oSJGYS0KwrQneU= X-MC-Unique: oMymz0LMMG2evwwpvfR8MQ-1 X-Mimecast-MFC-AGG-ID: oMymz0LMMG2evwwpvfR8MQ_1762203993 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203993; x=1762808793; 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=UWwOXYFZuCEMUZuqr0lusb7WtZ16ba8bYn8YGVwOYII=; b=Ql951z1/t1uuRNNCNsHhRkmDu1OM8YIrk4f/NKNVCCrEEthS2VbHQ8bDho9o6lcoca 9SwrKzfXg8kKMJYKHjHB44QTe+TxHknBxQ/tNVpo8t3a97aW8fqUtF209t/SaJbIC1RJ LkjuyqAI52UTM1Vxemlo2+YIP7AOsPmwyRGlqSUx2I91YgA7JYqJilblfonCP4wRN2hU UtzvoMbPvFIQ518g9soOmOJnLh0Oxx0ABOtgcnFx4FGQi6lyInBDOEkGQGaBJ0Ckp1dH aFV/cmCHS9wSs0Ha+wBZX4kKEmsnquICvw/iO+2NoLkHD+3EZu29CwnZXkLaKUrcLUU+ /cvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203993; x=1762808793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UWwOXYFZuCEMUZuqr0lusb7WtZ16ba8bYn8YGVwOYII=; b=dwCcH1ykl7FRbdu0vEwMY64BTeOKB9pxmFBqNgQCTHumAYNhLLrAy0Kkh1LctuPyZ0 ub6cn5T0WDrLJufuv3466rI1l/sibQ8nCjDiFYv5kcEW/bx6ViV+lVhoZVNmt3fp6waY 3VgtQVCbu8an94p1g7rGVla07Gs4FiFwGRn0SR6nQ52Zny/wdd1L+wXlcNYKMFGLx0x5 V0NLdgvkzYLlk5Pzm2fpNzIrHVPvOJVmR3CeR6duy4uN0vi5mYYhpnGTcUiyQ20lXRwg WVA5XIKVPSbODOsHjQQhBYlFWX+Bp9X4dOdSqyaM0YksfagBGhi49MSNLF1QAJHSgSQI bRqw== X-Gm-Message-State: AOJu0YzeHA9ktOKcX/KCLw+NEceww4Shhdwe/s3+y+iZ3QmswhhTr/6R KTlZXl5eM+4LMASjWGimChx967gvVAEpHIQPHkC+M9anBQA4BkGP/NqQ6czEVjGNTfv/78xCzH3 WveRwePT8tLR2SIuojVX6u1JGJw+0DT7VEIqw45f1vtCNZ0YUZLO8wrs+8x1XZVlHnx4j6JtMu5 khW01hgWkHuCfypg1FcXY5csCQ2ZUv4ccTngvuog== X-Gm-Gg: ASbGncsYjGSyMHkNDOQZml6Hrd74vGkMd+Si+ySPhiAWY5ia36VD+tCH5h1ZmEfKQJO I9xos+N4VvwoC/mlWS4vvsvlmLfo/dw7n3X77QqcJCMYHzo1wyMOc1Kzxd6Ymao9YdNbsGDeRRl eXUNkITIcwsJ4jMjF7sCSd/dZTxFVeTp613nosNgTWqsb8TW0SyV09ctOp7P6AytXW4xSr3DU/1 Xrtc6nCOfbd9LHf4fQeWzOh2RX7OIYl7w5urTMLyaufhK90KLQSpRy7BaTz/NbxzaSM3OefryUz khIEfWK0ITMSbccvkz4CPHF0kNQpUpXRVPsY1c/fuZmf4DQXAzhud5fh5zgRbzoH X-Received: by 2002:a05:620a:2953:b0:8a3:ee38:be9d with SMTP id af79cd13be357-8ab991a5816mr1494165985a.6.1762203992825; Mon, 03 Nov 2025 13:06:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgLk4q+yh9JDeWWOfKi/6pmwWvmlyXRLzpW+5mQTW2WcRAqnn9ffvXmwrbvyQWTVc3MHDBPQ== X-Received: by 2002:a05:620a:2953:b0:8a3:ee38:be9d with SMTP id af79cd13be357-8ab991a5816mr1494160185a.6.1762203992283; Mon, 03 Nov 2025 13:06:32 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Marco Cavenati , Juraj Marcin Subject: [PULL 03/36] migration/ram: fix docs of ram_handle_zero Date: Mon, 3 Nov 2025 16:05:52 -0500 Message-ID: <20251103210625.3689448-4-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1762204504700158500 Content-Type: text/plain; charset="utf-8" From: Marco Cavenati Remove outdated 'ch' parameter from the function documentation. Signed-off-by: Marco Cavenati Reviewed-by: Juraj Marcin Link: https://lore.kernel.org/r/20251001161823.2032399-3-Marco.Cavenati@eur= ecom.fr Signed-off-by: Peter Xu --- migration/ram.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 5eef2efc78..1384748193 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3630,7 +3630,6 @@ static inline void *colo_cache_from_block_offset(RAMB= lock *block, * determined to be zero, then zap it. * * @host: host address for the zero page - * @ch: what the page is filled from. We only support zero * @size: size of the zero page */ void ram_handle_zero(void *host, uint64_t size) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204122; cv=none; d=zohomail.com; s=zohoarc; b=dEyseoSzFv39+e10tDUsqCQsYNCLE6qhRQ3M2oz+RUVQnhicNRgPzKHO2CM56tUOCSl4hCIeW5jm3bJU4TGnizgzQTRJrOymqEM1g+BdPVw/4JZcpwntpzBWluGmdbPYl2xMSza4KEvRMjszHvJkBj4TMTH1Avnr3m9zbGNqN5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204122; 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=rbJvfmaLlaPCev4kAet4tVlQUBZt0s2JoPEA+6NaSU4=; b=eytAoUq2bxW4PdTClj9Wj0rmKerplTHPq6u/8N23OzAdhwB2AanpoSnSsqCw4nsgFz3IZrOEG9dp4jH59S+u4nvkWy6P9Yw6AJy1422bNV1Ifqsu2WJXMJBXFrgp8jIqXe+Cnmv0Ctwe0dJBerpeUstGUyP5H8S44TgQYYfiqcY= 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 1762204122608710.8941385520505; Mon, 3 Nov 2025 13:08:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lJ-0000uS-Ix; Mon, 03 Nov 2025 16:06:49 -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 1vG1lI-0000uI-2U for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:48 -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 1vG1l7-0005BA-WB for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:47 -0500 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-E8pu72uWPWyBk5RuHuqX2A-1; Mon, 03 Nov 2025 16:06:34 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-87fb496e4d1so220913496d6.3 for ; Mon, 03 Nov 2025 13:06:34 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203995; 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=rbJvfmaLlaPCev4kAet4tVlQUBZt0s2JoPEA+6NaSU4=; b=fntlordftfjr/sGb9IDHd5+P9dhetLclsPv/NYJCBsgIbG1mkglCTtaF6qIHxnDKuUQnFh tI36qaBgRbdrMz9AJ+eKxeiMkdg8ypzYh+6HayrAeRW+vH5uwFKnzvQTGyunmpd5GJv5gI +cQmr9zqsoEpAOfxb5h6e1aeXV9mJjg= X-MC-Unique: E8pu72uWPWyBk5RuHuqX2A-1 X-Mimecast-MFC-AGG-ID: E8pu72uWPWyBk5RuHuqX2A_1762203994 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203994; x=1762808794; 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=rbJvfmaLlaPCev4kAet4tVlQUBZt0s2JoPEA+6NaSU4=; b=KzzrkzPfyptBB9i/xy1lT3SfvKpbBkwRRvH89ZRlcILhNKu24oMZCHN5D4Jo7MISqt z0Hs50wO+hkpsjeiZUiCZlEMeSr3/afUyD3mMlse7SmjQmtUD1rap6IPtzz47xM3+odx XMTtwRsF2koSqej+KC2uHN7KhVsI3Cpsgc3YB47C2SV+Nju9QvxWssElmzPytEvd442y 148GT/vC0qtwLTrE984Maf5uLtTx9raKrpqWoCfq1F4uq9YCjPzj5MdT/JwBs2CYbm1M lDWU+5govztblRb769jvA/c5HgmMxeZjIlcROjJGhtQYIyggrTSQelm4mlobXNnBChf8 Ts+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203994; x=1762808794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rbJvfmaLlaPCev4kAet4tVlQUBZt0s2JoPEA+6NaSU4=; b=WeLP+3BbvQJf/XCzUN2nF7Uciwj3HB8gjQ1rjy3IGBTMJUoG96YMi/qn9oOGYVAyo3 S7yfovNOog552swmZ3x1Rw9l/tEK0hznNNoxRAJAqf2jIhBAhpM1zvr6KcK9QwDbqEOS rD8SdOXWQG1bw6AZgCDsgvEWzk4C/a+FgvmVZZ7MjRDa1Wpr964/AcNLgj/XjlGXi115 gwMKR1Iyv4SyTeiEYSXHJsTqRSNLd69wsFS93JNqvKlfVprj1Z5r6cMZAkgimPJGE3dS jrbT5kNmWzL7a8SL6+OA+r0O5sYlxVOE4koVZrQjMKGwHfYVlOv69No+mIKVPAsE74S9 Yblw== X-Gm-Message-State: AOJu0YxHiOg/aVqQ+/UYQ5r7ze6kiSHRraUZNfSugX/CeGdc3LX3Dlru BjQZqv9LDE0XpwNmbaHg53TRJRe/tusFJrv8HWIeAeNd3hbVH/1Dprj0ivaiw3WxHh419e8XO1K mKFoBr/quFRWcu1YoULyRBUfvtrltqQ5xyO5SJbRXsUrBVceJa3hVxli1UuY4nMLEFUCZ1AgfsE TCwg/+L+QGsRWAFjxCP6ZZ7stfwKQNM0Ii00qD0g== X-Gm-Gg: ASbGncvuPtxYXEQyagSPJPltyI4j6+0gOKbpyKOn5dwwHpO5pkICHyZzMtUOFCFvfFU ouKESB5QcADSSGxk9vtsm80hfCUVov/aPkbJVRgc+bmlJMrEFiMjNuppnM5AvfwhgkzUYF/UNwR ym8wGU5E7S2ASFly6jUQNIoSznT8zTg1Df8/BcQGGMzIGOyQlUtFp/kHWypfyYMzaze2uxiK0Rk /vZZkokONkZOpOXqoK9tHbyXftqk3BFJbEn2B6UVFPoXpS707R6CxjTnO1lb0pkkLr0Q9C4XIVu XAoJ8UUzu48zvJdfs01FQcekUv0wtBDsv5Gz9CmMu3h+R0LNTYSkrJ4yR1UhJxsi X-Received: by 2002:a05:620a:2943:b0:8ab:7ac3:3271 with SMTP id af79cd13be357-8ab99a7670emr1847631685a.36.1762203993809; Mon, 03 Nov 2025 13:06:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhdzCv54ThExEJmkv1fyxYsjPwkGj7Jkv0djglpZfIsc0M0si2narzo7GUwntgHsJl5RLGSA== X-Received: by 2002:a05:620a:2943:b0:8ab:7ac3:3271 with SMTP id af79cd13be357-8ab99a7670emr1847626685a.36.1762203993312; Mon, 03 Nov 2025 13:06:33 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Marco Cavenati Subject: [PULL 04/36] migration: add FEATURE_SEEKABLE to QIOChannelBlock Date: Mon, 3 Nov 2025 16:05:53 -0500 Message-ID: <20251103210625.3689448-5-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 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: 1762204125031154100 Content-Type: text/plain; charset="utf-8" From: Marco Cavenati Enable the use of the mapped-ram migration feature with savevm/loadvm snapshots by adding the QIO_CHANNEL_FEATURE_SEEKABLE feature to QIOChannelBlock. Implement io_preadv and io_pwritev methods to provide positioned I/O capabilities that don't modify the channel's position pointer. Signed-off-by: Marco Cavenati Link: https://lore.kernel.org/r/20251010115954.1995298-2-Marco.Cavenati@eur= ecom.fr Signed-off-by: Peter Xu --- migration/channel-block.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/migration/channel-block.c b/migration/channel-block.c index 97de5a691b..9cf383d4b5 100644 --- a/migration/channel-block.c +++ b/migration/channel-block.c @@ -30,6 +30,7 @@ qio_channel_block_new(BlockDriverState *bs) QIOChannelBlock *ioc; =20 ioc =3D QIO_CHANNEL_BLOCK(object_new(TYPE_QIO_CHANNEL_BLOCK)); + qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_SEEKABLE= ); =20 bdrv_ref(bs); ioc->bs =3D bs; @@ -96,6 +97,47 @@ qio_channel_block_writev(QIOChannel *ioc, return qiov.size; } =20 +static ssize_t +qio_channel_block_preadv(QIOChannel *ioc, + const struct iovec *iov, + size_t niov, + off_t offset, + Error **errp) +{ + QIOChannelBlock *bioc =3D QIO_CHANNEL_BLOCK(ioc); + QEMUIOVector qiov; + int ret; + + qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov); + ret =3D bdrv_readv_vmstate(bioc->bs, &qiov, offset); + if (ret < 0) { + error_setg_errno(errp, -ret, "bdrv_readv_vmstate failed"); + return -1; + } + + return qiov.size; +} + +static ssize_t +qio_channel_block_pwritev(QIOChannel *ioc, + const struct iovec *iov, + size_t niov, + off_t offset, + Error **errp) +{ + QIOChannelBlock *bioc =3D QIO_CHANNEL_BLOCK(ioc); + QEMUIOVector qiov; + int ret; + + qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov); + ret =3D bdrv_writev_vmstate(bioc->bs, &qiov, offset); + if (ret < 0) { + error_setg_errno(errp, -ret, "bdrv_writev_vmstate failed"); + return -1; + } + + return qiov.size; +} =20 static int qio_channel_block_set_blocking(QIOChannel *ioc, @@ -177,6 +219,8 @@ qio_channel_block_class_init(ObjectClass *klass, ioc_klass->io_writev =3D qio_channel_block_writev; ioc_klass->io_readv =3D qio_channel_block_readv; ioc_klass->io_set_blocking =3D qio_channel_block_set_blocking; + ioc_klass->io_preadv =3D qio_channel_block_preadv; + ioc_klass->io_pwritev =3D qio_channel_block_pwritev; ioc_klass->io_seek =3D qio_channel_block_seek; ioc_klass->io_close =3D qio_channel_block_close; ioc_klass->io_set_aio_fd_handler =3D qio_channel_block_set_aio_fd_hand= ler; --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204194; cv=none; d=zohomail.com; s=zohoarc; b=OU+LIWpDOjAemuaCRzrbF5dBNh1k80xbNLH4P3Irxs8no8zuq8ZAm6DqD9/LJfp/P17K8/zfYU09mSu/i5CrM3paCbkBTYrpk5kQ9Sa/AzuCvRKZANESFxF9shzc7Jj3HvjD63VaZThyVOya5GiCC14Wr8M2/gsIjGJyO0A98Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204194; 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=zlB0Kc90UPr6D+7Ti5JxxglMdrXTiBSo67o+zFkEX2E=; b=XA6GFtj4ZuE/QgPJStAeyBzkSHIRg8Gc3XBBm8cV40qdhgwhMUR3OAXngWjh4zrpaTozNtOR1Tf7LaUYsqDnJ3qKC6/au3lSD5B8pEhLM3onigOyE5sZELiarIfSbg0cdsOB1ANgd71idNZ+ohq7alnfKc2z9Ec7igaBQkYED0E= 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 176220419435616.424115860656457; Mon, 3 Nov 2025 13:09:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lQ-0000wK-0n; Mon, 03 Nov 2025 16:06:57 -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 1vG1lM-0000vc-D2 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:52 -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 1vG1lA-0005Cc-RX for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:52 -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-509-047AfHUANxCiqMCty8lQtQ-1; Mon, 03 Nov 2025 16:06:36 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8904a9e94ebso1230283885a.1 for ; Mon, 03 Nov 2025 13:06:36 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203998; 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=zlB0Kc90UPr6D+7Ti5JxxglMdrXTiBSo67o+zFkEX2E=; b=bd4wCj/InZpJZPpRVn6S9haaZioDyCkj0bO5G0xVKu3OdRdivMO73Us/LlhvgBKudbRrUj 9CuF5DKvRdewgqwhve7W7vZboYjyCjw5sj+nb7Q8W6NeM4CcRdY3Sz6PnUyfNYvc12WgWd 0JqmmaXztu9QIHZmsRnGNuXj/it6VCg= X-MC-Unique: 047AfHUANxCiqMCty8lQtQ-1 X-Mimecast-MFC-AGG-ID: 047AfHUANxCiqMCty8lQtQ_1762203996 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203996; x=1762808796; 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=zlB0Kc90UPr6D+7Ti5JxxglMdrXTiBSo67o+zFkEX2E=; b=aYaFGDIHOjJf0CpoPjKGP2bZZNS8ylV96Myip2dYKFr+Z8sxI6RyKIoavtSJlQyVph PVDdauj3/wA8FK9npr0Em7m4wDDKH0Et0hIAM8J4fAq1nMf5lyCZYMx2LVKceHQ3ltKo /KR1FCTd013wxDUg9L9jI8RqKB3uVASA6Skb2bA2LjToI6C05Q/4SKnM6ImMp6c9TQFy nO5QAYIGPiZbMsD5jKG88gL7hJeOOTukzKQrCOxEAtCUQp0jUiKzIDnf0sYsokNdMeEU 2SYmN5zXwDdUFofGcpjUUkSNgWIRaMTkbX865+D/ZRxHjEdumHYI6VGnS2wgQkp1jOAS 11YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203996; x=1762808796; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zlB0Kc90UPr6D+7Ti5JxxglMdrXTiBSo67o+zFkEX2E=; b=BaTS2kfuHb8FvTsZMJdknL/f5UqCvGv/412QM47Wi6mT7BMNZhfdn/1RQMr7nhVDhe TdmD/uXea/yEEdYSYGi9cILoroiKkjvy5/uCcgm1Y0BVbgp59X8rI3SsABoALqR0gOFb lPZc/mbqKlP9eX6d6UaPu211s/zKvdqx0qy6RMd2Bt//DZ9QsXl1x4Bg72mdN3pRpavB OAlOuanXy2OTnmweKJ1+dVK56/qsUsDyWHnmrjmlq6rBjvMlzfNgqjmIM6aTczbFpTNy 5lMIbrylWmM3TwZ8faRITBoMYY1bhlnTVFWUL/tlh5kGTVoyvt3FPsBnyBirfK7u/y7c KhZQ== X-Gm-Message-State: AOJu0Yw+CUGNHh64lD2iQLhpZLQwGMVRwJbpqJrQvHvhTx6J+rHjpj01 GFfil7oow+sD7yecuxZ09ujn1Shn/MsmGqyXwVZc1X6Fa70SlBX2CV6W+1UKRHVLYzj0ZBUy8jR eHdlkRni+8m8rbG+oZzrhV7wCL6Wa5GS2fNZlgVK4sih7o6tXlbbAtLZbaZpGz54SR8psMxVWKm CMgKpeE6zPvq/StN+SuzKrDtzSc5YA5tnQ/hCuBQ== X-Gm-Gg: ASbGncskVoEOCbyqAgu+G+KXgyRtaUH0gAZcaQuMcZ6JMvbMHTsJIXQZ+kQsoA+XT/W 9PoHfUyrPGVy/etbnfvXAmAVNukKfBX9KBXexqHzL8NBkucQ0V9NM4eNeyqZ9OExBB4Ck8WRTwS JZkCiaL9EmClWJgQqDdDHrCnG0hqUCKknfNU0zAurRhDT705XCXWocjmMYIQdkPgZhf9KJOzffO QzgEVrmQ/uUOUPvWi/C3fhooIpoF5FKX/xIB9UcI4KI4Q+qf5o9rvS47fZv0Pv+i3RBxuSEaczT xK81sRkYvjlGGLPC8r7Yxcau7uWMUxIqkIN2RsGGtyUkhVkhzam89+P6Y4X7Q+Pb X-Received: by 2002:a05:620a:4410:b0:89a:2d9b:74ea with SMTP id af79cd13be357-8ab9afd428cmr1658511685a.42.1762203995563; Mon, 03 Nov 2025 13:06:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEBccPJ2ZtzRCk96hACALrtMDOoWpI6fDmTxDKgAOLO9u8FoW2mA5LVsCIE6WvRVk92ZxL6Q== X-Received: by 2002:a05:620a:4410:b0:89a:2d9b:74ea with SMTP id af79cd13be357-8ab9afd428cmr1658504685a.42.1762203994894; Mon, 03 Nov 2025 13:06:34 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Marco Cavenati Subject: [PULL 05/36] migration: mapped-ram: handle zero pages Date: Mon, 3 Nov 2025 16:05:54 -0500 Message-ID: <20251103210625.3689448-6-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204195384154100 Content-Type: text/plain; charset="utf-8" From: Marco Cavenati Make mapped-ram compatible with loadvm snapshot restoring by explicitly zeroing memory pages in this case. Skip zeroing for -incoming and -loadvm migrations to preserve performance. Signed-off-by: Marco Cavenati Link: https://lore.kernel.org/r/20251010115954.1995298-3-Marco.Cavenati@eur= ecom.fr Signed-off-by: Peter Xu --- migration/options.c | 1 - migration/ram.c | 59 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index d9227809d7..e78324b80c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -449,7 +449,6 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snaps= hot, static const INITIALIZE_MIGRATE_CAPS_SET(check_caps_savevm, MIGRATION_CAPABILITY_MULTIFD, - MIGRATION_CAPABILITY_MAPPED_RAM, ); =20 static bool migrate_incoming_started(void) diff --git a/migration/ram.c b/migration/ram.c index 1384748193..29f016cb25 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4038,12 +4038,58 @@ static size_t ram_load_multifd_pages(void *host_add= r, size_t size, return size; } =20 +/** + * handle_zero_mapped_ram: Zero out a range of RAM pages if required during + * mapped-ram load + * + * Zeroing is only performed when restoring from a snapshot (HMP loadvm). + * During incoming migration or -loadvm cli snapshot load, the function is= a + * no-op and returns true as in those cases the pages are already guarante= ed to + * be zeroed. + * + * Returns: true on success, false on error (with @errp set). + * @from_bit_idx: Starting index relative to the map of the page (inclusiv= e) + * @to_bit_idx: Ending index relative to the map of the page (exclusive) + */ +static bool handle_zero_mapped_ram(RAMBlock *block, unsigned long from_bit= _idx, + unsigned long to_bit_idx, Error **errp) +{ + ERRP_GUARD(); + ram_addr_t offset; + size_t size; + void *host; + + /* + * Zeroing is not needed for either -loadvm (RUN_STATE_PRELAUNCH), or + * -incoming (RUN_STATE_INMIGRATE). + */ + if (!runstate_check(RUN_STATE_RESTORE_VM)) { + return true; + } + + if (from_bit_idx >=3D to_bit_idx) { + return true; + } + + size =3D TARGET_PAGE_SIZE * (to_bit_idx - from_bit_idx); + offset =3D from_bit_idx << TARGET_PAGE_BITS; + host =3D host_from_ram_block_offset(block, offset); + if (!host) { + error_setg(errp, "zero page outside of ramblock %s range", + block->idstr); + return false; + } + ram_handle_zero(host, size); + + return true; +} + static bool read_ramblock_mapped_ram(QEMUFile *f, RAMBlock *block, long num_pages, unsigned long *bitmap, Error **errp) { ERRP_GUARD(); - unsigned long set_bit_idx, clear_bit_idx; + unsigned long set_bit_idx, clear_bit_idx =3D 0; ram_addr_t offset; void *host; size_t read, unread, size; @@ -4052,6 +4098,12 @@ static bool read_ramblock_mapped_ram(QEMUFile *f, RA= MBlock *block, set_bit_idx < num_pages; set_bit_idx =3D find_next_bit(bitmap, num_pages, clear_bit_idx + = 1)) { =20 + /* Zero pages */ + if (!handle_zero_mapped_ram(block, clear_bit_idx, set_bit_idx, err= p)) { + return false; + } + + /* Non-zero pages */ clear_bit_idx =3D find_next_zero_bit(bitmap, num_pages, set_bit_id= x + 1); =20 unread =3D TARGET_PAGE_SIZE * (clear_bit_idx - set_bit_idx); @@ -4083,6 +4135,11 @@ static bool read_ramblock_mapped_ram(QEMUFile *f, RA= MBlock *block, } } =20 + /* Handle trailing 0 pages */ + if (!handle_zero_mapped_ram(block, clear_bit_idx, num_pages, errp)) { + return false; + } + return true; =20 err: --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204249; cv=none; d=zohomail.com; s=zohoarc; b=VgOqvq/DXjoGZ3ph22Vrh8IeYh9qO5osruTUeQazc7sl/1JR03nxEfYb/opJT0H5ASFPpf0tBu980K8oYIzaDsfnHNeA73mmI0yFDfJX2AVIoSdA60QzcJeOlZIS+yj7w4rbb2xmxVV2Tc9iFF2Xf0jxuv3ixQGeOV1Wpzx/CGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204249; 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=uF31ZFegjjtG5ASzXGR3Xx9ULt+da5E2N+ZHHsXG0v4=; b=eRAfqpPWeqM9oEI+BLFHcD+k9SACk6+AmynQP0jvakN30wpBj6BOtORSzplNMyW8BJI89DaNEzwPQyh6qWNy4HtsIHHpyfj8q6ACfYMpQZpm351S82PFOsEtmIN0noUfErbS/ff8Vhp/7xgf/gMFDnRLcPwypoFeYEuZXnuf2y8= 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 1762204249143291.28075655163434; Mon, 3 Nov 2025 13:10:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lO-0000w6-FK; Mon, 03 Nov 2025 16:06:54 -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 1vG1lL-0000uw-15 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06: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 1vG1lB-0005Cm-QC for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:50 -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-465-dtTxbPuONwOYo7LyotS_GQ-1; Mon, 03 Nov 2025 16:06:37 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-8801c2b9ea7so130577126d6.0 for ; Mon, 03 Nov 2025 13:06:37 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762203998; 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=uF31ZFegjjtG5ASzXGR3Xx9ULt+da5E2N+ZHHsXG0v4=; b=AlsQ2CjA/DxTTUfdVO+ZKFGZ74VaZdwrMmcX57+cw4KeMJjI424I9WMJaZmalMjlYAZiO+ gJ7owfk85YJeYrA2YFQQ0m3qOaCzsKqkRjZz1wAqPtajOeKebnu33TTGPPoVve7bpypa6o TZG0sncApnJPkhiYWFij5nPnBf1zodk= X-MC-Unique: dtTxbPuONwOYo7LyotS_GQ-1 X-Mimecast-MFC-AGG-ID: dtTxbPuONwOYo7LyotS_GQ_1762203997 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203997; x=1762808797; 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=uF31ZFegjjtG5ASzXGR3Xx9ULt+da5E2N+ZHHsXG0v4=; b=beO340fQHcXuTdIOtdp2rFSAoQBX+MkvQRGDOz8BJzjDPlz6NUC8nZO4/8jQNVOaEu 2jHS9fKMLYD3gKtWSRsJFfvxRpSVzhm35U30JcuDn1eIDQ4t/CHgoBsGrBD0F3NTmnCP OtBDB9GFogo4dyTDz6CisAsr3sli3NsRjhF1MMQoPECB4CGCkdKsrr/L408E3Hv9dXxl mA+T2DS8zFe6/5D/F5mTzSrA0XyCyc08sYrbfvc4tOUiYZrzGLtse8csKPBUIUbw2kaC woUKlMACViGKBvCibaVN2USIUYil2ixyPvDd6zZv37iKS4MHhUOAjPJO3RRoyNsaBEd+ /97w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203997; x=1762808797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uF31ZFegjjtG5ASzXGR3Xx9ULt+da5E2N+ZHHsXG0v4=; b=qifMJhEE+2qjlmz7y5BJgnXQust1ihdx4qwF6gkDXvlP3MK5UdfpVOpjcjdvR1QK6Q tjlXmwz8pnRuCTovIivqDjXKSy015GrHRqnIUR2Y6iUkRVW9gBUdgt9IK/0Rs3r7luf0 GrONo7d7GzOc0wzJ9YKbaAv6FdQb0kWdbWjr1YeHc8GgXS5dAvt5ld9PjDJ3z/aZd5DG tPwJ0uhUdYF4pd/1MXNtn9Ii8/trkWStmVc+WrokF7kg9h1hHeP0ZC00Zs91sZe0ejNG XyaHAclTdOWF+9yttSCBwCN8uO6Te3T4WVcYEzMIIyBm85Kb7Pqsiw67cVdJjN8seH4/ xWUQ== X-Gm-Message-State: AOJu0YxQxaWEXUe+CwP2wlfPLSwDXTuHY4u1lyutullFIC0vx8LcY2UK X3YkVZPLW+Z8OZsjiF9I4Y125BoTR/ee3ww61mQri8CzHPvcq8B8Ha1F98nplPFD1CzaRm2ESpD JZa5ngGlBHkgq5apVmiT9pZkirE/P5JEm67YtzoeJUheo/LzQSnqjn9b+UeRnvk0wT+s5GNrRax ifgo8KKbf2/K/vRXeKa4RhQLzdZ5SqEy+vUToa+A== X-Gm-Gg: ASbGncuU14jTXZiyvsUJDiawuV0aJmpPYXMGO+xDR6SQw0idiLnz1TXTUIXs5Tw5YC0 V+f+ArSVValOyrJuLa3FeNPvYNQAIu/rQDNMVGqCIkT3M0lFqJBXGSsXba8NF1QkmzcQ3m6PCl6 2UyIqmROK/z1IlViGVMmrEoYe0TpdgGquSFYYykw6WDcN+OoaI/o9knXW+SZpqYcNFFdPruIQFi Pu2BDWSYDtqkbNlNjl4cyjDFREYbvXIruEjt4OV9eZFp1/ax2ddIHZJh+uKyFaMUAhh5r0tW+ox hK4OhrQ8gB7ITxCc/2DDEBohwTAcsEZcVcjwm4fYmZKE41APDl7vcXt1gieVLsQd X-Received: by 2002:a05:622a:2b4f:b0:4eb:a228:7f4c with SMTP id d75a77b69052e-4ed30f2297bmr174268351cf.35.1762203996638; Mon, 03 Nov 2025 13:06:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsKTf4x5Sc3CYtEqvuGKBohvzR5vXyXJBekKl5JmJ2UsQXignVg50kxi5tZa+lDbCMctj8Ag== X-Received: by 2002:a05:622a:2b4f:b0:4eb:a228:7f4c with SMTP id d75a77b69052e-4ed30f2297bmr174267831cf.35.1762203996166; Mon, 03 Nov 2025 13:06:36 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 06/36] migration: Remove unused VMSTATE_UINTTL_EQUAL[_V]() macros Date: Mon, 3 Nov 2025 16:05:55 -0500 Message-ID: <20251103210625.3689448-7-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204258921158500 From: Philippe Mathieu-Daud=C3=A9 The last use of VMSTATE_UINTTL_EQUAL() was removed in commit 16a2497bd44 ("target-ppc: Fix CPU migration from qemu-2.6 <-> later versions"), 9 years ago; remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20251016160313.25751-1-philmd@linaro.org Signed-off-by: Peter Xu --- include/migration/cpu.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/migration/cpu.h b/include/migration/cpu.h index 65abe3c8cc..ca7cc0479e 100644 --- a/include/migration/cpu.h +++ b/include/migration/cpu.h @@ -19,8 +19,6 @@ =20 #define VMSTATE_UINTTL_V(_f, _s, _v) \ VMSTATE_UINT64_V(_f, _s, _v) -#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v) \ - VMSTATE_UINT64_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) #define VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, _v) \ @@ -40,8 +38,6 @@ =20 #define VMSTATE_UINTTL_V(_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v) -#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v) \ - VMSTATE_UINT32_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) #define VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, _v) \ @@ -53,8 +49,6 @@ =20 #define VMSTATE_UINTTL(_f, _s) \ VMSTATE_UINTTL_V(_f, _s, 0) -#define VMSTATE_UINTTL_EQUAL(_f, _s) \ - VMSTATE_UINTTL_EQUAL_V(_f, _s, 0) #define VMSTATE_UINTTL_ARRAY(_f, _s, _n) \ VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) #define VMSTATE_UINTTL_2DARRAY(_f, _s, _n1, _n2) \ --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204081; cv=none; d=zohomail.com; s=zohoarc; b=IdZK9myXZzwVItCkf7v6Wbyme/5zoARSYm9d34s92ASD/kLnXFlFQDWSn0WjVeMxzVF8IKf+3tIzVfDpp7IKadMNEDzWkQXq6inmmgvutL5AIF4hxBoa4V0RvBoFBQ1bH4QE+TUDaHHlkkoCCfYdFFvka6H6HCJq615usgidkQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204081; 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=TgTvwcoVK4MIab8Yq/SxirUQSgGyWAAVwBn3bLNVjNo=; b=nk6J8rGmF1AUHwPpE0u65xsaCBy8wdDxKZiKMj/pLEbLTbz0zjq9A8NEsUSR8NiZCL3E0tsxa/2b+NWBvMXaPw5YblqAf9exzrNor76KGp/IuEOJacSdb1bZNfcVO5QtexJBA9ZiXGhGEt0CzW33FFI3adSDu2wsuBuUXYkPZgE= 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 1762204081925335.71927624671537; Mon, 3 Nov 2025 13:08:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lR-0000xc-PV; Mon, 03 Nov 2025 16:06:57 -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 1vG1lN-0000vm-4V for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:53 -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 1vG1lD-0005Dq-VB for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:52 -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-534-r8z-gm2GOUG1heQeedKlvQ-1; Mon, 03 Nov 2025 16:06:39 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-891504015e5so1501263385a.3 for ; Mon, 03 Nov 2025 13:06:39 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204000; 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=TgTvwcoVK4MIab8Yq/SxirUQSgGyWAAVwBn3bLNVjNo=; b=eKf6gktn+750PKH/U+UKxNa80z3WUObj/brN47Eb4nF6GpFobVLJfq4VvDV/2IU7pTlHkc fqKZGEFby6e+BFOzuxW8cRs0Bsqa+UpnXXtCmOOh44yHA99v4q+69mB5GgalS/TrHJfAV8 2m5gMDOeMe3CsjJQi0bhDLINdsDSB84= X-MC-Unique: r8z-gm2GOUG1heQeedKlvQ-1 X-Mimecast-MFC-AGG-ID: r8z-gm2GOUG1heQeedKlvQ_1762203999 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762203998; x=1762808798; 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=TgTvwcoVK4MIab8Yq/SxirUQSgGyWAAVwBn3bLNVjNo=; b=lcKKHDF7x5nWoawVibhYPS7rv5jMJzKNV3S947T5KuHrZenpPgsraPMDKatqOzNroj nKG2TW2G/amXQeTxj+TCu9rpvx1Nejz4wyIleYjwMIua0oRgZUg9xYWkqkbxiy69EviU AV1ueXHyLccnz8l2vgjhGLGEcXxMkivVql46bU9OBKH4l9L6F+SVxdIb9m4vLZGieHRo Uhas2ERHdsKAl27Aqs6dWGfZzb7OLMG/BZFnYomNa3I26PmgdGcc1vNZVRHQk3gd+sXm mtrZEBxguXqjUy8JlLS0DmmQ1/n2QAZ9HkEnYm/N8TCEuY3Epfo0q/0bGAoa9QDNNF1q blJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762203998; x=1762808798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TgTvwcoVK4MIab8Yq/SxirUQSgGyWAAVwBn3bLNVjNo=; b=fgbpRKG7UV7YVLbGdj31H3Vw2RpPNmmJcjouPPnJh5uvlCoPX+1f8SE47cs5siix9M 1oS/9dCcaGZq3jHSjlWwLIxwvBbG2UNGvt7RAMArILHgAGX9gw8kVTEUjcpck8TNYRuv VdW0vbJNJZp998N+XovvrlvK4SKwXYoGEFQUfQi3CdAhjQQ+DyxUV31uZhr8h8X8gzBv JqXEpYw8f9f0tSeZACSA5YrWviJx5aHrEBbBzVUBgXBaBmDQJcvR3znmauDZmAfhKBlx kR7w8FzHAaZfCSTCPNhkAtWAv79+V0IpsSZ9dphRliRtgjxIcp1tY5YPbidagx25FqIb tRxg== X-Gm-Message-State: AOJu0YzWeT8e1vbbMehjbhxht0zYAvXEtV4Vwby0E1PojnE5PvV/0jYj livog3BOMnZa2bWD6J/3S5pK3kEF0GIKTvsEnbE/+vWYX58fEdnhgWp3BaEfoolEMLBF9fxTpxR eTFu6aZJ/hX7uIblU7aip84mqnAmRFFqaGm+01nmvwrTQnX5QhQPhEYgnTqZEnO31KI+Mlf+JR5 a4DJ2qtheRFDT7yPrJAUR+XAbeIMX7drB0eplpxg== X-Gm-Gg: ASbGncvPQXMG+pVRwU5pHBW9D9L4y2LJFK2GCQrZJ2kljAvtfjkY4nZQH+0m2B1iLQn zVrwmkpDo4KEYUWLz3YQSNJauU5GsDzYZpkXRBGjFiCJWb77W03uRfgdRBYjqC6W2FHBHqKUlss xG4zMNSXC+UfEftZWrK2GdvXsK5afRY51U8lFO6tu7ChNLN0sEapG65u0CgncjrLs2JmQv3CmJJ 5Vvo5PoPa0nL7EptC/XIA5sUVentpDR1GmbkU+DTJyXLLGNpvOhylLvBLFtIuRi37qYZairZrNa MutikMvGKApXadUbc0gGojfsDEq3VvNyqG8ZBBgbGfCxy7ua1Vm2bd8GeZN042vY X-Received: by 2002:a05:620a:4493:b0:892:5b57:ea3c with SMTP id af79cd13be357-8ab98eb5112mr1582829385a.2.1762203998429; Mon, 03 Nov 2025 13:06:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKk0+JecMyMrdeB4AH7b+wJtIJTmyQ3kLsh8hUyco40zH0J3CHSG+eze+pk1lTcXuOL7GYLg== X-Received: by 2002:a05:620a:4493:b0:892:5b57:ea3c with SMTP id af79cd13be357-8ab98eb5112mr1582821785a.2.1762203997719; Mon, 03 Nov 2025 13:06:37 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Arun Menon Subject: [PULL 07/36] migration: Fix error leak in postcopy_ram_listen_thread() Date: Mon, 3 Nov 2025 16:05:56 -0500 Message-ID: <20251103210625.3689448-8-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204085944158500 Content-Type: text/plain; charset="utf-8" As reported and analyzed by Peter: https://lore.kernel.org/r/CAFEAcA9otBWtR7rPQ0Y9aBm+7ZWJzd4VWpXrAmGr8XspPn+z= pw@mail.gmail.com Fix it by freeing the error. When at it, always reset the local_err pointer in both paths. Cc: Arun Menon Resolves: Coverity CID 1641390 Fixes: 94272d9b45 ("migration: Capture error in postcopy_ram_listen_thread(= )") Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251021220407.2662288-2-peterx@redhat.com Signed-off-by: Peter Xu --- migration/savevm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index aafa40d779..232cae090b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2136,17 +2136,18 @@ static void *postcopy_ram_listen_thread(void *opaqu= e) if (postcopy_state_get() =3D=3D POSTCOPY_INCOMING_RUNNING && !migrate_postcopy_ram() && migrate_dirty_bitmaps()) { - error_report("%s: loadvm failed during postcopy: %d. All state= s " + error_report("%s: loadvm failed during postcopy: %d: %s. All s= tates " "are migrated except dirty bitmaps. Some dirty " "bitmaps may be lost, and present migrated dirty " "bitmaps are correctly migrated and valid.", - __func__, load_res); + __func__, load_res, error_get_pretty(local_err)); + g_clear_pointer(&local_err, error_free); load_res =3D 0; /* prevent further exit() */ } else { error_prepend(&local_err, "loadvm failed during postcopy: %d: ", load_res); migrate_set_error(migr, local_err); - error_report_err(local_err); + g_clear_pointer(&local_err, error_report_err); migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, MIGRATION_STATUS_FAILED); } --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204081; cv=none; d=zohomail.com; s=zohoarc; b=k/q0sI7YyfMlrbRdfE/n0k8Vy6B1RebrUKXh83g7YWYhPXyu4pctYlorTiGLGURHIjytKem85wl0pa8ajGC868iousp0m4/96G56hnOCxV6m30xVqZk+vhPv2NBkP5rJswp/vp37Vq5lgknypIDrulrWYJxVZmSsAEBeHNBGIvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204081; 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=TTTJ5KkeoKBsc0lcFpyJa0bBEoNg8mBqnoPB7lxFtyI=; b=V53CllN4BmhxpoIN6Ijxjhishj4VUczKSY7npKfYBGIsy93kotkIwNN+gmEg8Y7Sy2QU4YQoHJjqM8tbAjqOMlMGLcOe0wQPhFh5VxBFRCj6KXp5LFIPOAkxSXzNZvW8zOJr8rsoaGr7gD5iF3iU6pfJ8k3XXN9h0a9daYnaMZI= 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 1762204081525209.1165063871689; Mon, 3 Nov 2025 13:08:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lP-0000wn-PJ; Mon, 03 Nov 2025 16:06:55 -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 1vG1lM-0000vC-2m for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06: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 1vG1lF-0005F0-UY for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06: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-49-Ll90JzHJMhGez1flJifwaQ-1; Mon, 03 Nov 2025 16:06:41 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8a15d36c209so1307635885a.3 for ; Mon, 03 Nov 2025 13:06:41 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204002; 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=TTTJ5KkeoKBsc0lcFpyJa0bBEoNg8mBqnoPB7lxFtyI=; b=XNobGNJ1InrO9SWMsrSl4Rdd5TJfYZ9A4PrxxhzA/Xn+4gG7y8ONhwWgn8D1973ga+x6GP 5aeeUxngIrM7pfJqUG4rNNffrGskJ9/oqHF+b/PWcW97FHPXMGkGa6CcLgx0nMY7iATQEs 7x9USAOCHGmWItHC6vYcuYrQkVNsBqQ= X-MC-Unique: Ll90JzHJMhGez1flJifwaQ-1 X-Mimecast-MFC-AGG-ID: Ll90JzHJMhGez1flJifwaQ_1762204000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204000; x=1762808800; 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=TTTJ5KkeoKBsc0lcFpyJa0bBEoNg8mBqnoPB7lxFtyI=; b=NVMQZK4Ji+/9UIYTSjDnD75gUrcOHDK9XmNFDxoBkubfpYgoGzjAIfeiaLUA1F/2rs KQUbgZklzs21SMivElXslNWiEvRLDqYMWLVlVz1He7vNr20eM7/LKWjhGbtMBlhE/nfi brNhjO9ZdCrmtonKJ4Ojw9y/T+2TxH8LCUBbrHRuhsx3DVHVKoj9xicv77sjUWixdyd3 I+qvMehr0wKHtVZaeEZ1Ba9KNBf7WnpM4Cw4CtECA1M+mj5ojkyLl1Hl5AZ/mqSOEnk1 8OG22MlYJ2TkrV7r+Tnay0Fz1ytzGyEDpVKhkIj/VOJ6SXQX36FDy1Ko1K634rCadmut pkaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204000; x=1762808800; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TTTJ5KkeoKBsc0lcFpyJa0bBEoNg8mBqnoPB7lxFtyI=; b=N4KXdRXmFjLEbc0QRXMos55Ky6LhwRdefje7dPjjXfGY23pD5ZFspJxYwonLwtixfz xrAOkWfcwef3dJ5wnEQZtlTjvvzsVT5SgWYkWVaV0I/2rKw7XWBYlqM+2b4HcpQTYe2o PEd/c5c4JezGB5JB2zftPRsHEpCYd4PWdbzckxZsJiNjWautVhjwgrYrnpM39QxSoNqM PGI2ZisrAcLDAqMruliggJ66gNBPru868IKjpvwoV9QxwlFS6/A0vgfXel4It2Pd5E5l ambslF1dBm8TZlkc3YHSHOF61O0RqxSKtiqszOYdo4FIhtp7kPEHKMyb56PdEm692ct1 E/0w== X-Gm-Message-State: AOJu0YwC5a0+Re1X2oGxBEgwMtKQ/X64q4TAdU38Ku00oxbO04XmqUSN 7cNya5h9MpdvkeaPuqGxMR6AD1rsHNzf5fLklFuI9MTSmNs5x/X2JRhgrOgUr8Wfam7WodTRphL qttq+SxyTyKPIWCgoTEXopN+SxiUlae/SbmOwrB7hjD+9I5d2q1ds2nJJECQMe0JxfJFrxbaCrT HCzPT5dbY8UQtkK3u2pW+5vt0ZmlYgz25tVzHsew== X-Gm-Gg: ASbGncuonqXwTvBpg1yOL7NSf3/nx3yssCVXG+CNbZEhbqV5ML+ijzMpCdVbq6VUeUx sEyAyftmxvSsmXgo8YNjnujUH4iLwtLxoxYftJaHq2Isk9yKx+P4nWmhO2659CchtOfohg6V0wl S+uHzU6JD9cWvBrbPtD6KMY0trYWaAoNBE+TMLgP64vJslYE9k4pqPNKCM8KPvOfvmSjMSX+wKc Up8AfUl7RaGeYBsrENbeD/5mh1DRIjIq498NYCfc5NA0816Y5ukwj2SaeoUFYIX3mIQ+mO6/Y4/ eU6Y1f6HCrne03t93HrvXAQ7UDwOqlxgmKW63y5EUoCU/GMHxEiqBXpgur3aEi0i X-Received: by 2002:a05:620a:7118:b0:8a1:94de:cdc4 with SMTP id af79cd13be357-8ab9b883c55mr1553940385a.83.1762204000017; Mon, 03 Nov 2025 13:06:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8omSBDjPtGV9JiLFjB11GAK4g1Isibt3VefVL60uUKkJ1DJ7KEOfF+3MBQ7zpOJ/2lYP2Pg== X-Received: by 2002:a05:620a:7118:b0:8a1:94de:cdc4 with SMTP id af79cd13be357-8ab9b883c55mr1553933285a.83.1762203999404; Mon, 03 Nov 2025 13:06:39 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini Subject: [PULL 08/36] migration/cpr: Fix coverity report in cpr_exec_persist_state() Date: Mon, 3 Nov 2025 16:05:57 -0500 Message-ID: <20251103210625.3689448-9-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204085980158500 Content-Type: text/plain; charset="utf-8" Per reported and analyzed by Peter: https://lore.kernel.org/r/CAFEAcA_mUQ2NeoguR5efrhw7XYGofnriWEA=3D+Dg+Ocvyam= 1wAw@mail.gmail.com mfd leak is a false positive, try to use a coverity annotation (which I didn't find manual myself, but still give it a shot). Fix the other one by capture error if setenv() failed. When at it, pass the error to the top (cpr_state_save()). Along the way, changing all retval to bool when errp is around. Resolves: Coverity CID 1641391 Resolves: Coverity CID 1641392 Fixes: efc6587313 ("migration: cpr-exec save and load") Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251021220407.2662288-3-peterx@redhat.com Signed-off-by: Peter Xu --- include/migration/cpr.h | 4 ++-- migration/cpr-exec.c | 10 ++++++++-- migration/cpr.c | 15 +++++++++------ migration/migration.c | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/migration/cpr.h b/include/migration/cpr.h index a412d6663c..027cb98073 100644 --- a/include/migration/cpr.h +++ b/include/migration/cpr.h @@ -41,7 +41,7 @@ MigMode cpr_get_incoming_mode(void); void cpr_set_incoming_mode(MigMode mode); bool cpr_is_incoming(void); =20 -int cpr_state_save(MigrationChannel *channel, Error **errp); +bool cpr_state_save(MigrationChannel *channel, Error **errp); int cpr_state_load(MigrationChannel *channel, Error **errp); void cpr_state_close(void); struct QIOChannel *cpr_state_ioc(void); @@ -56,7 +56,7 @@ QEMUFile *cpr_transfer_input(MigrationChannel *channel, E= rror **errp); void cpr_exec_init(void); QEMUFile *cpr_exec_output(Error **errp); QEMUFile *cpr_exec_input(Error **errp); -void cpr_exec_persist_state(QEMUFile *f); +bool cpr_exec_persist_state(QEMUFile *f, Error **errp); bool cpr_exec_has_state(void); void cpr_exec_unpersist_state(void); void cpr_exec_unpreserve_fds(void); diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index d57714bc5d..087ca94c87 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -40,16 +40,22 @@ static QEMUFile *qemu_file_new_fd_output(int fd, const = char *name) return qemu_file_new_output(ioc); } =20 -void cpr_exec_persist_state(QEMUFile *f) +bool cpr_exec_persist_state(QEMUFile *f, Error **errp) { QIOChannelFile *fioc =3D QIO_CHANNEL_FILE(qemu_file_get_ioc(f)); + /* coverity[leaked_storage] - mfd intentionally kept open across exec(= ) */ int mfd =3D dup(fioc->fd); char val[16]; =20 /* Remember mfd in environment for post-exec load */ qemu_clear_cloexec(mfd); snprintf(val, sizeof(val), "%d", mfd); - g_setenv(CPR_EXEC_STATE_NAME, val, 1); + if (!g_setenv(CPR_EXEC_STATE_NAME, val, 1)) { + error_setg(errp, "Setting env %s =3D %s failed", CPR_EXEC_STATE_NA= ME, val); + return false; + } + + return true; } =20 static int cpr_exec_find_state(void) diff --git a/migration/cpr.c b/migration/cpr.c index 22dbac7c72..adee2a919a 100644 --- a/migration/cpr.c +++ b/migration/cpr.c @@ -176,7 +176,7 @@ bool cpr_is_incoming(void) return incoming_mode !=3D MIG_MODE_NONE; } =20 -int cpr_state_save(MigrationChannel *channel, Error **errp) +bool cpr_state_save(MigrationChannel *channel, Error **errp) { int ret; QEMUFile *f; @@ -190,10 +190,10 @@ int cpr_state_save(MigrationChannel *channel, Error *= *errp) } else if (mode =3D=3D MIG_MODE_CPR_EXEC) { f =3D cpr_exec_output(errp); } else { - return 0; + return true; } if (!f) { - return -1; + return false; } =20 qemu_put_be32(f, QEMU_CPR_FILE_MAGIC); @@ -202,11 +202,14 @@ int cpr_state_save(MigrationChannel *channel, Error *= *errp) ret =3D vmstate_save_state(f, &vmstate_cpr_state, &cpr_state, 0, errp); if (ret) { qemu_fclose(f); - return ret; + return false; } =20 if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC) { - cpr_exec_persist_state(f); + if (!cpr_exec_persist_state(f, errp)) { + qemu_fclose(f); + return false; + } } =20 /* @@ -217,7 +220,7 @@ int cpr_state_save(MigrationChannel *channel, Error **e= rrp) qio_channel_shutdown(qemu_file_get_ioc(f), QIO_CHANNEL_SHUTDOWN_WRITE, NULL); cpr_state_file =3D f; - return 0; + return true; } =20 int cpr_state_load(MigrationChannel *channel, Error **errp) diff --git a/migration/migration.c b/migration/migration.c index a63b46bbef..c8a5712993 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2301,7 +2301,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - if (cpr_state_save(cpr_channel, &local_err)) { + if (!cpr_state_save(cpr_channel, &local_err)) { goto out; } =20 --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204081; cv=none; d=zohomail.com; s=zohoarc; b=hAZZeohlBeEKmjO0ztzTnrlqrIWXn1wMsrjgKjPzFpUMt6nfhVK1VXH7Gj6iaKt3vKBltpDPmPcCs9XF2mUJBNXCrk+9cD2jXVqypkYCJM4HVfkOulVzL4IDyP+44VFg6owervJFNpD+OAW1lhdYxcJphIboS0Ej4dc4dmzJ8n8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204081; 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=6wIT/Q1/yvwXzarYjEbY8I5UPyz6fRTqd+O6Q6gEZcQ=; b=RPkcrae0jCZuWkEG4XRMTDFJE9niQNyiRZl1vSqSyhZNfoiW84Up0Noyou3/sxvDU/ERa2HxnChCwjZKEz3jAUplikJ0ZbY0b4k3vOalmy2tPVgiDPshvMVG9jsuhZkr+uqND3EOtBDX7HPLUusuG38xb6p/+QNFvnKwBY9vpCk= 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 1762204081268588.3347929809415; Mon, 3 Nov 2025 13:08:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lR-0000xG-LE; Mon, 03 Nov 2025 16:06:57 -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 1vG1lP-0000wR-D6 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:55 -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 1vG1lG-0005Fm-KG for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:55 -0500 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-814QGo5dP0u0TxEQNuob6Q-1; Mon, 03 Nov 2025 16:06:42 -0500 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4ecf9548410so157398481cf.1 for ; Mon, 03 Nov 2025 13:06:42 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204004; 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=6wIT/Q1/yvwXzarYjEbY8I5UPyz6fRTqd+O6Q6gEZcQ=; b=iRfHOt4JP2gA7RGBkIIyPFP8xLoJTrGP38X9HbO5Uvw8X515VLN1hUwyvB6STB2plo5z7E 9t5mjlku7CsKExinkVv0RWu407QyBTw+N/6BloysUPjDMN7CxB0M1DJsQ9vl/P0eS5ufSp chCI1UKhGMyImVgL8kIFGK3u5jpYRkw= X-MC-Unique: 814QGo5dP0u0TxEQNuob6Q-1 X-Mimecast-MFC-AGG-ID: 814QGo5dP0u0TxEQNuob6Q_1762204002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204002; x=1762808802; 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=6wIT/Q1/yvwXzarYjEbY8I5UPyz6fRTqd+O6Q6gEZcQ=; b=N47Ai1Sa7Ukbs6SEonq5a3Df+yrIU/Tlwa0d0gijYOigBjBl/jEcEmb9fu93Es9TeP kFnBrlifCsREmy1MG/YQCYj/6O2QMwhVJZECwzrAH4ZiHTHaOQ7VnCbpaDFx2PfnYrYP zBOZDd3i2nlGZB9dDj/E8RwMHZkU/uk0ENjOwdmyCH9ectLxYazozW9p3Rrt3FCH7/VB M0vVTz/YEuxoVN2ui1EXG0yaiXEbD+YPvRly4DMnGiDjAUBNk6tJl97gPiqGJGMRvnHO FzuX28rKJreKX5X6SW6b6KD3V+UOyYKXcHum/pRVTl8f8Wx8kseJHmeQgO/o3P2DkPCf 9B8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204002; x=1762808802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6wIT/Q1/yvwXzarYjEbY8I5UPyz6fRTqd+O6Q6gEZcQ=; b=lyyufLXnlUYwlPoUtZ+F4uVaRkGKcyj1DUxfWwobTEZLsctGIq1XNQyixqdsYIzIU9 MOr7ieFSmSQKOUB5DnwjsbzrBCqmu4AmX1iEzj8rQ8ZBHWQMbsqOwMRTT1LYrin1VTo9 vQaE8LhMRVxVrnH9o5K56cft3XK+Dnabg7z44qA5hfNRULxHSdm4+kXLHhy7Zw8F/nVZ D8wHHB5tek/uCYCcBSQq919hejCRLsgBsRzP8hCs7+ggEeAovQz3I5NzRaYAcIIzeYut /EZ7n5eNPkrGu6xoTa8aOt7j1Jm0S9wHK1Iojrv8NvZNARrRQx9e7rJPok40Z+Uks905 ZKAQ== X-Gm-Message-State: AOJu0YyKcqAjkA5ndwfaYmVDhBfzlBFBc3pugLe3fpwXOp9DUUhtBjhl z/x47yYjcjOgksssbEl+y8gbOoK3b3wZe2gCtGaVEv5TMWBZhCvdNIrK5Pjbztd3Tlq2l6LuDnQ 4llfADWGfa6/mta+xpOlIKpKNh0KcX6ZamhHySH2Y/RYUcVFm5lTxNAa79CsccLoDvso4UTW898 UH7EpYJ+WQFZ1ALPuqn2ab4wVYQFm69oyHFW91gg== X-Gm-Gg: ASbGncvl60Yt2j/dev60XkzMM1B0BJ9BwEN01sRS3QXFewVQt6XDj4SK0WCPb5kRmGV 8wWmgE/TKxlyxON88dMlpIuYz3ixLzSBofbO0wxJ6zBbQ5qXYUZx/rToj06tOaigPRHTWH15whv CHpHDzMN+XMMZ48P78vrVngGIY2vpyjrwYAwn332wJ6Hl/BZXsnEtZO2QRt6n4w3owi8evaEX55 GwD8rKcXrdQlb/SJ6LJMCAb8v5clnwaBb/9vowDBzY83fnLdqP7gbfycjpS3APyaKqhbNuJt+jI m3UAyxNG72Odi+1avpYboxGacfLzaQ5Ov9Anozcxoc+WIMhd/EzeTvF/Xqbk5OgX X-Received: by 2002:a05:622a:114:b0:4ec:edf0:561e with SMTP id d75a77b69052e-4ed3100c097mr163275721cf.63.1762204001683; Mon, 03 Nov 2025 13:06:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfYIAcG7UH4VPOmB/TFVo+IrpUQJIlxfNo+gZojt0C1DqiNnnUqZsGFEGwZsDkJ/JZjmTa2w== X-Received: by 2002:a05:622a:114:b0:4ec:edf0:561e with SMTP id d75a77b69052e-4ed3100c097mr163275021cf.63.1762204001070; Mon, 03 Nov 2025 13:06:41 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini Subject: [PULL 09/36] migration/cpr: Fix UAF in cpr_exec_cb() when execvp() fails Date: Mon, 3 Nov 2025 16:05:58 -0500 Message-ID: <20251103210625.3689448-10-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204087660158500 Content-Type: text/plain; charset="utf-8" Per reported and analyzed by Peter: https://lore.kernel.org/r/CAFEAcA82ih8RVCm-u1oxiS0V2K4rV4jMzNb13pAV=3De2ivm= iDRA@mail.gmail.com Fix the issue by moving the error_setg_errno() earlier. When at it, clear argv variable after freed. Resolves: Coverity CID 1641397 Fixes: a3eae205c6 ("migration: cpr-exec mode") Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251021220407.2662288-4-peterx@redhat.com Signed-off-by: Peter Xu --- migration/cpr-exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index 087ca94c87..d284f6e734 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -152,10 +152,10 @@ static void cpr_exec_cb(void *opaque) * exec should only fail if argv[0] is bogus, or has a permissions pro= blem, * or the system is very short on resources. */ - g_strfreev(argv); + error_setg_errno(&err, errno, "execvp %s failed", argv[0]); + g_clear_pointer(&argv, g_strfreev); cpr_exec_unpreserve_fds(); =20 - error_setg_errno(&err, errno, "execvp %s failed", argv[0]); error_report_err(error_copy(err)); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); migrate_set_error(s, err); --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204347; cv=none; d=zohomail.com; s=zohoarc; b=hWKcyjtGZc2I2JkUc/vk/T7peYW3xcHN68w5zYPpi255cjHpseu6C2IhwV0YDSzEcWDyCDskwS3H4NyTgLyDDgtX+YEK22tJQBOUW1pWkC2QpatMxhvVEP081j6PEL7ViDU2EiEa8XjW8FsLEKQJf7+miuW5HX5B5LcEt0Oc6rA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204347; 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=75HUCE6Au07SRMomYeRAuTHnwe9a6Sk1ODLtoL1BP84=; b=D+rmnjqIGIN3TgDwaGXQud2746uv4AV0tbgGtTv4s5yrSTGFnT2U2g4Rvp920Rz9KqcTJxXShmPn4XE86JLbBagBghVBWG7Bh0tcSdtdtX2UD7ySmZk8rgf9TTepkOp1piuEF5ULwTocOP0hiHK6sizNacQU4G9er7yEbKT7weQ= 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 1762204347867136.86273325651212; Mon, 3 Nov 2025 13:12:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mz-0002FS-2n; Mon, 03 Nov 2025 16:08:33 -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 1vG1mw-000236-Pt for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:08:30 -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 1vG1mn-0005eJ-Jo for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:08:29 -0500 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-ScKG4onfPMq3SZINCuIb2A-1; Mon, 03 Nov 2025 16:06:43 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4e884663b25so141325111cf.0 for ; Mon, 03 Nov 2025 13:06:43 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204095; 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=75HUCE6Au07SRMomYeRAuTHnwe9a6Sk1ODLtoL1BP84=; b=bdtIGPNltiTF0o8yyhAJmICw+YccdQk3M+jshDNPxApQXTlDFXvEBpMMFUHhDV0QaPbcIL 1qKhmYu/ccOG3wDg5TME3fcYBgUquVObcILWAqHadrbbmcV96eQ1JgetuP/vopHXZsCgHu k0NrHB/1G8FthBm4mPNNfrhzp/mxy0w= X-MC-Unique: ScKG4onfPMq3SZINCuIb2A-1 X-Mimecast-MFC-AGG-ID: ScKG4onfPMq3SZINCuIb2A_1762204003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204003; x=1762808803; 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=75HUCE6Au07SRMomYeRAuTHnwe9a6Sk1ODLtoL1BP84=; b=euMwymwLUid40PEThuKrdHVxbsbLqL/hJJfwnCFj+2JRZ6xN0QXQ6ZrrA5w6chjRgc HPwaTe3Ox1F0NAUwtfLPwGJ7s41vNIkdrg/bN8WxI6q6trOPH50ymJM4MA2f5W9P2Pgw v6TrX+LSBx/iuaMcxr9xzfpEmQuakZs7M9/rnSTsu7hR7HZkQ1INrukOhBI8uJ99ZKgh LmPtYDhHv6fNFynV/fh8DVzgR0NUvXrOg2LShiojyVSIxhjmckjPv1Yt/ZnWDK4JPlCP 7NfwH8INikax4Kaus7rYAoexXklscNla/Cs78GH3JW5RcYFZPFsoThmfzVOo3UWeID+/ 87TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204003; x=1762808803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=75HUCE6Au07SRMomYeRAuTHnwe9a6Sk1ODLtoL1BP84=; b=pyBpeCEIU21J91yai1mlt+cEFpYoOtCkumXiZiSDXQJx5k7Ja0S35Hzcp/mU52L4NU d6PA0OMVf+THT9zR1af133iVl1B1m7kCa4zAJpe6kgBVggKGzzFOGYpXY6XlCh3xfrGN 0HqMGf98zoKY3AFa+6pA8GXEHp5RY09NeSo65LSx18c9fcFLHXxrVVCkn3EJlyS0cK3T W4arnjd5OGL2haH+S4+9M/6TK/k/ZzoLfnjoWtyUFDLiOEtgHKJACf5GNjOWwPtaGiy9 2bk4LVawQi/6hwKx8yWF71tg5LG8UqT+B5d/zO5NUwrpV74H4oyeWDMF90iWoBtxRvBr JWjg== X-Gm-Message-State: AOJu0YwsmLcoMTUbb68HzSAIxGONBiBxiJficXCjwnhvFXD5MTSWorXv 0IFw1fSULMihU2rBawZBbHs6FEJkKaILjW+jjDRZ9v4XYBm3oEUf+gnjkQwzW4PgOGAo94SbjD+ whrD5222N1xDJCtZT4V+5qS9xESAQdMlRL6cxGPU8KA7axjW9ufFrQMLQyZ22sJZM9I98iIHov5 NDoiyWPM0QS66MItdqejQqdboBjxXMlHNVAf50kQ== X-Gm-Gg: ASbGncuSj3t+PKUWR9brW8y/yNUvXL1uRfn2OobBNSuQJBOj4qGm5Xy8EEZgltEu6hw KtnCjqmUXBb19bUfdrXt8Kwg7xgU6FInJ4lQGV0zOGX6qfYclI6K79BWB1og5lVoo/BSwyVucDt lZFmNjr1rg8NN9HHAstSBc2RSfu04t9ITZZwN79jGCbLMlzXErDK1ktoTX32agZxFK9Dnzexspz QCxth+GytqN9Da0T7kR7S7Pu1te+AAyHfcr/q2PNcOJenmaOtrdzN4xZW+kCeQgbH80xci/yl4q XHn5crfcDAQjYVLsUmLk/Lsdn7+60f06KWzzpMyEgjbPK28Al7RUapgxWTrxO2xB X-Received: by 2002:a05:622a:8307:b0:4ed:62f5:e1fc with SMTP id d75a77b69052e-4ed62f5eef0mr3204321cf.75.1762204002774; Mon, 03 Nov 2025 13:06:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzcjDtRhaAc5+MuRoat9YXC6wz9fw2LxPPsgI+htkumYzq511qOktleFJzNhyTw681TNwVvQ== X-Received: by 2002:a05:622a:8307:b0:4ed:62f5:e1fc with SMTP id d75a77b69052e-4ed62f5eef0mr3203731cf.75.1762204002219; Mon, 03 Nov 2025 13:06:42 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini Subject: [PULL 10/36] migration/cpr: Avoid crashing QEMU when cpr-exec runs with no args Date: Mon, 3 Nov 2025 16:05:59 -0500 Message-ID: <20251103210625.3689448-11-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204350302154100 Content-Type: text/plain; charset="utf-8" If an user invokes cpr-exec without setting the exec args first, currently it'll crash QEMU. Avoid it, instead fail the QMP migrate command. Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251021220407.2662288-5-peterx@redhat.com Signed-off-by: Peter Xu --- migration/migration.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index c8a5712993..4ed2a2e881 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2195,6 +2195,12 @@ static bool migrate_prepare(MigrationState *s, bool = resume, Error **errp) error_setg(errp, "Cannot use %s with CPR", conflict); return false; } + + if (s->parameters.mode =3D=3D MIG_MODE_CPR_EXEC && + !s->parameters.cpr_exec_command) { + error_setg(errp, "Parameter 'cpr-exec-command' required for cp= r-exec"); + return false; + } } =20 if (migrate_init(s, errp)) { --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204347; cv=none; d=zohomail.com; s=zohoarc; b=h3Xg6zT6IkfMuSo3GDzn0e4xZ5RyRP4RCQVWshmnRUDUiCchI75SCnjozmNOHe8ELV8rx4O/g7dO6dod+Uaa0Qfvzv4XTNejn9f60c9mIpwhY/OrvXwxn78sxhaUFUj/T+TuZnTsal0XP+7W+5+v8ydcnVZzyLKVZ3fSPjJtAqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204347; 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=v6q2Mc0njNr3TWUKu7QBTNvu5m4/u/rY7x+4Ecu4W44=; b=XQtMhwT+GjNxB7028dxEkox4zolmIv6cyWjYs1PRTwxR3iYLshjOdTc3CWPnUvdhGSsM+pYf47yP2g6Zm3EfK+laBFhU0ysMTkWEfeFIP3OHfGQ1Xsw6R0BXKkxm7g+4gGatcX0XsZxNJKpDgi6txtGqgRJRcKm421A8VNXaLrU= 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 1762204347031989.4964864096258; Mon, 3 Nov 2025 13:12:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lW-0000yQ-7q; Mon, 03 Nov 2025 16:07:02 -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 1vG1lU-0000y3-MF for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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 1vG1lJ-0005Hc-LX for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:59 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-urqA6ZyZOYeYtMcVKVKcEQ-1; Mon, 03 Nov 2025 16:06:46 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4ecf1b7686cso185871131cf.0 for ; Mon, 03 Nov 2025 13:06:45 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204008; 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=v6q2Mc0njNr3TWUKu7QBTNvu5m4/u/rY7x+4Ecu4W44=; b=U9vl9WBZfmwQYQWJbwU/uRlKIu1eNulXCf293T7F9EWut2KW1eyC2Qw5CYKsCw1UAz1nCp SBwhOtPfH9r7TKukilKo+ARnqzJXTyPTd5yAfW7OxLgjARawMaH4rq6iepJp51kO2BJgWp 0cJ3lvZQkAjxRE0qM6Rnps9MkXDvW1U= X-MC-Unique: urqA6ZyZOYeYtMcVKVKcEQ-1 X-Mimecast-MFC-AGG-ID: urqA6ZyZOYeYtMcVKVKcEQ_1762204005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204005; x=1762808805; 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=v6q2Mc0njNr3TWUKu7QBTNvu5m4/u/rY7x+4Ecu4W44=; b=F/hPvq/T1AtBHr6c/uoodGUvB8OxKopnBClOsEbnHpQ02nncBD1/b1R2EmG8NQGrla KiJYhejqgaQ2WRNEOiPuxtYCKR/7dCkKJk+pQWCNEOBd4643D9fvfukxJjlE0NDTdF3B BjAku6RCm1uNggjo78mnpVAkk7DBGaeeXUeyTjgkkHBU/QdpsJG0kxJa2uxQeEiiAKU+ nkjjZG8kiBMfQuMtKtQlReGbuSSlir9q5+9Ytd3wn4mLfFRwrHQ8/w1fffoU1Gc+G/zT C1d8S8SsgWWT4JpAm3TO9SNegzoC/A7sY3G8rjEJnoGUSSHYrvc7AH7vNl25C665onHO ftdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204005; x=1762808805; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v6q2Mc0njNr3TWUKu7QBTNvu5m4/u/rY7x+4Ecu4W44=; b=aH68YSjoILZXCNJhlloXNN8f5swjmPkHK5m+eASUdC5ylZJIT2ZQ1otmbOKdGaqsCi Syqu3HvQgkFw/QwcGlcraSC+Sbicsbin0paQwOBfKdDPdMvqm91MmDobMZ2nRkv1trjQ rfzrRf4ab/0K9aW3w3XmEu7STiAvJHm8eErDGCj9lfZjVNCxFUOQ2k4oafpIrhXBbaNT 0NGYOw7QQUVT/Tw3/NksSAlKUCbaN+E/v6DrWZRpyymCHE6wrUDpywAHBf6QVsr8Rrg7 +TtpXVXOY+K0SbN4TJ5zB3daIioNJ70+GmuzPQVXq+6SO89evf39ImGV38jcaMDlZd68 a5eg== X-Gm-Message-State: AOJu0YyCAZ03o5ZQRixc344OQc2AZJ6MpqRsW+cGBlOSbiQK69gIdYQ8 4I0tok0nMD/IAWLtw6lFZQAZdpAFVLFnmXTdInxeQIQlUr4CjHJZ3ZA1oHgbja7BsvEkR4tLLWE sOInwSkdzSMODiXsudoWZ5xROuI5h/drKv3DInxFavov9P/WzvongYru1IiAoYJGDdyQ8J3SP5F adzmr5/Mt+V/3VKxhJ0xPJH8lLP/AKclimW8/vRA== X-Gm-Gg: ASbGncuVLnoTP9pcj/jm9JmkZ2k5X2ZoVio3NVffiT51Ocd7euLSn+o2KdWdn+Q57BD 2mxRtHOh8MdYg+yZnS5hazD080u3FGhAccjWA04asFAZ7nD4n8/o697iTyTxV8LjD2WAZ8y1n2H xtRJswdpQy4LCRpa6L62kvkdbz/qgVcBa40jqNFhmTAaZFNsel6EhacDWyuxwXh/p4ErUFbODSy +A32kyt7DjktbSao8e19R8tNSvUzmI0KY70q+agqt9R+4ad6Pj/1YLgOPLzkzHNKi/6rmGsc5vt IzdvZL+3nh9jQvePhx8xPw1/un6MOuevIeAZ3myTMxypd7xTay/1J/deWqtePBJR X-Received: by 2002:ac8:5fd0:0:b0:4ec:fc9a:1802 with SMTP id d75a77b69052e-4ed60df079amr11088211cf.42.1762204004681; Mon, 03 Nov 2025 13:06:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmfcajXDTtdGJKrir4F1nkVfRWq+xN8FnIIugLW0uFFIglb9+VEUWYO4j1IZ+AIGTMRqRbzw== X-Received: by 2002:ac8:5fd0:0:b0:4ec:fc9a:1802 with SMTP id d75a77b69052e-4ed60df079amr11087361cf.42.1762204004108; Mon, 03 Nov 2025 13:06:44 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Chenyi Qiang , Farrah Chen , qemu-stable Subject: [PULL 11/36] ram-block-attributes: fix interaction with hugetlb memory backends Date: Mon, 3 Nov 2025 16:06:00 -0500 Message-ID: <20251103210625.3689448-12-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204348376154100 Content-Type: text/plain; charset="utf-8" From: Chenyi Qiang Currently, CoCo VMs can perform conversion at the base page granularity, which is the granularity that has to be tracked. In relevant setups, the target page size is assumed to be equal to the host page size, thus fixing the block size to the host page size. However, since private memory and shared memory have different backend at present, users can specify shared memory with a hugetlbfs backend while private memory with guest_memfd backend only supports 4K page size. In this scenario, ram_block->page_size is different from the host page size which will trigger an assertion when retrieving the block size. To address this, return the host page size directly to relax the restriction. This changes fixes a regression of using hugetlbfs backend for shared memory within CoCo VMs, with or without VFIO devices' presence. Acked-by: David Hildenbrand Tested-by: Farrah Chen Signed-off-by: Chenyi Qiang Link: https://lore.kernel.org/r/20251023095526.48365-2-chenyi.qiang@intel.c= om [peterx: fix subject, per david] Cc: qemu-stable Signed-off-by: Peter Xu --- system/ram-block-attributes.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c index 68e8a02703..a7579de5b4 100644 --- a/system/ram-block-attributes.c +++ b/system/ram-block-attributes.c @@ -22,16 +22,14 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttri= butes, { }) =20 static size_t -ram_block_attributes_get_block_size(const RamBlockAttributes *attr) +ram_block_attributes_get_block_size(void) { /* * Because page conversion could be manipulated in the size of at leas= t 4K * or 4K aligned, Use the host page size as the granularity to track t= he * memory attribute. */ - g_assert(attr && attr->ram_block); - g_assert(attr->ram_block->page_size =3D=3D qemu_real_host_page_size()); - return attr->ram_block->page_size; + return qemu_real_host_page_size(); } =20 =20 @@ -40,7 +38,7 @@ ram_block_attributes_rdm_is_populated(const RamDiscardMan= ager *rdm, const MemoryRegionSection *section) { const RamBlockAttributes *attr =3D RAM_BLOCK_ATTRIBUTES(rdm); - const size_t block_size =3D ram_block_attributes_get_block_size(attr); + const size_t block_size =3D ram_block_attributes_get_block_size(); const uint64_t first_bit =3D section->offset_within_region / block_siz= e; const uint64_t last_bit =3D first_bit + int128_get64(section->size) / block_size - 1; @@ -81,7 +79,7 @@ ram_block_attributes_for_each_populated_section(const Ram= BlockAttributes *attr, { unsigned long first_bit, last_bit; uint64_t offset, size; - const size_t block_size =3D ram_block_attributes_get_block_size(attr); + const size_t block_size =3D ram_block_attributes_get_block_size(); int ret =3D 0; =20 first_bit =3D section->offset_within_region / block_size; @@ -122,7 +120,7 @@ ram_block_attributes_for_each_discarded_section(const R= amBlockAttributes *attr, { unsigned long first_bit, last_bit; uint64_t offset, size; - const size_t block_size =3D ram_block_attributes_get_block_size(attr); + const size_t block_size =3D ram_block_attributes_get_block_size(); int ret =3D 0; =20 first_bit =3D section->offset_within_region / block_size; @@ -163,7 +161,7 @@ ram_block_attributes_rdm_get_min_granularity(const RamD= iscardManager *rdm, const RamBlockAttributes *attr =3D RAM_BLOCK_ATTRIBUTES(rdm); =20 g_assert(mr =3D=3D attr->ram_block->mr); - return ram_block_attributes_get_block_size(attr); + return ram_block_attributes_get_block_size(); } =20 static void @@ -265,7 +263,7 @@ ram_block_attributes_is_valid_range(RamBlockAttributes = *attr, uint64_t offset, g_assert(mr); =20 uint64_t region_size =3D memory_region_size(mr); - const size_t block_size =3D ram_block_attributes_get_block_size(attr); + const size_t block_size =3D ram_block_attributes_get_block_size(); =20 if (!QEMU_IS_ALIGNED(offset, block_size) || !QEMU_IS_ALIGNED(size, block_size)) { @@ -322,7 +320,7 @@ int ram_block_attributes_state_change(RamBlockAttribute= s *attr, uint64_t offset, uint64_t size, bool to_discard) { - const size_t block_size =3D ram_block_attributes_get_block_size(attr); + const size_t block_size =3D ram_block_attributes_get_block_size(); const unsigned long first_bit =3D offset / block_size; const unsigned long nbits =3D size / block_size; const unsigned long last_bit =3D first_bit + nbits - 1; --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204210; cv=none; d=zohomail.com; s=zohoarc; b=HCsVwnlkb4N9dszxyJNNj6v/rT2rikc3Jeivkro2n38Ir3j+eNJ8N7YTUwRzWPvaHe9x2zeEwgzUZnCKqqCGDxCJYNuTnG3YJ4DmqHaXMcweYU9QWTcOnSnZuAyal1QFM/QPGcmOKRUI2jdOz4wFef19YocEhU9sEYchd3xals8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204210; 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=cddgOWi5vxb2ekzhK5snv98M/SU5nsUUCc7+MBdGfjw=; b=n1dVAZIhg2N3Q+kACmX3scp57MTAalzPTJuHyPX9SIpxmTrmAua3LcfWh1DQnoCR0oowi0cQHrGfBnBpynyf32g0srcr3gANapJnCwPNiks+SQwV4pQKzGnEKDsSIksBjo5yqleA6IfXRB3hS5qw3OEo2Fvb4tbueXVjAZGMKrI= 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 1762204210879135.4826966894825; Mon, 3 Nov 2025 13:10:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1la-000102-Ll; Mon, 03 Nov 2025 16:07:07 -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 1vG1lX-0000yn-1Z for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:03 -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 1vG1lL-0005I1-Sx for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:02 -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-674-wulIexYgMy-CNQ7xU1cLRw-1; Mon, 03 Nov 2025 16:06:47 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8908a248048so1185632485a.0 for ; Mon, 03 Nov 2025 13:06:47 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204008; 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=cddgOWi5vxb2ekzhK5snv98M/SU5nsUUCc7+MBdGfjw=; b=I4wBOe+vHNJpQWLRpWWNQ46Pw3H4yOWlIfEqAMC9CKaHCoM5gFuUwS5zl7Nsu7J+X3hzPv /+AyVwstpFb3Bc5aUXyqQ7GPL/1Ha6yImwfhrN5MajwSEYlyhTXkvBiAOcfM6FTyioGay4 TJelCz8zRevxgL3paA8YCkCgMfI7FLo= X-MC-Unique: wulIexYgMy-CNQ7xU1cLRw-1 X-Mimecast-MFC-AGG-ID: wulIexYgMy-CNQ7xU1cLRw_1762204007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204006; x=1762808806; 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=cddgOWi5vxb2ekzhK5snv98M/SU5nsUUCc7+MBdGfjw=; b=gQIWb6DLg/qN/n5UIsTOwRZL+EXoi089Of6OyPkWSe6svXpwJ7mk7RLlUwNFWnHFA7 tnI4njxYg5z2HP1We1+9eiizSn1zicTJTjZctBUk8YCSOUp/sKaN6dNv1lPPWmeDxSAo yU9OTmXfDHx+lZ9b9jPFj2cVR+rJqmlGrfCjpRS8+ppaO5PXRp18+cz5WPF7JZwQZ1zo japgWoUOY/PiMCnsc9/FUa5YtvtBHpRA0RBN5S5hHiW5m/W2KtVhz1ZHe4aFkhiKQogR d8QlYKo63wFhXFFEapUSd8BJu9mkfAfjxh8Lq9IGQUNijgNfYccsy8/ym0OQGA8MINXL Ofyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204006; x=1762808806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cddgOWi5vxb2ekzhK5snv98M/SU5nsUUCc7+MBdGfjw=; b=groS7w9qPQpSmOAAAPbDTMZqExGMsGfH3EL75QZb3CdI/dkTrR9jb+vsDKe3Waz1Ky 7rKPH93BDet1D+yUZtfyOO6VJjBEnuAeAD2ZtgXR411gSr/BIYRRA76s7Us1uedhSgSU WAytWVfhazFWBWCWsEbxPZzyWCMkplHF0h4etclyp9nOj6zO70it4rmiywJ938JD51uT I7VuaG0OcBbO0qkTDLVcewZ4zE7x0f8DrEEfVAjZb5GG5dCpPUjHfxFSOXY4aBq0ARaz xmqHF2JTjUr4P4CJpKUOBam/XjfNbxUE+lnLy3kRIcmSYXbOy03YkTPIQOSmnqhas+q2 PONg== X-Gm-Message-State: AOJu0YzbsUNr1QSUYN84DTMzXX9gZWjJ7srxufYpTdRZ2fyDUm2UGv4F 9lDM/RCPTf8God9Yv4h4bjIsPHSgkZcJlwAioo8tDMvIDOygavBFdcGDX1sHTY041wfjzA6Fxzb dRsrmmLH7RHXk9yzIMeJceuqLqEq3uOMJfKCL83xwNBcgNR3wo6+fFLLswQRvco8DqeefO0KEkp PEZoW7U9g+L6/wiwcbZZnMpf5+QrzhSOA9sECGRA== X-Gm-Gg: ASbGncu+z1alXmwEBS5/nK1YfQnqb7ORxR/+ogCxwVkZA4vBYgJXKOW4yqxDjcJ/Xwb 5//8wZAM0hSAt4TKg58q4qgzP+WAJmblJ0tv7kLZDSMBTCLQwk6FSTgzrDePIhQZIawr1iVeDL3 oCe7grCfV6vc5X0rFywMvbVnlnOs3mqNZqwkubPnfUzztfs32uFMwj8OU/eLeDuevGA2SpVRv1L DkGIpD0NBUHe951Rvb4mhbGUO4jc2EYfb1mgP1TfYNTKh9LT9Ppzh4wYZE7hZe+6AJ+S9uhxeCD KQ1Kx8KUjbIDnqxGsX+SVXqycpXMs3gFMXEgubIdSQoS0gU133r9N6HkukERv9HV X-Received: by 2002:a05:620a:4483:b0:8a9:b0cf:fba2 with SMTP id af79cd13be357-8ab9b883fbdmr1636097485a.86.1762204006044; Mon, 03 Nov 2025 13:06:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLOfS1/7ozpb1CvUxcB1UwHLxPKgN4bsDiFLAUk8P9gMe5RjsXZLcimFfrXIiZ2aUE7gV3xg== X-Received: by 2002:a05:620a:4483:b0:8a9:b0cf:fba2 with SMTP id af79cd13be357-8ab9b883fbdmr1636091385a.86.1762204005454; Mon, 03 Nov 2025 13:06:45 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Chenyi Qiang , Farrah Chen Subject: [PULL 12/36] ram-block-attributes: Unify the retrieval of the block size Date: Mon, 3 Nov 2025 16:06:01 -0500 Message-ID: <20251103210625.3689448-13-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204214588158500 Content-Type: text/plain; charset="utf-8" From: Chenyi Qiang There's an existing helper function designed to obtain the block size. Modify ram_block_attribute_create() to use this function for consistency. Tested-by: Farrah Chen Signed-off-by: Chenyi Qiang Link: https://lore.kernel.org/r/20251023095526.48365-3-chenyi.qiang@intel.c= om [peterx: fix double spaces, per david] Signed-off-by: Peter Xu --- system/ram-block-attributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c index a7579de5b4..fb7c5c2746 100644 --- a/system/ram-block-attributes.c +++ b/system/ram-block-attributes.c @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttribute= s *attr, =20 RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block) { - const int block_size =3D qemu_real_host_page_size(); + const int block_size =3D ram_block_attributes_get_block_size(); RamBlockAttributes *attr; MemoryRegion *mr =3D ram_block->mr; =20 --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204301; cv=none; d=zohomail.com; s=zohoarc; b=mM+g1IxOBJ/psOOG7Kl70VMY149HYtHOId3dhVSEqkLPwdIM0i8pknbSuguZPpiaLrL8cGF3IkX8TQL4S4UnalWwevi6QkTrxaSaSXEsSJLAuYwHNgpufVNLCRQ9UrQC7yqDA15BXkSkL/j+CwOeEeHGGBsi2JkSWZ1MyiuIFvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204301; 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=ZwNCvExcsouMK7Enx+vePUsZL3j/5e0nseGrkexQXYE=; b=hoVKh4XimstBescQyq/m0VYWadb0g5o74qAbEUph0Z7Akbpd3h05UTx8JzBanp4tKDEdUtAbXFAliYPkCk1pMmFIzrdekhaDPPo98MXgpxA7x33brJIZL4/u1m4YUiERG6CYG1s5x45eYIM2w59fN+wJ4IOPymSN+bLIcebun6A= 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 176220430170841.48902248357592; Mon, 3 Nov 2025 13:11:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lS-0000xj-Hf; Mon, 03 Nov 2025 16:06:58 -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 1vG1lR-0000xF-It for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:57 -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 1vG1lK-0005IE-J8 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:06:57 -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-639-LQXyx7fQPv6e1NBqFLHxeA-1; Mon, 03 Nov 2025 16:06:48 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8a4ef35cc93so1433902585a.3 for ; Mon, 03 Nov 2025 13:06:48 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204009; 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=ZwNCvExcsouMK7Enx+vePUsZL3j/5e0nseGrkexQXYE=; b=X9odkwUpRVjnXQJJa0qtYeZJdsN0fjjHtOP54YsX89crzdUSCrxC9Na1Lt1/IjdPUt64vx qdnZMaWE0iZEu8CAWJgYreBdvqMZopovGVRU/PwoeW4iyl2PUtqpKPZO5K19hOgx2v2rQk 59h9eWLgCi0WjTPusRoUeX76f62ddew= X-MC-Unique: LQXyx7fQPv6e1NBqFLHxeA-1 X-Mimecast-MFC-AGG-ID: LQXyx7fQPv6e1NBqFLHxeA_1762204008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204007; x=1762808807; 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=ZwNCvExcsouMK7Enx+vePUsZL3j/5e0nseGrkexQXYE=; b=hx5ROIuZNUNjNon9TJysl+nwftVnWtyUUQG3U1iUtJXOQm6xOcBfhpFu3R8lMFPkJK iLr5I8nB8ayPQfEpmt0NamhUFXy7ZXh6EyPDUwOuF5ZA4qmfnvyZinNsJQg58W5AEoru loMdDGDEUSHqln2MvrVM7Ug+6VU+9mmdccZyuz/oJcw2XbEd9DpaZFa2EXv5uATKWPsv Etng6kCQw/1/WQGBvZzNhzwzOqp0oMrFVJPQGBVQOtU6XfKgeTF91E9ILr9XA8OXSYa0 YKmrxk+MtASbW1sAZTN6jmhDufVPyHh8CmUFjcBBxqQNAR2UkhaiVfBYRCmSz7F0ATgY DMuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204007; x=1762808807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZwNCvExcsouMK7Enx+vePUsZL3j/5e0nseGrkexQXYE=; b=b0PhUNpA1w4zwWnOWifxSresIgprLgkWiXQrQox8i4MkL9Dmq0s4jJxZ0+3p3uY0OT FajWcScGjf6qHOl77k0Iut2jFvskVSBkALWZ6ka5mEP2QqpmVJ07PFBtZi+FFHBQAKxG LJTONPgdy6Go+J4bYVhlzs1ELKMSxWv3AYf6FwYgMDQl6uKp63llz4Bp23w7PXImslwT vOEJMwkuFO8PpLlwyT5nxsvLoOlX7xikF/i0K1v8uNynQyTcrIzIbjXtETPOkm1l1dPt wTPXG6UVKDH+zeWNPo6QwMXrb5+mbhWb1LOR0AOvpO/uEH1aEH4TTo74ZEIYHcHz88zO 7Kiw== X-Gm-Message-State: AOJu0Yy+Kjb/1jzmrDFZoNNtrX3Gd/bxA3u6QJKnPSyIXuZ5pLUVWHxY Sg0lmcgIKafeoKxPcHcTZN9/W3u7RUCeLKgaZizSwr9ag3jomaaUe3IDDwW12FFSCyaxIkOynZo RgeZhxE6kXI1mR+pwdn3CgAVOGEf/a48ETEYtph+flEWo1+hMfqHz3qy4lfPd73P46w7WBC+A/M l82MDNS6R/I8+HAmO5DWj5FL4wtV6oobcZnlWYQw== X-Gm-Gg: ASbGncsYXenLXpsNoB6NKXPOkBoClUcgkuFMD78kgMlfSf7UfkbdynVPxncwVmQZfL2 eNVVup2LYeBEzJ3QR7ATQA1cITrOjvwVUD6HeRAMB0vMKj8y5RZimKJ6oTvCD5lgzHdrm5rxqH9 CJMO4s03UD1T1KZp9p4gPI+9xh4gSvez0b1hsHtnZVZnI3YQvA3AoFrTISvrRjbKUuG2PV1sHZt zAF1BiEtSh/mmFNngI3IA/C6xckAkYkEsqyIMy+uhbyUr/uCg+Eg7VZ5d/ur7JJrsmFmqh/1xaf dSP8MQ9sHsw8sx5GqRLkWcvKZD+4+7uOeSwqX/xdM9yQRNMxh9SZX7RCZmVaJL2z X-Received: by 2002:a05:620a:454d:b0:891:9f29:2902 with SMTP id af79cd13be357-8ab9a534c84mr1751654085a.48.1762204007176; Mon, 03 Nov 2025 13:06:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsT3kTmbkomL6GJC6W50nxcfokuqQHdz3hirQg4McVj4hMF4v65QHG+BLvOv7uKvpvvnkSIA== X-Received: by 2002:a05:620a:454d:b0:891:9f29:2902 with SMTP id af79cd13be357-8ab9a534c84mr1751649185a.48.1762204006599; Mon, 03 Nov 2025 13:06:46 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Markus Armbruster Subject: [PULL 13/36] migration/qmp: Update "resume" flag doc in "migrate" command Date: Mon, 3 Nov 2025 16:06:02 -0500 Message-ID: <20251103210625.3689448-14-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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, 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: 1762204311292158500 Content-Type: text/plain; charset="utf-8" It wasn't obvious how the resume flag should be used when staring at the QAPI doc. Enrich it to be crystal clear. Reported-by: Markus Armbruster Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251022190425.2730441-1-peterx@redhat.com [peterx: amended wordings, per markus] Signed-off-by: Peter Xu --- qapi/migration.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index be0f3fcc12..c7a6737cc1 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1732,7 +1732,10 @@ # @detach: this argument exists only for compatibility reasons and is # ignored by QEMU # -# @resume: resume one paused migration, default "off". (since 3.0) +# @resume: when set, use the new uri/channels specified to resume paused +# postcopy migration. This flag should only be used if the previous +# postcopy migration was interrupted. The command will fail unless +# migration is in "postcopy-paused" state. (default: false, since 3.0) # # Features: # --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204502; cv=none; d=zohomail.com; s=zohoarc; b=PR3lDKDs2MWwGtwONlMWmxHZuIkpZcbsMDwIDoFNkUCBn/P/fvTTSQZLaJG86gUu4rAaWu+n/fi66WeNsWVsiy6OrMapAW3na5mOJE5ByrB5r/A8Tq4Ppg7XjAvpM+NkP5vBQyw9WIVJD3qG9lgoI1NyQDzNrpvsycxaOte7EY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204502; 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=wdnH+0u+VOkpdCmJkp69LW5DtXy26by2TmG5kvQNIqo=; b=QTiHMSI8LZB6J+5pGbicf41AkwwZtav9cRDDZsEr5+MjGUfcgyxBEiRR3F4dzbcqJ8FxKctDv15P4i0W/6mrRa8KDuOnVp6OX+s5AYba8g0WrrIEHoVV6zTJlZBOYN0kn5RN0fIuZwc9rDRzG8ZgoVv/qHmBceXw0wcnh4A+Egc= 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 1762204502303393.9855590162334; Mon, 3 Nov 2025 13:15:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lh-00012D-8k; Mon, 03 Nov 2025 16:07: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 1vG1ld-00010n-O0 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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 1vG1lO-0005Jc-Rj for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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-106-CSlIgo-JOXK8ZuXJgj6KJA-1; Mon, 03 Nov 2025 16:06:49 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-89f7a8b9775so1407352785a.1 for ; Mon, 03 Nov 2025 13:06:49 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204011; 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=wdnH+0u+VOkpdCmJkp69LW5DtXy26by2TmG5kvQNIqo=; b=Qk+lPBW51zl+mcaFWT5IpX27M5eU6R5lxpDIiI40hhBqrhcLWX1l1TAhyQgo0IQwW1uJ6b oPskZF49TCTIBxkPeGFr8kYSNyINcy6QCSSEWBdMLckApl3Mv7PZGJyALK0KQyTRpr6ac5 YIJNv1uUw2BRLb55tB48+d6bwBWumrg= X-MC-Unique: CSlIgo-JOXK8ZuXJgj6KJA-1 X-Mimecast-MFC-AGG-ID: CSlIgo-JOXK8ZuXJgj6KJA_1762204009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204009; x=1762808809; 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=wdnH+0u+VOkpdCmJkp69LW5DtXy26by2TmG5kvQNIqo=; b=O3I+Gy6g7zLJnXGNeGE1uhS1msAyzpvtL8IeaNPURsEczIzPLdN0yxI0cKOalk2W7C VVWaGNH2miZSFH+N/p0+VmFEYAjIZa87e6IQVstG7nFHnsnG6/rXPwMuDg3M8fIf10Y1 qcUsaOVbNpQGGlO5F/ebKdcolx/e0MIm1QaXmktebj+8EUdd5yA87QtXfziE2GVKQr9q ZdUZZqOoIplYgprBdAH8vRiZ/vAmPKONV2v4frvJZsA2md4XMBhq3DlIhffNTt6GF3SC X1jp0uQ4Ub9HWXcMFfizGiE/HxKI/cTIhHKU+4bLnKIGiUswVBeK8JKthYBrtSzaF4OB RKhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204009; x=1762808809; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wdnH+0u+VOkpdCmJkp69LW5DtXy26by2TmG5kvQNIqo=; b=FCZTjl6DZvrPRR7TqAuwAgKIUfwZN7rCKMco+8J15kUbw1I0SqQu1Ls0HIyCQoqNlp 3zSfi1kFsKU0bwrwBlFu4U65dJQYo43xpIeqNA3h5qisTRRRhDcY8WmI8Zk/97ECZFgC mzKe8xKmGeaZpCvXuNX6Ct3L7FtqXKgnv13aZyIdEuj/I24YtF3wsIL3EcpPRNGWKDCM pt7myx0RmeTOQbupC8PuFUkKW9ZvY/nHopMBHIzW7KfPFWD8vd4OQSQvIE55Mg922SuX +x2l2nlWRBkeJaqeDMi1GcRnr+KXaj3pzPtb2vSzIkBks2+9b92iTQRgBsNjtTSsY5if sNrA== X-Gm-Message-State: AOJu0YxiYnA0VaycuAxANcp84+PTK8ymCoyPPUmC7aAWevwkQsPLpHo/ gdFET0ofVEgO8y3mk5vOKOzQ5GjpXzbCs6MpeWI9apOwZ9U7507XqZN0tHyd6S+R1E1lZk6+Lu6 AGBE05uPa7B19a6ZokkMvfy8PwH62sEgt590WRQ35a67gBVms+Gv4WMCE9y7mBXG08EhMYHEq2T dz9JAt4Ec6FX6TdQsjyxXD5Cnbs8PASY9qL6qxuQ== X-Gm-Gg: ASbGnct7xXtpEnXGT1CV2goDDTrARGxws6HsCYEmRa1KZ6k9WL9YuFgwmrISIjS4fKa DVxh9Sj8NyN3HUTGAhQ+UpFaWGigPFl4jw0ZQeDISyZeCt1bJXR1mxOFVeqXOTV2d8af05n4VEE 5ZQ5b/jZ+5tnBQgshbNjC0/n7FTRH0CZaCR0hWJ78zmZlNIb0rtoS5AaYh6eeEbu6MjIarqe7tc fDjGH4fdGskC6RUYFA82G+ytrz8AmlK/lu9R9wnDVQEk7KfCfo2HrbP8B2TD6JtGfpuoyEUeLDd 2mTXbBYIvHiTDQ3cc0urVFbLfs7nYhMd4jB8UQUXGr/iu/N2DZ64DJPMWlsukewz X-Received: by 2002:a05:620a:19a1:b0:8a4:4156:16e with SMTP id af79cd13be357-8ab98eb5107mr1706570785a.20.1762204008777; Mon, 03 Nov 2025 13:06:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzbrhWMdqMM8AavhOkeM3h2dnzUKJp4HuGM6ceihOq2qFSFt8epdtML9/HoSb+Q2D0583Elg== X-Received: by 2002:a05:620a:19a1:b0:8a4:4156:16e with SMTP id af79cd13be357-8ab98eb5107mr1706564485a.20.1762204008197; Mon, 03 Nov 2025 13:06:48 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , "Dr. David Alan Gilbert" , Peter Maydell Subject: [PULL 14/36] migration/cpr: Document obscure usage of g_autofree when parse str Date: Mon, 3 Nov 2025 16:06:03 -0500 Message-ID: <20251103210625.3689448-15-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 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: 1762204502670158500 Content-Type: text/plain; charset="utf-8" HMP parsing of cpr_exec_command contains an obscure usage of g_autofree. Provide a document for it to be clear that it's intentional, rather than memory leaked. Cc: Dr. David Alan Gilbert Reported-by: Peter Maydell Reviewed-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20251023161657.2821652-1-peterx@redhat.com Signed-off-by: Peter Xu --- migration/migration-hmp-cmds.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 847d18faaa..79426bf5d7 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -734,6 +734,12 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) visit_type_bool(v, param, &p->direct_io, &err); break; case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: { + /* + * NOTE: g_autofree will only auto g_free() the strv array when + * needed, it will not free the strings within the array. It's + * intentional: when strv is set, the ownership of the strings will + * always be passed to p->cpr_exec_command via QAPI_LIST_APPEND(). + */ g_autofree char **strv =3D NULL; g_autoptr(GError) gerr =3D NULL; strList **tail =3D &p->cpr_exec_command; --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204197; cv=none; d=zohomail.com; s=zohoarc; b=DhP/CReKJXrUMr5TeV7iec+2SGcz+TEgYy7+jXKn/X+XY7rdoAXxLIKuKQ3ACoJcwSK8zbDgJkee3KZ/cOwROc7mPRo3V9c3bToPSgdCBhr4/6qH///su3hQS2jHWw6HZl8lrAfzWiac1fkDXCFioBZ8rS8Izi/vHU0i+9XQ9Q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204197; 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=mMnNyaDw8H4jjvpH2pgcjNifIuVybefC2pc8R54zGE8=; b=VjQJBsABv9qf+eeTJ6vMt3B8WfOerwTOTGmIu6TnSgYoLs4OZtCE2ujkXRwgC4KXDk/T7JgA/DsmllSCxaM9WPmU11X8MAieDYPfliW7HYxH66gL/AwIIF3NZRI0EQuQOmWmczlH5SjLad5NBe/sZUpWVjRn5u2sfrquXwLt8GU= 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 1762204197205797.0300998822834; Mon, 3 Nov 2025 13:09:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lf-00011b-GA; Mon, 03 Nov 2025 16:07: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 1vG1lc-00010d-OI for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:08 -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 1vG1lR-0005K5-Ls for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:08 -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-29-qMDd5HXuN9GaQH43FkGRpw-1; Mon, 03 Nov 2025 16:06:51 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8a65ae81245so1487498485a.3 for ; Mon, 03 Nov 2025 13:06:51 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204012; 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=mMnNyaDw8H4jjvpH2pgcjNifIuVybefC2pc8R54zGE8=; b=b8YUbqfnCp2ruyY6Qmkk/maoT97rMGbI/UWT2m+8kIv1iKV6mYBWFmPq5TjLjcPxQ4ZQ6h vw0TPJJLpJHX4HTK6UtjAvuhPZdwvKC25Z2RYtIFbq87NFQ5g1pCOwrtkfHYeltTGymSk4 e9AgVgpxryPkWC8+/rjzBqMRcHOH6Xs= X-MC-Unique: qMDd5HXuN9GaQH43FkGRpw-1 X-Mimecast-MFC-AGG-ID: qMDd5HXuN9GaQH43FkGRpw_1762204011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204010; x=1762808810; 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=mMnNyaDw8H4jjvpH2pgcjNifIuVybefC2pc8R54zGE8=; b=cTT0fpRaL09SBpBNbesrSSYdOaJJBNsL1DsI8wPqtn0gvFecq++rei9F+Yl/t33IfA cwkIKRO2lLu7BnwTpj88Q/ByQxKoTbJ0kasEXSc5S43IA5fg8AR9/gTFGRw7Gex5+umc WL0uII/wNPY5/qCpJ+J4OMmplWB1pyriOC0S1XksN6DqS78ZhYg3YsFYFoIGGK1ro/GA Mvyc2WU7ADS0kvGCyHOpSAZUHrtdctyBAPGy9xP+Rd9EckPemQOI3a6vVWBt09E9D5F/ fuXxtg645PK3BsHX/BhC92Jfj8RGlyBfqJS9hQpZNIrayBDtHTJcN88Q5KJAdMUrVuZg BhuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204010; x=1762808810; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mMnNyaDw8H4jjvpH2pgcjNifIuVybefC2pc8R54zGE8=; b=ToGeeii+ARTnBJjISZmEIscPKn738iFqARGiCXeRKKQ86T7to4ZMwmbkvwr6Jdy7QP DdwHFK+oVqslppiNGa29aOrlMKAZBGJSeiObkmYoZr7JetjZmuVGHVBwnqfpBOHTZ8Wz iN4ISd4F3QUa02oHnTrcLoEX2MRMNTa7bKr8WFJZyxYZ0OUguaio1kmsngSLTIdphHDJ uFRMoHOizSuOGzM1A1kgnZmmqRN8P8If8CdQrBrAORAIxN+pjnyypF3cyrzRlpV4iqn6 tzDFYLJRzFRvpmas8haSg3esZTIQMrEXA85aFRjLrbYIW/xC8jj/bsaRG4Gqp/ZnWrwb D9yg== X-Gm-Message-State: AOJu0YxWCjOVxnyKsamYt9K3UlknayVv0AWpmhINIrs8QiL4l2/0Lr1B CzvqwAV/Z7jq/ILZ7WdSK0MrfBUlB02v6tfXKeRR6BGe7PMEAtbA4XOuTukXCofUpb8WzuwgslW FIHwg94y4s/VnyCs9x0+qTZ9B+OxK9C8aRmlzOaguV+QT04aqW1N62tsRUqgWhTS33pbSOrSTc/ ZHs6vDroTmbLXXZ3dYQZLFTRMDBQo2SWMIdAqCmQ== X-Gm-Gg: ASbGncuBYLiI+KeCxsouZwVe/BpNbGi2q8Vuwq9WTfhwi0UpHM2XHblHrjbP1ziT8Kr FMH500L488041A6P323DwoqThGp0i2h3ENZUbkPQKUlgQCwGE7Wk7G5JMiQC5maDqgFryb5yr5P OTzdTEjJcFPrMAFMY26+uoBoFjBZUPhI5BPA4no1Tt18XCFzsLvJ954EWp7g5pthXcxxO6Se9/z LA0bfVcfr2JVai557CqQulSE79uVrAEpjwOP9o/JuRc3H4+J+leFmluYlBvBVqAF2NKuak7XNZV jDrOq9SWEw+YbkL3KX6CuHbZn+yib0Cjc3MxqvLx5fLv1JkhlaIT80/pTRr7BQRN X-Received: by 2002:a05:620a:3724:b0:8a2:db64:2f13 with SMTP id af79cd13be357-8ab9afd2fcdmr1723628785a.55.1762204010500; Mon, 03 Nov 2025 13:06:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4FVW6RmePVO3C5tM6InWV0y++MuBOKCQ+vy5A3bBe6vz2AWjfnLcS9mHcPd9Vju8nmW1ruw== X-Received: by 2002:a05:620a:3724:b0:8a2:db64:2f13 with SMTP id af79cd13be357-8ab9afd2fcdmr1723623085a.55.1762204009936; Mon, 03 Nov 2025 13:06:49 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Xiaoyao Li , Stefano Garzarella , qemu-stable Subject: [PULL 15/36] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Date: Mon, 3 Nov 2025 16:06:04 -0500 Message-ID: <20251103210625.3689448-16-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204199218154101 Content-Type: text/plain; charset="utf-8" From: Xiaoyao Li shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory. Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to allow shm memory backend serve as shared memory for coco-VMs. Cc: Stefano Garzarella Cc: qemu-stable Signed-off-by: Xiaoyao Li Acked-by: David Hildenbrand Acked-by: Stefano Garzarella Link: https://lore.kernel.org/r/20250721065220.895606-1-xiaoyao.li@intel.com Signed-off-by: Peter Xu --- backends/hostmem-shm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c index f66211a2ec..806e2670e0 100644 --- a/backends/hostmem-shm.c +++ b/backends/hostmem-shm.c @@ -54,6 +54,7 @@ have_fd: /* Let's do the same as memory-backend-ram,share=3Don would do. */ ram_flags =3D RAM_SHARED; ram_flags |=3D backend->reserve ? 0 : RAM_NORESERVE; + ram_flags |=3D backend->guest_memfd ? RAM_GUEST_MEMFD : 0; =20 return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), backend_name, backend->size, --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204159; cv=none; d=zohomail.com; s=zohoarc; b=PHqGCKj/WWDMbr64bEgk4a1wA43cZtPol65aBiT2xZxP1kYUwc5lseNX9wdcVGYRNpmiBSpyYfIvZ2TYQihPWdMWSsVVaA0saQeVQ1dZusw+fnVhWOlieiMfIB8/v6E3ZWGA0bCTgZk7fLMLe5m8BlAMuDyEbq6ZJ6tx1fyy/YE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204159; 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=Sj+0pxI4lX/qhV1OXSMqDypY0kD1YjJGi5U/LX9aV1k=; b=nklNBb1CObTaGPZfVnRRxSovoKdw5ZM8bjnrX5m1olH0HmmB4/BbeR+8U3sl5cTf96TykEAnRYG7c2QbN+06DsZ9ivTx2Z788cZQBtnYKWT6tO0Scgk9RxLYqaC2GlnbCtqNLJXNN0tUK+v+Yf51JgpEQSAic6H2VTpG2kyLCwY= 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 1762204159259248.67352140267076; Mon, 3 Nov 2025 13:09:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1la-000104-Vg; Mon, 03 Nov 2025 16:07:07 -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 1vG1lY-0000zV-OG for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:04 -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 1vG1lR-0005Kl-66 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:04 -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-171-OrjJIMkNMXm8gUAt4vi5KA-1; Mon, 03 Nov 2025 16:06:53 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-89fcdd9f931so557702385a.1 for ; Mon, 03 Nov 2025 13:06:53 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204014; 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=Sj+0pxI4lX/qhV1OXSMqDypY0kD1YjJGi5U/LX9aV1k=; b=boBZXOR0322DlNOROylGQ6ANZHsjNrHqj0x6P+4QpuhKKi51xhEMuVHXrT3jpokrPZPJMJ gh0/YwbY6Vv+ULC5k+SrBNgRPllWvWJNhHs4o7cjCEbSUu/jbw9Uj13XdD/PxN8kwvJH9B XXzPZoBB3BE16HFLQvG7xirh6alKv30= X-MC-Unique: OrjJIMkNMXm8gUAt4vi5KA-1 X-Mimecast-MFC-AGG-ID: OrjJIMkNMXm8gUAt4vi5KA_1762204013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204012; x=1762808812; 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=Sj+0pxI4lX/qhV1OXSMqDypY0kD1YjJGi5U/LX9aV1k=; b=CG6H96OQzGe8Gfh+8aW9QN+nGql68qpOd8uzNehknBAv9Hg2/vjpaXPayK7LsLP/6w id/eIdqBJ5vvvpIKoR+Zw4FoWAQnORKn+WFLEnoygGiooxN1QNiXHbDUpRbU0Ne/2UWh qams3NyeBvzbVmJuvRMl8wZNWxsZbmvHtK1Z04oCZods76+co9wbwL14gKvNi5JoO0PA NLiECrjsddf69IbDD7AQgn7Viuwfa/kkOzOuJljJOJjOseeNdrnzTvB6q7M7SNmIkkpr ZMPRGcuEV2G7mp2iv6/aErMyUWn6IB+n7LUvwM8V8BwJwKws1j5Nn+BmnZL0aODIloSR jg3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204012; x=1762808812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sj+0pxI4lX/qhV1OXSMqDypY0kD1YjJGi5U/LX9aV1k=; b=sDjNIobIeofKsPt6OEt+jdckSyYNxEheUu2wKQ540zKEtGxKvGKOXGdYfHjTfiLNNk thoaLiDzfb/0/KbEzi3OoqyUUVXRp+aR5alR0dYYFiJKu+HZrpbUX79N+jy4iOkIYewg 1jy/0jgSoEjai1i++07LGL9x9Pa089Vtc5l+jTYhbYqDm1vuC6osVNpYRsNhW5WyU6gn 5TpySliEloGFqfIrfaaD9Xrskm9DX2J1OQ62eGVRUFgyNjELOhxMxkVMhLC3mrJlNDsN GoTba8VhL0vggS/r6ss0/3LRoZBI+G+tIPRwt3E9oRrjxXftFOkJ9bUyx8XmwnJcTITd yIqA== X-Gm-Message-State: AOJu0YwZm3NCm4T2x+iuvHCYVbXQskCyyybXa8tgC4mq9TAeI1T+JFnQ HqAC6mdHPuXgZh5l1+7L/y6UrwfugOib7NLBBN8zYT7j2NUIEP8tl/dobs6yUfs1f6OKSiLIkl4 0ls7loQs9LsltvJw59PjjXKE1axGN8Xw8/6AI9iaiv5is0lkeECVbKJokCJriZvtnOW9XOHurDe CSIToMxGRvZd7HUWapXe2IUrt3gtBLJWv8QiQVoQ== X-Gm-Gg: ASbGncsP8r7yko9i4q0pAQGFQBkMahS4r8V0ETJnI3CG33fl5qMnY0FBB8plNdF6RM8 ed+yLA3f6Pz6Lqb3oGmpI0PXp8vd3AkUNhbnTs+5ysnVeARZ1GilbMA67tU5fhd31jSE6q0PlOL 6fFbwAFe26ZwvPAdFb3IrsL4ycIESYEN0/8rC6hwVGqe8Pq96bpf9mkOS6iPVaKjfH7qGJ9yFfy aLjxfe+2gVQ3QzPPMJkgHrJpyxyc1n4AlPmf5tSmMrs5gsAEs1Q8BWZw2YEfcb5KhiyE4E4SEL5 OqCYSDZVfEwojpVmwInXoCMyKJOrWrjjHwLJ+/xzBjuWGZafH3iHqwGgX0ni6XeC X-Received: by 2002:a05:620a:4507:b0:890:2e24:a543 with SMTP id af79cd13be357-8ab99a6f2bfmr1787408985a.34.1762204012221; Mon, 03 Nov 2025 13:06:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOx5yJ2YmfNZuMuRCgZWHBwG/GZANG0P5yBZzUGv/9e6w2lRh2A45usAsHoHSKDRoooI7wJA== X-Received: by 2002:a05:620a:4507:b0:890:2e24:a543 with SMTP id af79cd13be357-8ab99a6f2bfmr1787402385a.34.1762204011558; Mon, 03 Nov 2025 13:06:51 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Arun Menon , Cornelia Huck , Akihiko Odaki Subject: [PULL 16/36] migration: Fix regression of passing error_fatal into vmstate_load_state() Date: Mon, 3 Nov 2025 16:06:05 -0500 Message-ID: <20251103210625.3689448-17-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204161313154100 Content-Type: text/plain; charset="utf-8" From: Arun Menon error_fatal is passed to vmstate_load_state() and vmstate_save_state() functions. This was introduced in commit c632ffbd74. This would exit(1) on error, and therefore does not allow to propagate the error back to the caller. To maintain consistency with prior error handling i.e. either propagating the error to the caller or reporting it, we must set the error within a local Error object instead of using error_fatal. Reviewed-by: Cornelia Huck Signed-off-by: Arun Menon Reviewed-by: Akihiko Odaki Link: https://lore.kernel.org/r/20251028-solve_error_fatal_regression-v2-1-= dab24c808a28@redhat.com [peterx: always uninit var ret, per Akihiko] [peterx: touchups on line ordering, spacings etc.] Signed-off-by: Peter Xu --- hw/display/virtio-gpu.c | 21 ++++++++++++++------- hw/pci/pci.c | 15 +++++++++++++-- hw/s390x/virtio-ccw.c | 17 +++++++++++++++-- hw/scsi/spapr_vscsi.c | 10 ++++++++-- hw/virtio/virtio-mmio.c | 15 +++++++++++++-- hw/virtio/virtio-pci.c | 15 +++++++++++++-- hw/virtio/virtio.c | 10 +++++++--- 7 files changed, 83 insertions(+), 20 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 3a555125be..43e88a4daf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1225,7 +1225,8 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque,= size_t size, { VirtIOGPU *g =3D opaque; struct virtio_gpu_simple_resource *res; - int i; + Error *err =3D NULL; + int i, ret; =20 /* in 2d mode we should never find unprocessed commands here */ assert(QTAILQ_EMPTY(&g->cmdq)); @@ -1248,8 +1249,12 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque= , size_t size, } qemu_put_be32(f, 0); /* end of list */ =20 - return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL, - &error_fatal); + ret =3D vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL, + &err); + if (ret < 0) { + error_report_err(err); + } + return ret; } =20 static bool virtio_gpu_load_restore_mapping(VirtIOGPU *g, @@ -1288,7 +1293,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, Error *err =3D NULL; struct virtio_gpu_simple_resource *res; uint32_t resource_id, pformat; - int i; + int i, ret; =20 g->hostmem =3D 0; =20 @@ -1348,9 +1353,11 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque= , size_t size, } =20 /* load & apply scanout state */ - vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1, &error_fatal= ); - - return 0; + ret =3D vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1, &err= ); + if (ret < 0) { + error_report_err(err); + } + return ret; } =20 static int virtio_gpu_blob_save(QEMUFile *f, void *opaque, size_t size, diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 738b0c41ae..b1eba348e0 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -921,21 +921,32 @@ const VMStateDescription vmstate_pci_device =3D { =20 void pci_device_save(PCIDevice *s, QEMUFile *f) { + Error *local_err =3D NULL; + int ret; + /* Clear interrupt status bit: it is implicit * in irq_state which we are saving. * This makes us compatible with old devices * which never set or clear this bit. */ s->config[PCI_STATUS] &=3D ~PCI_STATUS_INTERRUPT; - vmstate_save_state(f, &vmstate_pci_device, s, NULL, &error_fatal); + ret =3D vmstate_save_state(f, &vmstate_pci_device, s, NULL, &local_err= ); + if (ret < 0) { + error_report_err(local_err); + } /* Restore the interrupt status bit. */ pci_update_irq_status(s); } =20 int pci_device_load(PCIDevice *s, QEMUFile *f) { + Error *local_err =3D NULL; int ret; + ret =3D vmstate_load_state(f, &vmstate_pci_device, s, s->version_id, - &error_fatal); + &local_err); + if (ret < 0) { + error_report_err(local_err); + } /* Restore the interrupt status bit. */ pci_update_irq_status(s); return ret; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 4cb1ced001..4a3ffb84f8 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1130,13 +1130,26 @@ static int virtio_ccw_load_queue(DeviceState *d, in= t n, QEMUFile *f) static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); - vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL, &error_fatal= ); + Error *local_err =3D NULL; + int ret; + + ret =3D vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL, &loc= al_err); + if (ret < 0) { + error_report_err(local_err); + } } =20 static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); - return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, &error_f= atal); + Error *local_err =3D NULL; + int ret; + + ret =3D vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, &local_= err); + if (ret < 0) { + error_report_err(local_err); + } + return ret; } =20 static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index f0a7dd2b88..a6591319db 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -628,10 +628,16 @@ static const VMStateDescription vmstate_spapr_vscsi_r= eq =3D { static void vscsi_save_request(QEMUFile *f, SCSIRequest *sreq) { vscsi_req *req =3D sreq->hba_private; - assert(req->active); + Error *local_err =3D NULL; + int rc; =20 - vmstate_save_state(f, &vmstate_spapr_vscsi_req, req, NULL, &error_fata= l); + assert(req->active); =20 + rc =3D vmstate_save_state(f, &vmstate_spapr_vscsi_req, req, NULL, &loc= al_err); + if (rc < 0) { + error_report_err(local_err); + return; + } trace_spapr_vscsi_save_request(req->qtag, req->cur_desc_num, req->cur_desc_offset); } diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index fb58c36452..c05c00bcd4 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -612,15 +612,26 @@ static const VMStateDescription vmstate_virtio_mmio = =3D { static void virtio_mmio_save_extra_state(DeviceState *opaque, QEMUFile *f) { VirtIOMMIOProxy *proxy =3D VIRTIO_MMIO(opaque); + Error *local_err =3D NULL; + int ret; =20 - vmstate_save_state(f, &vmstate_virtio_mmio, proxy, NULL, &error_fatal); + ret =3D vmstate_save_state(f, &vmstate_virtio_mmio, proxy, NULL, &loca= l_err); + if (ret < 0) { + error_report_err(local_err); + } } =20 static int virtio_mmio_load_extra_state(DeviceState *opaque, QEMUFile *f) { VirtIOMMIOProxy *proxy =3D VIRTIO_MMIO(opaque); + Error *local_err =3D NULL; + int ret; =20 - return vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1, &error_fa= tal); + ret =3D vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1, &local_e= rr); + if (ret < 0) { + error_report_err(local_err); + } + return ret; } =20 static bool virtio_mmio_has_extra_state(DeviceState *opaque) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 937e22f08a..99cb30fe59 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -187,15 +187,26 @@ static bool virtio_pci_has_extra_state(DeviceState *d) static void virtio_pci_save_extra_state(DeviceState *d, QEMUFile *f) { VirtIOPCIProxy *proxy =3D to_virtio_pci_proxy(d); + Error *local_err =3D NULL; + int ret; =20 - vmstate_save_state(f, &vmstate_virtio_pci, proxy, NULL, &error_fatal); + ret =3D vmstate_save_state(f, &vmstate_virtio_pci, proxy, NULL, &local= _err); + if (ret < 0) { + error_report_err(local_err); + } } =20 static int virtio_pci_load_extra_state(DeviceState *d, QEMUFile *f) { VirtIOPCIProxy *proxy =3D to_virtio_pci_proxy(d); + Error *local_err =3D NULL; + int ret; =20 - return vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1, &error_fat= al); + ret =3D vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1, &local_er= r); + if (ret < 0) { + error_report_err(local_err); + } + return ret; } =20 static void virtio_pci_save_queue(DeviceState *d, int n, QEMUFile *f) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 153ee0a0cf..257cda506a 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3030,7 +3030,7 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(vdev); uint32_t guest_features_lo =3D (vdev->guest_features & 0xffffffff); - int i; + int i, ret; Error *local_err =3D NULL; =20 if (k->save_config) { @@ -3075,7 +3075,7 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) } =20 if (vdc->vmsd) { - int ret =3D vmstate_save_state(f, vdc->vmsd, vdev, NULL, &local_er= r); + ret =3D vmstate_save_state(f, vdc->vmsd, vdev, NULL, &local_err); if (ret) { error_report_err(local_err); return ret; @@ -3083,7 +3083,11 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f) } =20 /* Subsections */ - return vmstate_save_state(f, &vmstate_virtio, vdev, NULL, &error_fatal= ); + ret =3D vmstate_save_state(f, &vmstate_virtio, vdev, NULL, &local_err); + if (ret < 0) { + error_report_err(local_err); + } + return ret; } =20 /* A wrapper for use as a VMState .put function */ --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204167; cv=none; d=zohomail.com; s=zohoarc; b=H1C6Ok4BxEbOr/pftBD60hdERHSYlOJ+5vojS2FF4uLjJl6wU0t70LkjBaWy0fue289bYMIhR+/QjLWzholGoI9Owu5jDiQzzxT//5lwr2vZDol4geeNJFZ335N4KZVvO3AFxyLEdZb2vsR+sU/jP2la/7whIOLzwR7wB+B86hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204167; 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=pyG0wI0bDY1vvGlQuW62v1fRhYJS5Ll4JtOuqJX+Vkk=; b=j2+bweEqQIQIJ5Bo9oNMaR6c0DUhncRNNU3lVq7TCX/RTYNQPNrup9iK9lgPMG+9Rwb14OcuOT6XtiWBXYKZ+plXWAF8yxp29PNPe7GOXoi4sHBnPykfggfAeouUF2j9FwyMvsdo/I93eMFmXrilFTNC16TmwFOILMoOTpmPMu4= 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 1762204167129333.9207231870515; Mon, 3 Nov 2025 13:09:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lc-00010a-HL; Mon, 03 Nov 2025 16:07:08 -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 1vG1lZ-0000zl-Fb for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:06 -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 1vG1lT-0005LV-HT for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:05 -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-75-hrhdRvgWP3WPuCZeHCBc1Q-1; Mon, 03 Nov 2025 16:06:54 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-89eb8ee2a79so2526684485a.2 for ; Mon, 03 Nov 2025 13:06:54 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204016; 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=pyG0wI0bDY1vvGlQuW62v1fRhYJS5Ll4JtOuqJX+Vkk=; b=D2ZAsZjmoYGQgXUrWsHvZ1BL8m0N/xTCZkwrSaBZynxKqKccuz0hVuzHEhpCB25KIMh5UF oN/6+8UngLGNRd1A7apyIkMYTp9dQ5+V5gKxCTn095krE+PVte0S3K4O/8mym2GLDn85dv uBLz9FMB44Hbrp0YuOruq4A4xDzFgHY= X-MC-Unique: hrhdRvgWP3WPuCZeHCBc1Q-1 X-Mimecast-MFC-AGG-ID: hrhdRvgWP3WPuCZeHCBc1Q_1762204014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204013; x=1762808813; 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=pyG0wI0bDY1vvGlQuW62v1fRhYJS5Ll4JtOuqJX+Vkk=; b=ATPj/8y/zPVMmyHqSFoBh98IyO0p0a2ofBClaW8Ed5FrU+eUphcTq7nU5v5bmnjVD6 hxFk1nQWhE5wsuWdKP+iuu2+tMU2oplHxmCKQ4JXcSarsQAZBB/Z9W1eJBpv0wAStZuW Ebw2z8W1uzNIHACBwBem6kfTXA0JuGGS5WeS2PE8/eSAKlPkNYl52mIsYDDntZi4Lslk 7u++mf0za17s3Ej1NaRtagezPYi55NPb/d4CByZGnYon7Rj0vBlMxvDNeH8Y14hCp9+7 rVtV3F3Tedk17sv/kqQUAcn/rHux4LYtybv/+KE81qQXLJh0gILekgJzsEC13z3QDn4U TAMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204013; x=1762808813; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pyG0wI0bDY1vvGlQuW62v1fRhYJS5Ll4JtOuqJX+Vkk=; b=kqvE/3XWTnl9GeyVPho3pq/1X/3s9OVoQErJzB75MEVRC8JoVDs99nTwlLGufo0V5q OPkr4VioKggXdXwd6OteUixoKrnjDpgjxq+1vJHZHp4XeKSAO1Z+fEcLfmad0RSlrfen 7+2aPlvXIm/BpOkIjJI+pLlbj5J6HF+COKSV+F0811Muas7OjWXJfi+kulxMMwu191cZ 13tozryBLsB/Jb3sWg99632pw0wj4yp4GmrnJldTni69WCYZIRen/cVn1oHZYFjbZONW sdwofTL5NsxB4ZcodUi1K6rdJQOLWzCbpZuHhWYpl26aZhJ6Sxe69MpGD/l80ifvNiGe CzqA== X-Gm-Message-State: AOJu0YzFvzxqGy1QfPk+h+8ULrB4XObZptIaztK9IE2Zpd/8YUXD5iT+ U+2QLtVBLWyzXI3qwJk/Gina9y/cqN9NcMLJ8vDeb6GuCj4xLqM7MMVuxqMj/2Z6NGh5qDTfSHY WutcGN+sYxBkh6ySyPJYtZtm3XuLv3vIAXkYCTx/GQAX2RjE8YBdojKMfWcKj2UEXY+FX9xHiHv lFylPF3Hx0LGVBjAyuT3bngR2uAhpaxRVrZNAAuw== X-Gm-Gg: ASbGncsY4p8byrAhQiNshZTJysm/BNH5UbPSzdXeWl+u66PLgFQib6TUd7zhv5HgKEN s2YhszylrOPklAuIEO5X+CpIgRsh28qpd3VlNVovDCDE77LL0fa5/F70ejuWfzs7Zo2vzdVvOpe X7HQqhNlmCm508gskv+eFvI4jjizXqFslJpn80cAyXatxllqM8E7LDQWENJ6nP0YBjp10BnUi8Y 0lj2hKWPyOLbf0Wnww/TMPIDYrI5inpKdLLHoM1tX+IqQQ09dFVOhQvKcKzpWkDRJ0HOPhLcXuX hcVT2ySvvy3dd9zAXaHVXiLWUVExYYtL2nEZOg/u2AsD/UjYf8NNxsNF35de1G73 X-Received: by 2002:a05:620a:46a6:b0:89f:3bd5:cacd with SMTP id af79cd13be357-8ab9b3ac9e6mr1818198585a.74.1762204013372; Mon, 03 Nov 2025 13:06:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEiJMKk2DepZah4I4g36y3jZr18Njsb1TY6CA8K0z01wNoCrtwL4oR7o5IHobS7CDKrECrnw== X-Received: by 2002:a05:620a:46a6:b0:89f:3bd5:cacd with SMTP id af79cd13be357-8ab9b3ac9e6mr1818192485a.74.1762204012840; Mon, 03 Nov 2025 13:06:52 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Bin Guo , Markus Armbruster Subject: [PULL 17/36] migration: Don't free the reason after calling migrate_add_blocker Date: Mon, 3 Nov 2025 16:06:06 -0500 Message-ID: <20251103210625.3689448-18-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204180347158500 Content-Type: text/plain; charset="utf-8" From: Bin Guo Function migrate_add_blocker will free the reason and set it to NULL if failure is returned. Signed-off-by: Bin Guo Reviewed-by: Markus Armbruster Link: https://lore.kernel.org/r/20251024205532.19883-1-guobin@linux.alibaba= .com Signed-off-by: Peter Xu --- hw/intc/arm_gicv3_kvm.c | 1 - target/i386/sev.c | 1 - 2 files changed, 2 deletions(-) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 66b0dddfd4..6f311e37ef 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -841,7 +841,6 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Err= or **errp) error_setg(&kvm_nv_migration_blocker, "Live migration disabled because KVM nested virt is ena= bled"); if (migrate_add_blocker(&kvm_nv_migration_blocker, errp)) { - error_free(kvm_nv_migration_blocker); return; } =20 diff --git a/target/i386/sev.c b/target/i386/sev.c index 1057b8ab2c..fd2dada013 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1661,7 +1661,6 @@ sev_snp_launch_finish(SevCommonState *sev_common) ret =3D migrate_add_blocker(&sev_mig_blocker, &local_err); if (local_err) { error_report_err(local_err); - error_free(sev_mig_blocker); exit(1); } } --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204165; cv=none; d=zohomail.com; s=zohoarc; b=Ph4wOFAAkjQwmYOlidexJE5JAOTxRO9h5CPKmlNGbUt46G/kXyrgOib27316/agqhjvflbq8qtVqVAd5JHs+zecmHGWNJFzoTfzqkTZmU6HhN/UiUSpQ/UhU9v6xIvt0JvRX5DC2i/+OzO40wqG9EqIOXDG3GaEK2n62HvGXwlU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204165; 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=MhjJNzKPxpxd3gxFiz0Oy6+Fp9aW0Nvlu5a+NjuZlkc=; b=RzOQcZbsb/Gh5mUZcjb6jXnMS2gQgeot9GO/WHtfeV0HF2eMj/m9CJj3r0Hso0Mlxfk7ocCqf/AFv5nkjZhSso/h6rBNjs4zbtBwe1Cb8dfVNqY2J2cS4WpqwswDNCGuTBNnD7zvmJB0X/9jJcD1MpkSo+VwSsq3rWBYpoi74MA= 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 1762204165825179.18865800130254; Mon, 3 Nov 2025 13:09:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1le-00010q-2h; Mon, 03 Nov 2025 16:07:10 -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 1vG1lb-00010D-4m for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:07 -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 1vG1lT-0005Lg-Ha for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:06 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-499-atorPHfvOLCRZ0f3TN8CVw-1; Mon, 03 Nov 2025 16:06:56 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4eb7853480dso142637911cf.0 for ; Mon, 03 Nov 2025 13:06:56 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204017; 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=MhjJNzKPxpxd3gxFiz0Oy6+Fp9aW0Nvlu5a+NjuZlkc=; b=WVInKDA3ADSo1EecPNqSzDlMVbDXGKnSMHSwIRmJfpD6pNPMhS3X4sUYwNdKdpKpZBgCLV d3JUwcVRlrw0i8zkcJwOBr6QZaczgfvpXGIhJSKOj64p48GzCcKY5qzsRRXJHNlD0bgW3Y mo29aef2lFq3cwguyYdGg1BFBQ/i8Ao= X-MC-Unique: atorPHfvOLCRZ0f3TN8CVw-1 X-Mimecast-MFC-AGG-ID: atorPHfvOLCRZ0f3TN8CVw_1762204015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204015; x=1762808815; 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=MhjJNzKPxpxd3gxFiz0Oy6+Fp9aW0Nvlu5a+NjuZlkc=; b=qwJzE9u2RyjX7M4yeFgqGu2TXoTOPMQPI+rXhpn8/cK6nto8sC7vZV1qkAEYHrX5JN sOsKzf2Z79CUgipAJyL4vqLmAMHtrOH3OqnYeUSRXPeLIjd14r12uaMIlgmk81OWVEKx beZT63yNq4JRXnA1B1zA80NovujIwdASmgZ6lAAolPq3paRLDwY3+Iew5cR6DAUtkA76 FL8cdRvFNjs1wY/+2wP4Fnefaa2AjZts6nd5vd8msbfrcb0cFK1l5l45boRUG8V6iqDR q6zqHxx1j1VUZ1e1gmQuBA+esOZFLwO7+ULIC8o3OueOoi4+3UiENlZpZD/hEfbz0jJE VWWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204015; x=1762808815; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MhjJNzKPxpxd3gxFiz0Oy6+Fp9aW0Nvlu5a+NjuZlkc=; b=CGJL22aO0O2ySzCK5lDEkwAf5O7OES8YF7uvDl03HUwoUrL/RWXORpGAI/sIGv4k2Y qCvdcIHosI30DeKOu6xhiPnbjnX/TSRcqzxGViln72x7l+JUuYuy1E2E4jJdUd6Fx1GH cdIBhNPiIk5CQsjlEjZnvxtlog4ql1CLcDBG4ir89ku4dmENlW+ZncQG1YX5+oFnBLOy f/az9G25Ql7Wb4JlT2BRx5QQfajhdkUui/a7RWsc763LpWTsxbuiyBIqlGnPu2dIHtU0 5NYnBMp7Zu/ZbEZQ6JwvXQVmaYfY49SvgRAvrR6JOlhPMGPpTpXE2q7NkdPEvsTvkCzR YYcw== X-Gm-Message-State: AOJu0Yxp/kTCHQcE/q7Uevvy38Ofud7ISHwBrjHP1SNiIgtEwVTgQaPi kzlf04Okux7Tkw2GNjEjdZ8XmFVYaDF9qv+TuJf4Q+4n8sYhN1SHBW45d7GJDEEjpmSlCjQAqNo eB7eSJRt0hbSbgSaewdTyIA+QGkhgK7S3i/tiMJf2QrJ7Q8/j576imuwxdh/ky+ldpd6PMvECaF r3NJS1r/NQJybfMvt1kAZC7almf/Nc7GkoI/loFA== X-Gm-Gg: ASbGnctEO7vn5ZZ3RdRLBS5xTMh/3ufwQ0vRIpj9iPERoyV35RdZccixI7xyZgiRIFB nklrztwzu/I1QsDcm6527U6QXxV9PdmUbMKmyVUHs7IDJ76KFW9gcZ6F52s9D3Xag+0vLPqAQZY cO8xv9rAMGpIzjfLy+8cNfFbMce7TTn1WtC0U59QzzoPOcvEbj9Kl61eMB6H82t14TED58UyT4L tZpHwRX6PWRgJSvICWzJk3EOsxF4CaHS/ZgmoCdIr+EdipaeZbjm5i0b5qntFQfiKIr73UG5Zmr dSFR1qPOXFDZw4h8wbXdImJmcNpBHSTK0Gv/CoQtaGmo3JBW3N5pAteLeXAxXXCh X-Received: by 2002:a05:622a:4d94:b0:4ec:fc9a:17d3 with SMTP id d75a77b69052e-4ed30d91ad7mr211347961cf.13.1762204015301; Mon, 03 Nov 2025 13:06:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHX3enG7P2mKCzY+QkCJzqE0vvLwqOJhkUb3DEtF0cPyLIkcoVxB+vP1K8J4mxH4xHz6+nCmA== X-Received: by 2002:a05:622a:4d94:b0:4ec:fc9a:17d3 with SMTP id d75a77b69052e-4ed30d91ad7mr211347161cf.13.1762204014687; Mon, 03 Nov 2025 13:06:54 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Markus Armbruster Subject: [PULL 18/36] migration: Use unsigned instead of int for bit set of MigMode Date: Mon, 3 Nov 2025 16:06:07 -0500 Message-ID: <20251103210625.3689448-19-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204166217158500 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster Signed operands in bitwise operations are unwise. I believe they're safe here, but avoiding them is easy, so let's do that. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251027064503.1074255-2-armbru@redhat.com Signed-off-by: Peter Xu --- migration/migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4ed2a2e881..478c76bc25 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1672,9 +1672,9 @@ void migration_cancel(void) } } =20 -static int get_modes(MigMode mode, va_list ap); +static unsigned get_modes(MigMode mode, va_list ap); =20 -static void add_notifiers(NotifierWithReturn *notify, int modes) +static void add_notifiers(NotifierWithReturn *notify, unsigned modes) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { if (modes & BIT(mode)) { @@ -1687,7 +1687,7 @@ static void add_notifiers(NotifierWithReturn *notify,= int modes) void migration_add_notifier_modes(NotifierWithReturn *notify, MigrationNotifyFunc func, MigMode mode, = ...) { - int modes; + unsigned modes; va_list ap; =20 va_start(ap, mode); @@ -1876,7 +1876,7 @@ static bool is_busy(Error **reasonp, Error **errp) return false; } =20 -static bool is_only_migratable(Error **reasonp, Error **errp, int modes) +static bool is_only_migratable(Error **reasonp, Error **errp, unsigned mod= es) { ERRP_GUARD(); =20 @@ -1890,9 +1890,9 @@ static bool is_only_migratable(Error **reasonp, Error= **errp, int modes) return false; } =20 -static int get_modes(MigMode mode, va_list ap) +static unsigned get_modes(MigMode mode, va_list ap) { - int modes =3D 0; + unsigned modes =3D 0; =20 while (mode !=3D -1 && mode !=3D MIG_MODE_ALL) { assert(mode >=3D MIG_MODE_NORMAL && mode < MIG_MODE__MAX); @@ -1905,7 +1905,7 @@ static int get_modes(MigMode mode, va_list ap) return modes; } =20 -static int add_blockers(Error **reasonp, Error **errp, int modes) +static int add_blockers(Error **reasonp, Error **errp, unsigned modes) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { if (modes & BIT(mode)) { @@ -1928,7 +1928,7 @@ int migrate_add_blocker_normal(Error **reasonp, Error= **errp) =20 int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...) { - int modes; + unsigned modes; va_list ap; =20 va_start(ap, mode); @@ -1945,7 +1945,7 @@ int migrate_add_blocker_modes(Error **reasonp, Error = **errp, MigMode mode, ...) =20 int migrate_add_blocker_internal(Error **reasonp, Error **errp) { - int modes =3D BIT(MIG_MODE__MAX) - 1; + unsigned modes =3D BIT(MIG_MODE__MAX) - 1; =20 if (is_busy(reasonp, errp)) { return -EBUSY; --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204524; cv=none; d=zohomail.com; s=zohoarc; b=M6CmslP6MSdxLCeJ+AxuVcDNRWXpUFi8BSGu97iATsdIh4ijYpvIrUVqkA4Gjtv/VjbgbLBndTDgcgOOtoh0I0ABT+2PxLIxfQ662FWmwaHywt9ncAwXR1rb/sE6WaTIZxNUPMVFpVNYUfp0FukF9lseEaFphFpQy547vfTdSxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204524; 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=ZNwsgUgfgeWWiy0ih7qNfqRLsac0y4EvH0bl57XKbX4=; b=XxKLTd3O1nQKP0YV3xI5s7mKC/EQwNyJCeIlCwSM6nWtHrUJy1FpPAIdsea0Qpvehk40oC35s58DicO4QnetYVDBP3s6pLnQXMJ+owEGRehvtlV9lnZFBfglPary2XKKoRVhs4xl9UY4LvK5oZhzAHvIl+2TKWYAh5Bj0D6Z6Yo= 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 1762204524188884.6755958970533; Mon, 3 Nov 2025 13:15:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lq-00013p-Pi; Mon, 03 Nov 2025 16:07:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1ln-000131-0B for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:20 -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 1vG1lW-0005Me-In for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:17 -0500 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-MHSsEQfoN0K0L-5zPVY4kg-1; Mon, 03 Nov 2025 16:06:58 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4e884663b25so141332421cf.0 for ; Mon, 03 Nov 2025 13:06:58 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204019; 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=ZNwsgUgfgeWWiy0ih7qNfqRLsac0y4EvH0bl57XKbX4=; b=b135Rwxla6BC/JMUCSl3adPXkVNb3hEQ07cLD40b2qoU11i3N279QDa1mm4nxHaf7t3egN Ni96+l2yKQBUnFW1mucX8uORSOdC3Rzeec3OBcANHQYXHocbPjzCRAdgHtPpNVUgXfBm7c gap5WOhthQ678XLg81cAgPd72FHDxzY= X-MC-Unique: MHSsEQfoN0K0L-5zPVY4kg-1 X-Mimecast-MFC-AGG-ID: MHSsEQfoN0K0L-5zPVY4kg_1762204018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204017; x=1762808817; 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=ZNwsgUgfgeWWiy0ih7qNfqRLsac0y4EvH0bl57XKbX4=; b=LMoUR/R+9Epd8CmRm9GJKhbRp85DL0yWS2kQZyZN6ljY0NQHy1gkwoV31VJ2bKonzJ Z1Phk1f27a8rgaZtbTRIaAA9m0VVVnK0UXv/9ql1hRKrMsA5oqWUaGcxu4yH2F8zZCxn pwcF0OCXHh/ePaYCj8uPV7FzmwAdzo/A29ow8Yx0v0LkfxZg37JEij7SHMQQEicUFxO7 o7kIhyk+vtTLWLwUyeRUro1EhWxmlCo3ue+qL65TnGkWRoW6nLehjnG5mg/jYK7VY1ua a3w8dxO5kQiRkzChLpSqhjqOIZ17BcwS7ZLP8tGMPS4Wz06sFjPqJRBL+3QjKBpj0KNk IJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204017; x=1762808817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZNwsgUgfgeWWiy0ih7qNfqRLsac0y4EvH0bl57XKbX4=; b=ZkJKgXSOnbTct176FXEoUQ9Ar3mwA+Y0AwZAQVI2kVD6dDQll55spvcoq0iFt5d54D rCuxVXtF87bsl5U947M1W3ZD68K4M95e2GL6vz+Eb+HL9mb7lRyo41kWkqj5h4p0ex8t w2tlpyZwnNglpyO1wm9A2cUXdwri6czkKrA5SrumMy7TNKNEEESmQ98qaWLnSz7h6QMA DdCNNwMg2MfKwictWvbBjs+UHNeRqcVUI6I+Y06Q2bnpNv7R0HvAbDHiFMih3T1w9Ruv U5ElExeoJ2MfYvkjGFfZCMY2LdKN43avR3F9EyeBokYLKhhG31LjouCGVcsveXt4EAv/ nXAg== X-Gm-Message-State: AOJu0YwmbcOuvmnp8o2DKM3H+6MuwAiGoR0WjPEA889Y5KXcJP5z3Hu8 Y1/zbGewokT+zsjCYjsOi8DiYV/KPl2saxTZqUDYgLtbbIzsRe7en6kAdEtj2MdOH7fVOR531Zf w54+Aab3/l9w+veOjSHzgRs0wFMxF72Zs0FouGVu6s2lPNcb1GechAd7zASlFJeYFZPPMOl0nQ+ aT6O12dJj3xH9z/gNtkj7uMt+5VR8tbpx2gmvsRQ== X-Gm-Gg: ASbGncvUwRIH0tqHL9sTny3XISNYWaBN3uJ7D5d759jgfP1Z1D0FEApvwwR78NVxrat IJdhf0R/PgIULdjDIcFQSdeckLbU03fqH2ZDMfxLJBBkLe6gtVapjZesSR74vjjSK03ejNKErx/ ZrC6vWRD1aZbM5YCnYXsnzXH33I7/FfZkHh5W9DPO2tzGoPPCRqDz7R3czHxtTRIljmdqsivv6O hVxHJg0ritqXegg8hNT00godhoYYBLEbg8E35gn0duPerZCcTjntYNboc6/um8W1crpETTph7id +njLjKvZlMCRFJar5wSqVmxNrr5UxM7SMyLnLYWToeU75XUy9cpIwhbFgJK0TbFM X-Received: by 2002:a05:622a:424d:b0:4ec:f023:b589 with SMTP id d75a77b69052e-4ed31055c71mr200949621cf.63.1762204017198; Mon, 03 Nov 2025 13:06:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHk8gSXZS/bdr9fQe7q5is4zbAXxzGPLluwezGWb0n2yFjEaTlkOt8Qq/wnkC41aelikBny9g== X-Received: by 2002:a05:622a:424d:b0:4ec:f023:b589 with SMTP id d75a77b69052e-4ed31055c71mr200948891cf.63.1762204016564; Mon, 03 Nov 2025 13:06:56 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Markus Armbruster Subject: [PULL 19/36] migration: Use bitset of MigMode instead of variable arguments Date: Mon, 3 Nov 2025 16:06:08 -0500 Message-ID: <20251103210625.3689448-20-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204529029158500 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster migrate_add_blocker_modes() and migration_add_notifier_modes use variable arguments for a set of migration modes. The variable arguments get collected into a bitset for processsing. Take a bitset argument instead, it's simpler. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251027064503.1074255-3-armbru@redhat.com Signed-off-by: Peter Xu --- include/migration/blocker.h | 9 +++----- include/migration/misc.h | 10 ++++----- hw/vfio/container-legacy.c | 6 +++--- hw/vfio/cpr-iommufd.c | 6 +++--- hw/vfio/cpr-legacy.c | 8 +++---- hw/vfio/cpr.c | 5 ++--- hw/vfio/device.c | 4 ++-- migration/migration.c | 43 ++++++------------------------------- stubs/migr-blocker.c | 2 +- system/physmem.c | 8 +++---- 10 files changed, 33 insertions(+), 68 deletions(-) diff --git a/include/migration/blocker.h b/include/migration/blocker.h index a687ac0efe..80b75ad5cb 100644 --- a/include/migration/blocker.h +++ b/include/migration/blocker.h @@ -16,8 +16,6 @@ =20 #include "qapi/qapi-types-migration.h" =20 -#define MIG_MODE_ALL MIG_MODE__MAX - /** * @migrate_add_blocker - prevent all modes of migration from proceeding * @@ -82,16 +80,15 @@ int migrate_add_blocker_normal(Error **reasonp, Error *= *errp); * * @reasonp - address of an error to be returned whenever migration is att= empted * - * @errp - [out] The reason (if any) we cannot block migration right now. + * @modes - the migration modes to be blocked, a bit set of MigMode * - * @mode - one or more migration modes to be blocked. The list is termina= ted - * by -1 or MIG_MODE_ALL. For the latter, all modes are blocked. + * @errp - [out] The reason (if any) we cannot block migration right now. * * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. * * *@reasonp is freed and set to NULL if failure is returned. * On success, the caller must not free *@reasonp before the blocker is re= moved. */ -int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...); +int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **err= p); =20 #endif diff --git a/include/migration/misc.h b/include/migration/misc.h index 592b93021e..e26d418a6e 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -90,18 +90,18 @@ void migration_add_notifier(NotifierWithReturn *notify, MigrationNotifyFunc func); =20 /* - * Same as migration_add_notifier, but applies to be specified @mode. + * Same as migration_add_notifier, but applies to the specified @mode + * instead of MIG_MODE_NORMAL. */ void migration_add_notifier_mode(NotifierWithReturn *notify, MigrationNotifyFunc func, MigMode mode); =20 /* - * Same as migration_add_notifier, but applies to all @mode in the argument - * list. The list is terminated by -1 or MIG_MODE_ALL. For the latter, - * the notifier is added for all modes. + * Same as migration_add_notifier, but applies to the specified @modes + * (a bitset of MigMode). */ void migration_add_notifier_modes(NotifierWithReturn *notify, - MigrationNotifyFunc func, MigMode mode, = ...); + MigrationNotifyFunc func, unsigned modes= ); =20 /* * Remove a notifier from all modes. diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c index 8e9639603e..32c260b345 100644 --- a/hw/vfio/container-legacy.c +++ b/hw/vfio/container-legacy.c @@ -977,9 +977,9 @@ static bool vfio_legacy_attach_device(const char *name,= VFIODevice *vbasedev, if (vbasedev->mdev) { error_setg(&vbasedev->cpr.mdev_blocker, "CPR does not support vfio mdev %s", vbasedev->name); - if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp, - MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_= EXEC, - -1) < 0) { + if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_EXEC), + errp) < 0) { goto hiod_unref_exit; } } diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c index 8a4d65de5e..c244db88fb 100644 --- a/hw/vfio/cpr-iommufd.c +++ b/hw/vfio/cpr-iommufd.c @@ -158,9 +158,9 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *= be, Error **errp) Error **cpr_blocker =3D &be->cpr_blocker; =20 if (!vfio_cpr_supported(be, cpr_blocker)) { - return migrate_add_blocker_modes(cpr_blocker, errp, - MIG_MODE_CPR_TRANSFER, - MIG_MODE_CPR_EXEC, -1) =3D=3D 0; + return migrate_add_blocker_modes(cpr_blocker, + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_TRANSFER= ), + errp); } =20 vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be); diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c index 7184c93991..86c943158e 100644 --- a/hw/vfio/cpr-legacy.c +++ b/hw/vfio/cpr-legacy.c @@ -176,9 +176,9 @@ bool vfio_legacy_cpr_register_container(VFIOLegacyConta= iner *container, MIG_MODE_CPR_REBOOT); =20 if (!vfio_cpr_supported(container, cpr_blocker)) { - return migrate_add_blocker_modes(cpr_blocker, errp, - MIG_MODE_CPR_TRANSFER, - MIG_MODE_CPR_EXEC, -1) =3D=3D 0; + return migrate_add_blocker_modes(cpr_blocker, + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_EXEC= ), + errp) =3D=3D 0; } =20 vfio_cpr_add_kvm_notifier(); @@ -187,7 +187,7 @@ bool vfio_legacy_cpr_register_container(VFIOLegacyConta= iner *container, =20 migration_add_notifier_modes(&container->cpr.transfer_notifier, vfio_cpr_fail_notifier, - MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,= -1); + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE= _CPR_EXEC)); return true; } =20 diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c index db462aabcb..998230d271 100644 --- a/hw/vfio/cpr.c +++ b/hw/vfio/cpr.c @@ -197,8 +197,7 @@ void vfio_cpr_add_kvm_notifier(void) if (!kvm_close_notifier.notify) { migration_add_notifier_modes(&kvm_close_notifier, vfio_cpr_kvm_close_notifier, - MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_E= XEC, - -1); + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_= MODE_CPR_EXEC)); } } =20 @@ -285,7 +284,7 @@ void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev) { migration_add_notifier_modes(&vdev->cpr.transfer_notifier, vfio_cpr_pci_notifier, - MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,= -1); + BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE= _CPR_EXEC)); } =20 void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev) diff --git a/hw/vfio/device.c b/hw/vfio/device.c index 8b63e765ac..76869828fc 100644 --- a/hw/vfio/device.c +++ b/hw/vfio/device.c @@ -345,8 +345,8 @@ bool vfio_device_get_name(VFIODevice *vbasedev, Error *= *errp) "vfio device with fd=3D%d needs an id property", vbasedev->fd); return migrate_add_blocker_modes(&vbasedev->cpr.id_blocker, - errp, MIG_MODE_CPR_TRANSF= ER, - -1) =3D=3D 0; + BIT(MIG_MODE_CPR_TRANSFER= ), + errp) =3D=3D 0; } } } diff --git a/migration/migration.c b/migration/migration.c index 478c76bc25..f613b95287 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1672,8 +1672,6 @@ void migration_cancel(void) } } =20 -static unsigned get_modes(MigMode mode, va_list ap); - static void add_notifiers(NotifierWithReturn *notify, unsigned modes) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { @@ -1685,15 +1683,8 @@ static void add_notifiers(NotifierWithReturn *notify= , unsigned modes) } =20 void migration_add_notifier_modes(NotifierWithReturn *notify, - MigrationNotifyFunc func, MigMode mode, = ...) + MigrationNotifyFunc func, unsigned modes) { - unsigned modes; - va_list ap; - - va_start(ap, mode); - modes =3D get_modes(mode, ap); - va_end(ap); - notify->notify =3D (NotifierWithReturnFunc)func; add_notifiers(notify, modes); } @@ -1701,13 +1692,13 @@ void migration_add_notifier_modes(NotifierWithRetur= n *notify, void migration_add_notifier_mode(NotifierWithReturn *notify, MigrationNotifyFunc func, MigMode mode) { - migration_add_notifier_modes(notify, func, mode, -1); + migration_add_notifier_modes(notify, func, BIT(mode)); } =20 void migration_add_notifier(NotifierWithReturn *notify, MigrationNotifyFunc func) { - migration_add_notifier_modes(notify, func, MIG_MODE_NORMAL, -1); + migration_add_notifier_mode(notify, func, MIG_MODE_NORMAL); } =20 void migration_remove_notifier(NotifierWithReturn *notify) @@ -1890,21 +1881,6 @@ static bool is_only_migratable(Error **reasonp, Erro= r **errp, unsigned modes) return false; } =20 -static unsigned get_modes(MigMode mode, va_list ap) -{ - unsigned modes =3D 0; - - while (mode !=3D -1 && mode !=3D MIG_MODE_ALL) { - assert(mode >=3D MIG_MODE_NORMAL && mode < MIG_MODE__MAX); - modes |=3D BIT(mode); - mode =3D va_arg(ap, MigMode); - } - if (mode =3D=3D MIG_MODE_ALL) { - modes =3D BIT(MIG_MODE__MAX) - 1; - } - return modes; -} - static int add_blockers(Error **reasonp, Error **errp, unsigned modes) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { @@ -1918,23 +1894,16 @@ static int add_blockers(Error **reasonp, Error **er= rp, unsigned modes) =20 int migrate_add_blocker(Error **reasonp, Error **errp) { - return migrate_add_blocker_modes(reasonp, errp, MIG_MODE_ALL); + return migrate_add_blocker_modes(reasonp, -1u, errp); } =20 int migrate_add_blocker_normal(Error **reasonp, Error **errp) { - return migrate_add_blocker_modes(reasonp, errp, MIG_MODE_NORMAL, -1); + return migrate_add_blocker_modes(reasonp, BIT(MIG_MODE_NORMAL), errp); } =20 -int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...) +int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **err= p) { - unsigned modes; - va_list ap; - - va_start(ap, mode); - modes =3D get_modes(mode, ap); - va_end(ap); - if (is_only_migratable(reasonp, errp, modes)) { return -EACCES; } else if (is_busy(reasonp, errp)) { diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c index 11cbff268f..e54c7160d3 100644 --- a/stubs/migr-blocker.c +++ b/stubs/migr-blocker.c @@ -11,7 +11,7 @@ int migrate_add_blocker_normal(Error **reasonp, Error **e= rrp) return 0; } =20 -int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode,= ...) +int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **err= p) { return 0; } diff --git a/system/physmem.c b/system/physmem.c index a340ca3e61..a7e2a5d07f 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2255,8 +2255,8 @@ static void ram_block_add(RAMBlock *new_block, Error = **errp) "Memory region %s uses guest_memfd, " "which is not supported with CPR.", memory_region_name(new_block->mr)); - migrate_add_blocker_modes(&new_block->cpr_blocker, errp, - MIG_MODE_CPR_TRANSFER, -1); + migrate_add_blocker_modes(&new_block->cpr_blocker, + BIT(MIG_MODE_CPR_TRANSFER), errp); } } =20 @@ -4462,8 +4462,8 @@ void ram_block_add_cpr_blocker(RAMBlock *rb, Error **= errp) "Memory region %s is not compatible with CPR. share=3Don is= " "required for memory-backend objects, and aux-ram-share=3Do= n is " "required.", memory_region_name(rb->mr)); - migrate_add_blocker_modes(&rb->cpr_blocker, errp, MIG_MODE_CPR_TRANSFE= R, - -1); + migrate_add_blocker_modes(&rb->cpr_blocker, BIT(MIG_MODE_CPR_TRANSFER), + errp); } =20 void ram_block_del_cpr_blocker(RAMBlock *rb) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204145; cv=none; d=zohomail.com; s=zohoarc; b=OHmpIHa/UzYGWAnKr+oLFYsGK6wIG/oZheyTMJ8fCfEEY4ddZlvyXTWsM8XQuPcr5KRnCi09e3iXnkKDmD/BG3fMVBQPOLah/cV17qHym7CtUBRK52lkHY1KMLnEXIbO3XkGBJLXHY4MVhPO1mh8e73FGuQj+0nJYIDMOCfubBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204145; 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=vklKslWLbNtXTg8FTlEZA3hZadv9klpHSH1s6LHPYGo=; b=NeIvJxXbZZCdgIG+BTytjQaWP5AeU+bz2P1KGJkIGmKx3nknDzrywlfitoAdb0TE4Ow19lMvsAojwX95hptntQTARRAy1TknG/Ycecr9KqrorANs0i0pwVIcBERBubmoEAgHTx6RCmk0O33ESlLFBNcVe8pz+t9TTSehIVTO8mU= 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 1762204145828705.4083620491426; Mon, 3 Nov 2025 13:09:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lp-00013d-U5; Mon, 03 Nov 2025 16:07:22 -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 1vG1lk-00012f-VR for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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 1vG1lZ-0005NR-24 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:16 -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-3-2ZQ43CYsPhefloG4G-0IYw-1; Mon, 03 Nov 2025 16:06:59 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-892637a3736so1596428985a.1 for ; Mon, 03 Nov 2025 13:06:59 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204021; 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=vklKslWLbNtXTg8FTlEZA3hZadv9klpHSH1s6LHPYGo=; b=P64DbGHRwdNEJWpQ8RWK7v5BTZhJe5ORo5nCQQ2Nqzlo5A0PHmVgtO3sJS0I/k+4UKtAk3 /Rrb+1YSj43N7ioREMhgm5Jpjde10aI0nw1mvXPSH1j/h4aF/VvIUv6NjMYFWsTCzz96w6 Y1+WTlj7wkYDLUTGI4X1MgyVamLsZlE= X-MC-Unique: 2ZQ43CYsPhefloG4G-0IYw-1 X-Mimecast-MFC-AGG-ID: 2ZQ43CYsPhefloG4G-0IYw_1762204018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204018; x=1762808818; 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=vklKslWLbNtXTg8FTlEZA3hZadv9klpHSH1s6LHPYGo=; b=ruvL3B4SuacfhPovDfHyKkWhc6frjQG9q52O1TAdagjYi7nWCyrfGxwE1XU+f39rGn MRwL4U6mm2MuodKtY6AAQk5EL0ggeV+JI8G1ZrmhmYl9yQxh7aJAuEz0cKiatgUH65xj xBg0PDZyw1S8uIR8O8CDmrMPxqQAeX9UIK0aX7Fd0fAXPJ6XKdeXnDYaX4oXxuoyl3kX Zxe7yXaO8kzMlQHudArwGjPbBttCDJN64DhrZ1r1dFMQJe6vs8YLFlc1p7R85L86qmJ7 5qO+BrSixRQJn+kMFDxWpV3GOvhJzhB0jBk6tHcT2hVKdSYcOWHQvY5kpA9lYBUT7T91 LJOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204018; x=1762808818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vklKslWLbNtXTg8FTlEZA3hZadv9klpHSH1s6LHPYGo=; b=V4tlb11FsVtVbs0tZth1eAFi7uwI2Lao7x23+geYI8bOBuePdiqYQLeb2xXyrAshW1 zrAR7YPWll5Ih7MT60vutJLb/8PPxiuHAYTVtAcZxwbkUoH1OY27HtjH73oiHbvtAlKl jMJTssubLP1X3s6KFgG+1P5mqnefwI09QcQJnA8R26gDI6FfrtWY09c2HxiykgwAuMnt 4/6iaLv/5uSO/TVp1PsMdA41bsZ96VuG4k/OglVBafQMvsMN4wlaS7yvN/KCnyJ4IUm9 ZpycMnUoECb2/TZP1YL7Y7LkKBdbQiRbg4iUWUw10aO71dp+pa21buzpdZr8DcgGpTnt /Ekw== X-Gm-Message-State: AOJu0YwcUDDsiccNNkMKtpabC4j68vLwDTpS8UpvNleDcNZtfucozqx+ h4AKRHnyADHZivBF219Bm8dbJI/qUGE3xCuFJehEBlZM1H0XZAHHPxSQWZG9ACHgoeuVka9J9uE +QT9VNPq+f9h3SGJ4GhOU40TeFkGtK98oTVgedTtFDYCgk0qGIQ+gZc75xineh41bvbUi5asVf9 2DB+kIx3aqOqbnTVUYbYKRVrVGkJnuIicEmWLkhw== X-Gm-Gg: ASbGnculfUZTPikAq+P6soGvD6tBBOb1OXXRM3BLanP501LVCA++OkIGCLnNlBGyP9B FpakKfpWZNqIyAhYff+Ev+cnrBKuHubsKyxnQ7rDdB+Nim1gJjmzpu5Rlh5W0N8ItYD73MWaZuy PZ0HPd5tiBUQWtpBQZrtZFbETqt5FEndQ1mrGgD3F1J5yo8Pl1dftZjywpfjyWHu0djlCCaj2Vq zsIvfR/wKc+QCQDhAO3GF09kdUae0pFkIKmeiFqWSFgoMZo0oIQYV1zqQutiBT5GlvPRtGQJj0Y SJtqD+PNzAnRqjlC3hFXXgZjWgv7cR4qBF6csmT07rMYEScLa85bVrRNShZCbn34 X-Received: by 2002:a05:620a:4688:b0:852:9e8:4a02 with SMTP id af79cd13be357-8ab9948fb6emr1529288785a.19.1762204018269; Mon, 03 Nov 2025 13:06:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbb4CbHfyXAzKFjXD3Q8aGBNxduSGS2yjvdm4D00l+5Jbz3IRYGa9nk4oeygt4QH8uJSjIVw== X-Received: by 2002:a05:620a:4688:b0:852:9e8:4a02 with SMTP id af79cd13be357-8ab9948fb6emr1529282385a.19.1762204017640; Mon, 03 Nov 2025 13:06:57 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Markus Armbruster Subject: [PULL 20/36] migration: Put Error **errp parameter last Date: Mon, 3 Nov 2025 16:06:09 -0500 Message-ID: <20251103210625.3689448-21-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204146828154100 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster qapi/error.h's big comment: * - Functions that use Error to report errors have an Error **errp * parameter. It should be the last parameter, except for functions * taking variable arguments. is_only_migratable() and add_blockers() have it in the middle. Clean them up. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251027064503.1074255-4-armbru@redhat.com Signed-off-by: Peter Xu --- migration/migration.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f613b95287..5e74993b46 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1867,7 +1867,7 @@ static bool is_busy(Error **reasonp, Error **errp) return false; } =20 -static bool is_only_migratable(Error **reasonp, Error **errp, unsigned mod= es) +static bool is_only_migratable(Error **reasonp, unsigned modes, Error **er= rp) { ERRP_GUARD(); =20 @@ -1881,7 +1881,7 @@ static bool is_only_migratable(Error **reasonp, Error= **errp, unsigned modes) return false; } =20 -static int add_blockers(Error **reasonp, Error **errp, unsigned modes) +static int add_blockers(Error **reasonp, unsigned modes, Error **errp) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { if (modes & BIT(mode)) { @@ -1904,12 +1904,12 @@ int migrate_add_blocker_normal(Error **reasonp, Err= or **errp) =20 int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **err= p) { - if (is_only_migratable(reasonp, errp, modes)) { + if (is_only_migratable(reasonp, modes, errp)) { return -EACCES; } else if (is_busy(reasonp, errp)) { return -EBUSY; } - return add_blockers(reasonp, errp, modes); + return add_blockers(reasonp, modes, errp); } =20 int migrate_add_blocker_internal(Error **reasonp, Error **errp) @@ -1919,7 +1919,7 @@ int migrate_add_blocker_internal(Error **reasonp, Err= or **errp) if (is_busy(reasonp, errp)) { return -EBUSY; } - return add_blockers(reasonp, errp, modes); + return add_blockers(reasonp, modes, errp); } =20 void migrate_del_blocker(Error **reasonp) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204242; cv=none; d=zohomail.com; s=zohoarc; b=lzZEYm86cb6vb0GM5tW1762nSjbUZ46zUFgAxynDpUi37uTN8Ojfo3w2nFx0qSttnK2ZmwDVfnAvTg4A4HH4yCfW+Cyw7dTmYBejXREWEZebezLLNx94fhXq6h2hkQjWY8rnlq4l3L6XUwvVl0DjlHi/0E8GCT5CAWazW7Pz4SM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204242; 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=TaWkrY5rCFrcQOkGSahAZsAjKVM238HQDT5pwdu9p4c=; b=WchXtt4apISD6bY/WOijuC7noLbhaIy8xpos4CdTv+/009ZL/VC3SDBOWS2z3xC9Uve1TNkLsPvHHtd4gl2LSpGwrPNvsuuL0bTkzLPW15gNGnyPbxmDpTziEuJy7KJkQ51aMHF3YJmHOSluldqG69LGFphs+Q+SD6uQxF6oyEc= 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 1762204242321503.105594814342; Mon, 3 Nov 2025 13:10:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lw-00015Q-UL; Mon, 03 Nov 2025 16:07:28 -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 1vG1ln-000132-0v for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:20 -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 1vG1lZ-0005NW-Iz for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:17 -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-466-hQgxn5pMOpWH17CxwzYa0w-1; Mon, 03 Nov 2025 16:07:01 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b12cde7f76so31028785a.0 for ; Mon, 03 Nov 2025 13:07:01 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204022; 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=TaWkrY5rCFrcQOkGSahAZsAjKVM238HQDT5pwdu9p4c=; b=AqKlObAsREhYrUfmVA1pQ5Isrt/7TchysGWUw8mGz/ymcj4+N+Js2qJlAw8EzU+rQnfnBu xg7vFFTf539LEtgcL6Uui5NnSbFHyPRKr+WH7LlyUMiwIiFz02W75TqNYbqbY76QYQdrhd ZYMrXxebyWF7ZRqdRm06COpZp63K+FM= X-MC-Unique: hQgxn5pMOpWH17CxwzYa0w-1 X-Mimecast-MFC-AGG-ID: hQgxn5pMOpWH17CxwzYa0w_1762204020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204020; x=1762808820; 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=TaWkrY5rCFrcQOkGSahAZsAjKVM238HQDT5pwdu9p4c=; b=A9y1eIjh8y4GYTFgSMZTGfZWjHy0gcI6sv3UJxbnu0nIKzcurc3K4u4+sDmb8UKnYk bIgqq748YuYPLpgU2yUUoLLSQQeLWasQLofhQwF8QZm9Avof0u4Rn1kyI8onBMP9GQHD S0m0ELdfFYUmYtOjBmYEkEI5WqwqSlO2iRFTJniFscgFdAbVCj5mRXL1SUZyUHNuMRMp yexkOf8EaN7ly/a5pmq7JWq2CiWlzT9D85iKJYHieGhLTYN+c6i/pwkwhiiqw8uBQc06 a4Gp6gXdmqNRrPJjzxn/cH4qy2IL9tn1o72/Wt0LFdrfN+gIt+9lz4FhWg7nNYTRHcBG 5k6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204020; x=1762808820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TaWkrY5rCFrcQOkGSahAZsAjKVM238HQDT5pwdu9p4c=; b=OD6UeoFBblCZ98nBYUd7C7Pq7moeu9zK6xrHs6NmfXDe39xxZuUzKE0d4Na01oDI1X YBsHfDj5EQf27C8KzeNcA1dJZr5XxE7SOfimwv47EOEYdHwvRC0FXNXWpZz6vyXErq8N dj8sz194rLMhWcvg6paf+2JegaPfbaHyoPw2V6uwI5Ps2qlF/qlilZBEOARWpoNd5Zma z1rBMzX8/+cnbQBN48H873qUc5+2Ug8gnywfRD9r/zW75IfWeBR1OEkDrQIT1/vi/+7r RBie/dEuyY98JUboQihAkXyzjLHgPyOCCkVlnThC5WK/hNuy5+Z5bCnDgPdtPNfwUVX2 mj1g== X-Gm-Message-State: AOJu0YxIgfLnOCH5/4Jer8AcARcjf2x59HL/p2HLNIQtMru27h6EYFb2 WQWlJXrfjPyJRkHi0RDZdISJFPHE7r3IwJqvGAWf1W0AcItiyW3NcrWgq1IjTnU8sK0dZaS23Ep p1p5PJFpKeb0ABReW/DSw9NfWfKPchW3J+/WseTyHe3QTfqaDat8uCnUWcjzCNkTUOohFxtvf2k G3itq/wd2ghBBph7shJ/DmYFVhAtpwuAZRl9OY4Q== X-Gm-Gg: ASbGncsHhb0k9a1KjMtMa2poCmq1Q/otXoYRjLWYj1XE0ev5dnSESUi1gc2Rcvb/SxD MxKTVWJ/ztiUR8/P7eSqpquUthDblozkK5mmd7Pz4aOdaGuh88ejHR/E6QZMwgIyyoW0Jo4PbWL GqvzwTX8glWBUoY1eQLF5pKwtNDyEHWMfJLzWzT/I6ixQduA1ES5OsG3j0DuFCMOMBD4sDStE4R 7MWfvSwLmUAHDVgq1gE9UYc7iaXmJS23ZdmVsvikel+6rG2YsrDQfFeMKYlJXrY+gM7TgaHbqCF mt3DAPX5ArYzwYgLTRBENarabht0lZRjxhlIsPdj60Ji+DPDgzdCHLL1Cq52I2V0 X-Received: by 2002:a05:620a:223b:b0:8ad:32ae:b6d9 with SMTP id af79cd13be357-8b10d0aaad9mr91834285a.44.1762204020023; Mon, 03 Nov 2025 13:07:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSt6jqX3VOkDQDVSy1XqQH77EyuDFlDXC8AkYBS4nKl9NGoi+NWYfhbee9a508f4m2rHcpNw== X-Received: by 2002:a05:620a:223b:b0:8ad:32ae:b6d9 with SMTP id af79cd13be357-8b10d0aaad9mr91829185a.44.1762204019397; Mon, 03 Nov 2025 13:06:59 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Vladimir Sementsov-Ogievskiy Subject: [PULL 21/36] io: Add qio_channel_wait_cond() helper Date: Mon, 3 Nov 2025 16:06:10 -0500 Message-ID: <20251103210625.3689448-22-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1762204245564154100 Add the helper to wait for QIO channel's IO availability in any context (coroutine, or non-coroutine). Use it tree-wide for three occurences. Cc: Daniel P. Berrang=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy Link: https://lore.kernel.org/r/20251022192612.2737648-2-peterx@redhat.com Signed-off-by: Peter Xu --- include/io/channel.h | 15 +++++++++++++++ io/channel.c | 21 +++++++++++---------- migration/qemu-file.c | 6 +----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/io/channel.h b/include/io/channel.h index 0f25ae0069..d6d5bf2b5f 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -871,6 +871,21 @@ void qio_channel_wake_read(QIOChannel *ioc); void qio_channel_wait(QIOChannel *ioc, GIOCondition condition); =20 +/** + * qio_channel_wait_cond: + * @ioc: the channel object + * @condition: the I/O condition to wait for + * + * Block execution from the current thread until + * the condition indicated by @condition becomes + * available. + * + * This will work with/without a coroutine context, by automatically select + * the proper API to wait. + */ +void qio_channel_wait_cond(QIOChannel *ioc, + GIOCondition condition); + /** * qio_channel_set_aio_fd_handler: * @ioc: the channel object diff --git a/io/channel.c b/io/channel.c index 852e684938..b18fc346ff 100644 --- a/io/channel.c +++ b/io/channel.c @@ -159,11 +159,7 @@ int coroutine_mixed_fn qio_channel_readv_full_all_eof(= QIOChannel *ioc, len =3D qio_channel_readv_full(ioc, local_iov, nlocal_iov, local_f= ds, local_nfds, flags, errp); if (len =3D=3D QIO_CHANNEL_ERR_BLOCK) { - if (qemu_in_coroutine()) { - qio_channel_yield(ioc, G_IO_IN); - } else { - qio_channel_wait(ioc, G_IO_IN); - } + qio_channel_wait_cond(ioc, G_IO_IN); continue; } =20 @@ -268,11 +264,7 @@ int coroutine_mixed_fn qio_channel_writev_full_all(QIO= Channel *ioc, nfds, flags, errp); =20 if (len =3D=3D QIO_CHANNEL_ERR_BLOCK) { - if (qemu_in_coroutine()) { - qio_channel_yield(ioc, G_IO_OUT); - } else { - qio_channel_wait(ioc, G_IO_OUT); - } + qio_channel_wait_cond(ioc, G_IO_OUT); continue; } if (len < 0) { @@ -774,6 +766,15 @@ void qio_channel_wait(QIOChannel *ioc, g_main_context_unref(ctxt); } =20 +void qio_channel_wait_cond(QIOChannel *ioc, + GIOCondition condition) +{ + if (qemu_in_coroutine()) { + qio_channel_yield(ioc, condition); + } else { + qio_channel_wait(ioc, condition); + } +} =20 static void qio_channel_finalize(Object *obj) { diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 2d4ce174a5..4b5a409a80 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -343,11 +343,7 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEM= UFile *f) QIO_CHANNEL_READ_FLAG_FD_PRESERVE_BLO= CKING, &local_error); if (len =3D=3D QIO_CHANNEL_ERR_BLOCK) { - if (qemu_in_coroutine()) { - qio_channel_yield(f->ioc, G_IO_IN); - } else { - qio_channel_wait(f->ioc, G_IO_IN); - } + qio_channel_wait_cond(f->ioc, G_IO_IN); } } while (len =3D=3D QIO_CHANNEL_ERR_BLOCK); =20 --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204124; cv=none; d=zohomail.com; s=zohoarc; b=L0uqBlEOYVUztUaks8e7UnozVKZnKGmOT5SAlAG5KbxWJ1ZZYli0ekEboPBGinOEV3/tTkLWnXsRxrc2bA/VDbgqySb5OkWIYt2FlzmlBnS43trvPTP9yst9KWjrx2WNWmirC083NMV2/2DKvbAbsdUBlz/MegkehePFC/gT5kM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204124; 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=dKv6Wkq2k6ueU++W0j4Jpj9adHe/TBCqtH0wdQ1hQcY=; b=ZowAcpbuj4N+Q6B5pbfmUENJVGu5WZfBZRrQ5/5/A+D+dc6aqfOtOm+zKf7js3jbL48h/M6V2Ll+73w8grpw4CCuLSzEdbiavXDGmUJTcFxrkOKAizrK/hrrv6a57o5A/BsyR/+XFeootAwt99sMoQEtzQPNMbcK6mPVVdUAoY0= 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 1762204124821314.648846870022; Mon, 3 Nov 2025 13:08:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m1-00017J-5A; Mon, 03 Nov 2025 16:07:33 -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 1vG1lu-00014t-Ta for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1la-0005Ny-RQ for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:26 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-0jqamX-kPXuYaeLx3TLLPw-1; Mon, 03 Nov 2025 16:07:02 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4ecf0501ec2so100538401cf.0 for ; Mon, 03 Nov 2025 13:07:02 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204023; 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=dKv6Wkq2k6ueU++W0j4Jpj9adHe/TBCqtH0wdQ1hQcY=; b=XhNkuqvE/4kelBpna9X+yu15ZQz05hpbYhLh2SSJ+SakeD3CNCLUuW1IbgRn/cCG5X9PZi bgLK15xVQBxK7dmwU+CSGZXvWb0NOx8kg+pqzYzKVquyHOWQ2mlQMaceqhSmCZ2jjxelma yrXDjq8Du4g8Syixw7WYMkV8kxUpuyY= X-MC-Unique: 0jqamX-kPXuYaeLx3TLLPw-1 X-Mimecast-MFC-AGG-ID: 0jqamX-kPXuYaeLx3TLLPw_1762204022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204021; x=1762808821; 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=dKv6Wkq2k6ueU++W0j4Jpj9adHe/TBCqtH0wdQ1hQcY=; b=aaX586yEWG2SfjXHv6J3VNgXBRhhmNXsSlvw2SE/d9byeed5VqeYnVVHhnFlcN4X9m h9qsCJ6W/7UMxBanERr60uN0xIn1BDmPPRSuxT40GeY3LgNMgutVDmTGrqsZrVQ60K/2 9cmT5AksKb/FWsfOndidWe0CYHm05o2EF/qwROJYBwqahGAs3ReMvlA5rbFwBHDFs+Vy eef1TXBz4ER4912ox8e1AKYlWYvb2DX/17vUsfmfo+8/U8Q+uCEBTH7yz/uN6D/dPYFX 5DvbXur6DvS8IZBDyxa/tlApczjCyX1ukgez+vMx3GGGc2JiC+e2NEOwAAWIhX6K2KKL MNZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204021; x=1762808821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dKv6Wkq2k6ueU++W0j4Jpj9adHe/TBCqtH0wdQ1hQcY=; b=LqjqePpVrIkdcQyFjh/uKKjAjoZeCUWum6c7v9bemEW9X8lnN3AJL0xhYKusZ6H4L8 6BwjqZIEdTqhhpk3QLeWhVDEz/K+GF52pELph0v98B7TbWsyFsMQoqYQniiMcRGA/vye s2SfhCsub9wi2G2ZGWYtgsCAjeuIpLqrzQQoBE9AuFVvAy09IYWiUD7Ub536Xni1H+R0 9NIvBiPUfbNRyMUND5NxDIDYBva4ESlkJhh559rZY+bkTVm5j18mEtXbbGwuOQ4QzkFM 8TL423N7fio+7w06cUdZpy01sRFxm8EXwP0T3LWiz3Me1MzON+8mtrPy5MZVKPfJYTx9 +4KA== X-Gm-Message-State: AOJu0YyUSkBpMIJStyFUZF9IGITcHF38OYZKZrpH8cNhSHSFBDsVb8aq ztLtl1RVmlmprl3qt9sbqr8cUHJthKqsbkX1PCHordTZDcvKHbAF32nYrTEBuw55N4CChv83N4z OOajstfC3pFOHFcdw5eYTNcAOdM6qpaL7wcK5t6dRN3tPtpsTirKnqhpHGqkHonHXFvG0BDZ3gO 5yvJeWMLXKiYTbAY7ZQs03jSjR7/imcQsNPmnRfw== X-Gm-Gg: ASbGnct3WFlqrrN5bCzfL4CDSfvBVYW2xpHlcyLJXLhkDH7iNmYdVjDKJK0hFjk9bjn OeeTXxrjR6xh1J0yvJGW/ppPRKp1/yuwqVnVQnM1RbsXUBAh+rwEOrp9OnS6twHq3xf8fER3wJN bFFPaTlDO0LbqJEiVWaVIfPpNhvuRzCfusQPlPv/dHdB8te1Sfgcp6LbhRTozoqJsefHQm2Y2bW PX6YR997r+qsg7fvv7jF55TcCmw8o1tnIePh+T1eUUe5SvrSQnBAf37IrbKT04QKq8Hkpfgzj+h WiTPEKnCd61YDywE1cIWvh/6opR8lZp7PA9LTmhh74GFoJMJ872DWhl5NaglFPi9 X-Received: by 2002:a05:622a:418e:b0:4e7:1eb9:605d with SMTP id d75a77b69052e-4ed30d4ef35mr164580191cf.11.1762204021048; Mon, 03 Nov 2025 13:07:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBveRYy/QYvtQ7hk4nBhBNCdn+kMcMHpQPydEzNXeivQnb5dUJ8HWJY/SEhKmBDLw435N7DQ== X-Received: by 2002:a05:622a:418e:b0:4e7:1eb9:605d with SMTP id d75a77b69052e-4ed30d4ef35mr164579611cf.11.1762204020471; Mon, 03 Nov 2025 13:07:00 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Vladimir Sementsov-Ogievskiy Subject: [PULL 22/36] migration: Properly wait on G_IO_IN when peeking messages Date: Mon, 3 Nov 2025 16:06:11 -0500 Message-ID: <20251103210625.3689448-23-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 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: 1762204132010158500 migration_channel_read_peek() used to do explicit waits of a short period when peeking message needs retry. Replace it with explicit polls on the io channel, exactly like what qemu_fill_buffer() does. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy Link: https://lore.kernel.org/r/20251022192612.2737648-3-peterx@redhat.com Signed-off-by: Peter Xu --- migration/channel.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index a547b1fbfe..462cc183e1 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -135,12 +135,7 @@ int migration_channel_read_peek(QIOChannel *ioc, break; } =20 - /* 1ms sleep. */ - if (qemu_in_coroutine()) { - qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000); - } else { - g_usleep(1000); - } + qio_channel_wait_cond(ioc, G_IO_IN); } =20 return 0; --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204127; cv=none; d=zohomail.com; s=zohoarc; b=UqFf/ZT+YfZPm12Rrc0xjSy6FO5llzdWBmQQslblXswDJnfXNqRirkxKNPIuytk9IHdwnQsfQvagv0dl/Jls2Iip4inaUzxSrObJQ+V6P8804cM1S9T9n8AglWakwVEgGimLcyqqfSAumAXKKr+BEMI9OyztopwGdxq3OeUX22c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204127; 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=Ro0rqiX7tgkkRvJEpK7ll/B4dLckc2iwMhybX5sTV6c=; b=C3bqC0YOyWDp3f13UCYXqy+MyX5f0hs9k4k6W2iMg22hufIRraY/LZI/R6DQdBQHEVK6TvK9wNdec5zuNZMGpeco7jk9iiqsZE2lzwoIbeAsj+HgpJ5nZ+g/sn0JP+pruVAjRZT2dmd+i1DNzQomS1vCEhjyRtjjg9moYfzlCX0= 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 1762204127285314.8121588501057; Mon, 3 Nov 2025 13:08:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lt-00014N-HB; Mon, 03 Nov 2025 16:07:25 -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 1vG1lr-00013t-7b for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:24 -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 1vG1lc-0005OQ-1q for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:22 -0500 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-LUqpTBlCPwG-vp6l_TjOUA-1; Mon, 03 Nov 2025 16:07:03 -0500 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4ed5f5a2948so10153741cf.2 for ; Mon, 03 Nov 2025 13:07:03 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204024; 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=Ro0rqiX7tgkkRvJEpK7ll/B4dLckc2iwMhybX5sTV6c=; b=QZfmeda9QW2Gwd9cXqXPJ5EilJbK0kLVeXX/9AmSRX2hlGrndR0x5gNM3kJYozrw5OmNZ0 ALjbg1wDaZmA3xtA5F2OSs+t26Cfe083T3439h6Sy66DB8/k14P2wSXbku8nnZM1UdysI7 RqxvnDHDIurmDTi7S6slIfE08S/lbcc= X-MC-Unique: LUqpTBlCPwG-vp6l_TjOUA-1 X-Mimecast-MFC-AGG-ID: LUqpTBlCPwG-vp6l_TjOUA_1762204023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204022; x=1762808822; 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=Ro0rqiX7tgkkRvJEpK7ll/B4dLckc2iwMhybX5sTV6c=; b=Y0m+MtrTg/6Bc3kMMyd1GrJgd3ooinGmE9JXUKZS5WJJhI9hBN43XqoVUF98xDpowh E1iIbJX4/g138y7t/TGdBFtsVSp33qMHejfY6oJPAap+5O/e5Zi2qSvfBMu7/0YkGdJa Ahe5du1rY4jT2HEe/3d3BcW2FXOLIquZIAlwVhaEun2PCKaN4bI4iKf9Lqm93vUyPsnq 10yb3m1p+B08Y4k0Qz5AmkJVny3lWERe3PmncLsdBX4kABXPzYHUO0bJ8WSa7Y49zP6R fZle+k2uNI6p2m4524RsmO90pWKTPA0AegRf93zUldghporMlbo1OTOj2DvS8/ljQTgX FXug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204022; x=1762808822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ro0rqiX7tgkkRvJEpK7ll/B4dLckc2iwMhybX5sTV6c=; b=BG9pJRLbF5/rb0fPtRdtEyhyb7+kWaJaig+WfyUpEd3NWroZ4QlgyWc+qTfTT0QQuy 9Bp6YeuCQTETMxdFCROjnUCW32DD5t24QwAYpwMKmuvOeNlAMI4z1ncpwWxnwkIA3Z24 K1M07qfGIxt67FHYLBJIcnV6sGeFwdSawlmse+KArZx2TkuLqjybiEHzWFs2bgQG1AR2 GDREwVjXcHIBCtPukYF56D4kJv7xMeUeWwdBK7YG1cFGrhBWCujScHEsCJmrfOUNRj34 NxRgkciV/sg1uTDkqA8G6FMayqb63azN1R9dTQAGs0GawbiH6kJXnPBUujsQWrX2uvko 7cow== X-Gm-Message-State: AOJu0YyuDuwJSajEdh8+AsBBB82mrNKvM+YOfw2j1BybiLXQG4TUYRjs URJlckkmGaBernXtU4smI3pFuFTKVUiwhgWUYoJk4xRNfbqh8fU1EcmqOAMZNsOodGrvxhnqNBE zKMNtQOLq3azqoLvM8O1Z3XtOwyEneaEqx0249jKB7IJogcCpkRNq4wsse2V14cAF2usje4FGne ZESQFnt1dx3xRCSs+YfYR9OvdqD7SiKGJSTAIAeg== X-Gm-Gg: ASbGncvWdSGg5koKfP2nYlfTwxzWs23cnNcZcqVngjAEdaMlXHbzltAbosfi1Gx/iLV IiR3J5Q9oD22KkdUOrnpoA66v80krgKFNHqTS5kGzhLlMFnpWa9TniEykq5cuxraB/NTqGP+eHf XJznbVaFoGjZ7kWg942Qv9nkZLAuoHHiwwLXQzSqZtEEgvQVvYJGb7MkYTrW4W68/9UJE3rNIXy j2FfmBOHkMCO8I3OqVt5j2bdHw+5ySnn1FzMoyxACq/34X/WGWPss0Q6aV2+507FFi4UVccurcU EjCGkzRNgNz+jZFGCWlBp8O/bO/T2TOKU15+THV5upsLz2pHcWBKsIr6sh4IkP5j X-Received: by 2002:a05:622a:1825:b0:4ec:eecf:66fc with SMTP id d75a77b69052e-4ed310a77cfmr188497381cf.51.1762204022255; Mon, 03 Nov 2025 13:07:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWrdDYk3VljiAcGnfLyWpCxCC7h8Mq0DR4iVdkwqKoIENEvVqb3X+QYYqb4rinJwo+alhoFg== X-Received: by 2002:a05:622a:1825:b0:4ec:eecf:66fc with SMTP id d75a77b69052e-4ed310a77cfmr188496591cf.51.1762204021652; Mon, 03 Nov 2025 13:07:01 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Subject: [PULL 23/36] migration: vmstate_save_state_v(): fix error path Date: Mon, 3 Nov 2025 16:06:12 -0500 Message-ID: <20251103210625.3689448-24-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204134235158500 From: Vladimir Sementsov-Ogievskiy In case of pre_save_errp, on error, we continue processing fields, unlike case of pre_save, where we return immediately. Behavior for pre_save_errp case is wrong, we must return here, like for pre_save. "migration: Add error-parameterized function variants in VMSD struct" Fixes: 40de712a89 Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Berger Link: https://lore.kernel.org/r/20251028130738.29037-2-vsementsov@yandex-te= am.ru Signed-off-by: Peter Xu --- migration/vmstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/vmstate.c b/migration/vmstate.c index 81eadde553..fd066f910e 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -443,6 +443,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, if (ret < 0) { error_prepend(errp, "pre-save for %s failed, ret: %d: ", vmsd->name, ret); + return ret; } } else if (vmsd->pre_save) { ret =3D vmsd->pre_save(opaque); --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204178; cv=none; d=zohomail.com; s=zohoarc; b=C7aVBVzBqbkERlUmnMJlWu7b+sst9+4FkvWejXgjgcq8vp8KY9SRrDhcUx1Jy5monu2I92C8BLMi4WsWxTF3EPx/K923UBw3Bs6R2H6KNOruoyNCdRvhcPkeRqDAgc1freAHK8FR3u351nLc/2zTz0OK4GpHMEoJor7jO9fiTRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204178; 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=8Dk1DITRQRzye86bCpuNco4jugI9gDovq529oeA29qI=; b=Iz5JjldmV9M6Jk424DQppuYco7YH/r3QXZxnJNXTx0dNkFoMiMxz3vQgmrpUiW+CeH35o/ewvjDc5P7S0u0LzNlKsxr5Whzv64DDolurxAHDIZq9id8eKPBfg+/UqEBtj6L9TKPEK4zQgWi5gIzwlo7BPA30UCsLzfrbFiXLW5Y= 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 1762204178374707.3537949437454; Mon, 3 Nov 2025 13:09:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lw-00014s-86; Mon, 03 Nov 2025 16:07:28 -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 1vG1ls-00013u-1e for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:24 -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 1vG1lf-0005Ot-CT for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:23 -0500 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-EKMU21vSOLSiEZ-UjE82pA-1; Mon, 03 Nov 2025 16:07:04 -0500 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4eceefa36d0so135200701cf.1 for ; Mon, 03 Nov 2025 13:07:04 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204025; 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=8Dk1DITRQRzye86bCpuNco4jugI9gDovq529oeA29qI=; b=jJ1w/OEg0O1LgAU9bJWhnkTo9HBOTsQDk0nhgNa92e+ZXNz4gPjhQrgNRco1uU24MRezd4 XLe3bSnCNqr24Bf2V7AjYXReDsuYhpEwsN5LCbZhtQZFPIA2xKO3lUQEpj0P+UaDfT7tPv RueVLf+LsRQewB7W+cYdyZxYuKTnp+o= X-MC-Unique: EKMU21vSOLSiEZ-UjE82pA-1 X-Mimecast-MFC-AGG-ID: EKMU21vSOLSiEZ-UjE82pA_1762204024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204024; x=1762808824; 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=8Dk1DITRQRzye86bCpuNco4jugI9gDovq529oeA29qI=; b=Vrn4WxRVX8YaXmRN79w0oNNbbK8fwmUsizUNNxKdYaeMt1awxxfy8VKWIm+aDXH/OB nk17aYHkTn2E67XXV/qc5JavjoEUWe1cBOEi6bYvvRWT6md9SQo8AckbF8liYmKsRciZ 9HuhCUdixcGr9a7Q2MhTCJVEO2JYZAJkliOWj9tTrlTVH4CWNTsGd30jZdDEio2txrgS h/6UlBQShQJpqUXmkMUdYeDT5uuiClTAIVvmQVYDytLjpEBUe3bYAws105LhD4AhY1u+ YZABYEkT5MyH+NN7Kn6++gaeS6/U+TRBBySBzSPLrqyOpTNL2KRyyiQh3x4or69SD7b0 NXvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204024; x=1762808824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Dk1DITRQRzye86bCpuNco4jugI9gDovq529oeA29qI=; b=objC1Dj4QPH0S+zo5sZUqvuGTC76SV0N9aWLJB8MwzSEr8/HOcykA/K0D5TeozHKCv KUUO12LdrY3NyZZarI+gpYLVm7cSMnTIHtVJHlCRpxOLukhv1g3TmG83ISavt2KcMjXL zSqET9Q4UU/dmRVcVlsvumPaIuRGNn3CM+xqx/Dg0TX6lqNzraRxLtImrj22djXmivz0 xg+npgomS5/sGal1JfRlQSxFFcXN+03bMgb7pzskZCf4OSVgpQRqgDq0SR83aiw1fyV1 X8063OwaBRyBHPKxdp26Vm8Aw47Cug6j/djYLUlC5r5OOGA5HOHeF2dKLhIauz7CVRVl 0BFQ== X-Gm-Message-State: AOJu0YzqRZ4J90DDLwz/T+oWJ6VXH2n15OXyFwHRNLbkAQONTeGuD1VA 8piGvRMiZ6W5loz/cDaWqqrMgU0BIdb+zcv736CyTDX0sNdV7qhxOUAqLc0VQIuCJn0FZM3fFRt NnwUcwBCCxfnhNhG0MUmdKbop9WEESLObTYrTLUEUs61p5DHxKSbg9HH1D1fJyDJ4ODJLgeQwlY ibszsJ2Tuu1vtp4xP1WhTM6tvqUSrtCRevAwOOmA== X-Gm-Gg: ASbGncuvFquywzxYHqnzVPlxNHXaeHVNvDmN+ScPFMdA74s+KoBye7QhhflpQAoDH4q irHp4zDA8UpYaksOOz/d/PQi2Uf5DQloBjaaM5prJ6l0xoCGtWZluBZSodqo0QmkPc1fAcL10Ov Ek+hxx+0Cipdkq+WRCRRs6MYQfEBEuRHh3WmpiiuL/HR8edESLsqugBKgTlbTvi3po5PJFqoN9s dT83XOLu6Wp66uq4vKLimtrI8m2N0ueeqVkSS/qgIf+MxhGmVuId6o0TyhN4bsjzAi3fV1l9cde J+CVS789CnnvJdN7j/kT2B5G3d2b0ydvrHJyVHmbUNlBqkii0DNM0BnrR6EPuY4a X-Received: by 2002:a05:622a:4c88:b0:4eb:a10c:de05 with SMTP id d75a77b69052e-4ed31005ebamr179689471cf.55.1762204023460; Mon, 03 Nov 2025 13:07:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLkpKbIsVo2kSdk/N/t8wx1OQueKE/2tB7hVkyJQ7ZePFoV4G2zqmYFYMnDLTuTyc5rsINEw== X-Received: by 2002:a05:622a:4c88:b0:4eb:a10c:de05 with SMTP id d75a77b69052e-4ed31005ebamr179688761cf.55.1762204022842; Mon, 03 Nov 2025 13:07:02 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Vladimir Sementsov-Ogievskiy Subject: [PULL 24/36] tmp_emulator: improve and fix use of errp Date: Mon, 3 Nov 2025 16:06:13 -0500 Message-ID: <20251103210625.3689448-25-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1762204181171154100 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy tpm_emulator_post_load() and tpm_emulator_set_state_blobs() has error paths, where they return negative value, but do not set errp. To fix that, we also have to convert several other functions to set errp instead of error_reporting. Signed-off-by: Vladimir Sementsov-Ogievskiy Link: https://lore.kernel.org/r/20251028130738.29037-3-vsementsov@yandex-te= am.ru Signed-off-by: Peter Xu --- backends/tpm/tpm_emulator.c | 63 +++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index f32b67dac7..da9c1056ed 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -308,22 +308,22 @@ static int tpm_emulator_check_caps(TPMEmulator *tpm_e= mu) return 0; } =20 -static int tpm_emulator_stop_tpm(TPMBackend *tb) +static int tpm_emulator_stop_tpm(TPMBackend *tb, Error **errp) { TPMEmulator *tpm_emu =3D TPM_EMULATOR(tb); ptm_res res; =20 if (tpm_emulator_ctrlcmd(tpm_emu, CMD_STOP, &res, 0, sizeof(ptm_res), sizeof(res)) < 0) { - error_report("tpm-emulator: Could not stop TPM: %s", - strerror(errno)); + error_setg(errp, "tpm-emulator: Could not stop TPM: %s", + strerror(errno)); return -1; } =20 res =3D be32_to_cpu(res); if (res) { - error_report("tpm-emulator: TPM result for CMD_STOP: 0x%x %s", res, - tpm_emulator_strerror(res)); + error_setg(errp, "tpm-emulator: TPM result for CMD_STOP: 0x%x %s",= res, + tpm_emulator_strerror(res)); return -1; } =20 @@ -362,12 +362,13 @@ static int tpm_emulator_lock_storage(TPMEmulator *tpm= _emu) =20 static int tpm_emulator_set_buffer_size(TPMBackend *tb, size_t wanted_size, - size_t *actual_size) + size_t *actual_size, + Error **errp) { TPMEmulator *tpm_emu =3D TPM_EMULATOR(tb); ptm_setbuffersize psbs; =20 - if (tpm_emulator_stop_tpm(tb) < 0) { + if (tpm_emulator_stop_tpm(tb, errp) < 0) { return -1; } =20 @@ -376,16 +377,17 @@ static int tpm_emulator_set_buffer_size(TPMBackend *t= b, if (tpm_emulator_ctrlcmd(tpm_emu, CMD_SET_BUFFERSIZE, &psbs, sizeof(psbs.u.req), sizeof(psbs.u.resp.tpm_re= sult), sizeof(psbs.u.resp)) < 0) { - error_report("tpm-emulator: Could not set buffer size: %s", - strerror(errno)); + error_setg(errp, "tpm-emulator: Could not set buffer size: %s", + strerror(errno)); return -1; } =20 psbs.u.resp.tpm_result =3D be32_to_cpu(psbs.u.resp.tpm_result); if (psbs.u.resp.tpm_result !=3D 0) { - error_report("tpm-emulator: TPM result for set buffer size : 0x%x = %s", - psbs.u.resp.tpm_result, - tpm_emulator_strerror(psbs.u.resp.tpm_result)); + error_setg(errp, + "tpm-emulator: TPM result for set buffer size : 0x%x %s= ", + psbs.u.resp.tpm_result, + tpm_emulator_strerror(psbs.u.resp.tpm_result)); return -1; } =20 @@ -402,7 +404,7 @@ static int tpm_emulator_set_buffer_size(TPMBackend *tb, } =20 static int tpm_emulator_startup_tpm_resume(TPMBackend *tb, size_t buffersi= ze, - bool is_resume) + bool is_resume, Error **errp) { TPMEmulator *tpm_emu =3D TPM_EMULATOR(tb); ptm_init init =3D { @@ -413,7 +415,7 @@ static int tpm_emulator_startup_tpm_resume(TPMBackend *= tb, size_t buffersize, trace_tpm_emulator_startup_tpm_resume(is_resume, buffersize); =20 if (buffersize !=3D 0 && - tpm_emulator_set_buffer_size(tb, buffersize, NULL) < 0) { + tpm_emulator_set_buffer_size(tb, buffersize, NULL, errp) < 0) { goto err_exit; } =20 @@ -424,15 +426,15 @@ static int tpm_emulator_startup_tpm_resume(TPMBackend= *tb, size_t buffersize, if (tpm_emulator_ctrlcmd(tpm_emu, CMD_INIT, &init, sizeof(init), sizeof(init.u.resp.tpm_result), sizeof(init)) < 0) { - error_report("tpm-emulator: could not send INIT: %s", - strerror(errno)); + error_setg(errp, "tpm-emulator: could not send INIT: %s", + strerror(errno)); goto err_exit; } =20 res =3D be32_to_cpu(init.u.resp.tpm_result); if (res) { - error_report("tpm-emulator: TPM result for CMD_INIT: 0x%x %s", res, - tpm_emulator_strerror(res)); + error_setg(errp, "tpm-emulator: TPM result for CMD_INIT: 0x%x %s",= res, + tpm_emulator_strerror(res)); goto err_exit; } return 0; @@ -441,18 +443,31 @@ err_exit: return -1; } =20 -static int tpm_emulator_startup_tpm(TPMBackend *tb, size_t buffersize) +static int do_tpm_emulator_startup_tpm(TPMBackend *tb, size_t buffersize, + Error **errp) { /* TPM startup will be done from post_load hook */ if (runstate_check(RUN_STATE_INMIGRATE)) { if (buffersize !=3D 0) { - return tpm_emulator_set_buffer_size(tb, buffersize, NULL); + return tpm_emulator_set_buffer_size(tb, buffersize, NULL, errp= ); } =20 return 0; } =20 - return tpm_emulator_startup_tpm_resume(tb, buffersize, false); + return tpm_emulator_startup_tpm_resume(tb, buffersize, false, errp); +} + +static int tpm_emulator_startup_tpm(TPMBackend *tb, size_t buffersize) +{ + Error *local_err =3D NULL; + int ret =3D do_tpm_emulator_startup_tpm(tb, buffersize, &local_err); + + if (ret < 0) { + error_report_err(local_err); + } + + return ret; } =20 static bool tpm_emulator_get_tpm_established_flag(TPMBackend *tb) @@ -546,7 +561,7 @@ static size_t tpm_emulator_get_buffer_size(TPMBackend *= tb) { size_t actual_size; =20 - if (tpm_emulator_set_buffer_size(tb, 0, &actual_size) < 0) { + if (tpm_emulator_set_buffer_size(tb, 0, &actual_size, NULL) < 0) { return 4096; } =20 @@ -889,7 +904,7 @@ static int tpm_emulator_set_state_blobs(TPMBackend *tb,= Error **errp) =20 trace_tpm_emulator_set_state_blobs(); =20 - if (tpm_emulator_stop_tpm(tb) < 0) { + if (tpm_emulator_stop_tpm(tb, errp) < 0) { trace_tpm_emulator_set_state_blobs_error("Could not stop TPM"); return -EIO; } @@ -960,7 +975,7 @@ static int tpm_emulator_post_load(void *opaque, int ver= sion_id, Error **errp) return ret; } =20 - if (tpm_emulator_startup_tpm_resume(tb, 0, true) < 0) { + if (tpm_emulator_startup_tpm_resume(tb, 0, true, errp) < 0) { return -EIO; } =20 --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204088; cv=none; d=zohomail.com; s=zohoarc; b=esd78q0NmCdQPjqgqhsonJYddQpMbe7F+odcs7J+gPMhMRAem4LwNKevPzHt8LeIvHDPElb6uh1N1Tp7VsE6Ld/xgCOyTPEIMljAzUakMfNZVfpMCFBewFT8dJI9ZBFW9f8TYDi8VoAOQGWECp/VDxdZ+gcc96QVCCLiE2/aXFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204088; 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=qjs+hEnyEnb+x771M+p8O7Iiqf1MdREZ/cqrEg0Ze3c=; b=bIx9BOkkjwuRJM2M/coMo7LgI2YpP4CeWkkEUqznkNF7WNAdA+sRtS/FTbNOsEXv16xh6WJw+a5Npy9aoU+6EHgTZY3RVFPsrlNJKvI4mXBAdZkHnmaNiheVNLiko57mU/C9+r9NGPuoEOfNVSIf35YK40lr703mu6gsw3d0nns= 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 1762204088131894.8041052871282; Mon, 3 Nov 2025 13:08:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1lx-00014w-19; Mon, 03 Nov 2025 16:07:29 -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 1vG1lt-00014e-Kj for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:25 -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 1vG1lf-0005QA-D1 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:25 -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-623-L-JmnSoFMQSy061Ll-tGkQ-1; Mon, 03 Nov 2025 16:07:06 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-88046a6850bso69823986d6.0 for ; Mon, 03 Nov 2025 13:07:06 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204028; 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=qjs+hEnyEnb+x771M+p8O7Iiqf1MdREZ/cqrEg0Ze3c=; b=O/LKBZR/UMcTmhSfsO7E0uNj8tbbxpXQmrMuHeuVlcJtit8O+eulEFNkU63A7mxbNK6XYZ dQNQDguiNj/4OxUrswNPjK3nD22OtUl9vsbl1Vd9kvNQA9QymZ7ikm5zMr7PoZ6gb02kK4 GWpQJlzgvpP43MDUeN4P5fDtyFJa/Po= X-MC-Unique: L-JmnSoFMQSy061Ll-tGkQ-1 X-Mimecast-MFC-AGG-ID: L-JmnSoFMQSy061Ll-tGkQ_1762204026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204025; x=1762808825; 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=qjs+hEnyEnb+x771M+p8O7Iiqf1MdREZ/cqrEg0Ze3c=; b=rM1v/Yp//ChuuHVd5jgey8hv5azcGnb8GuGr9LplGhFOXtsf1njBNul0bF5VHZ3d0F sYFVggAeZ4k68GAk3JTZNzZrWBgIu4W85YiO7/YJHyhzdL7Ay/PeLGeBaoMfO3q+WMUs KY0bx85r9b3L3GHYiwhn63IMD+sWNuzoVmaF7AhqUB8CqR9hJeX0sDzhxqQzeAdJJXLe YN8lLg4vmbPztTS8ffVDZYgXC1Tu/8R6CuyghpO2A5NhVgdDRYgB/Vv+l2NIpNJuSVvQ FlcF8XYrU/mN/il+tTuHxDfBa1fF3sV4OJGD+gxTy6r0XSWdPyQk1P0HDWjF9RO5oVUp 0uKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204025; x=1762808825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qjs+hEnyEnb+x771M+p8O7Iiqf1MdREZ/cqrEg0Ze3c=; b=s6oMWHaNKLd3KQjk303juggsR6GpXkflnb1xzUXgqLXaMm7Jc1m+UdS9AiB+4wLVNd FGgbIF7jblekqqcRyhlgmfls/zdZpwxxxxNRHuOONk0h6/fHVf/6qmWqEI3LH4Z5C1+y 5HtvdBhPrYO62fCFwvZkdtJSJ8dMcJ7v6vp9pOWTAkDPdLn68DW1FZnu7L8FvgxceX+i VhPFmqjJXxUYM36kpORm6b1ZHJt2zfnBUzSr60i2z/fp1XpNkxXXhW6QCm/n40/W76P3 e79byGuDntJ6Fpb44o1Ap+L41rbIXHw8azAji2eVHK3u7nkUgrzJ+NQMpvnDT2YEGQe1 FAIQ== X-Gm-Message-State: AOJu0YzbQv8hOOLAzT+55rX0y8FnHT+yobDwW9wu9EVinu6e6+7RzBkE HQAiIBpyA54LJWisJXYNatJzTeExzKYg3g2LlysuGCkvlFL0we7/Vywv6Egd4sD53IYgfX198Fi NTOWRINfWKghASZ3WQTk+59iSS+4D+JbLp1Ki8eBw4Zo1qd+dicrdjDB6XI+ajblKKwehBEikf7 QVvMq4xhusqwyhhyS5UB0kANK6i+iOsC/97HWqZQ== X-Gm-Gg: ASbGncvKFvKRTSiGpEQYWMLPyhoGyMU/1I9GAV/R/oBQhbYZX2U4wJscpYZMmtEjye+ uRW35/PFm49mTv55u9CDYJU/T+u9Mr/7rctG422rInKgeIDO61u0qPQz6Y2yrTzpL9WhMYAZ5Un Jw/BeY5CHl4XKpnyhcHpg14BPh7RRo2OOBm5bDk8mCbTgpJFaApcbxvP54tUtkQ4N+t0PtOUGCT ZU16Q5k++6igkAJg3c0ix4UxQxNUhBbL/lbWD29/jKPOo+FkA1i+2R8tFRfX5tz7G9P+Ll3Oj94 Um5HrzD7u33qIHeVAQPlTJ+oNbc6U0oOAGJOTYZn6al7OrNlAkO0RdI0l+zGHKzY X-Received: by 2002:a05:620a:3711:b0:892:a71a:c02 with SMTP id af79cd13be357-8ab996871f5mr1472833585a.23.1762204024566; Mon, 03 Nov 2025 13:07:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2DNORKh+D6fj5bCQNbH0VK/kcT72jodWjKMJxVMMUel5HH8fv3WT8euZbwxvU/HidusnHfw== X-Received: by 2002:a05:620a:3711:b0:892:a71a:c02 with SMTP id af79cd13be357-8ab996871f5mr1472828185a.23.1762204023928; Mon, 03 Nov 2025 13:07:03 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Vladimir Sementsov-Ogievskiy Subject: [PULL 25/36] migration/vmstate: stop reporting error number for new _errp APIs Date: Mon, 3 Nov 2025 16:06:14 -0500 Message-ID: <20251103210625.3689448-26-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_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: 1762204090196158501 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy The handlers .pre_load_errp, .post_load_errp and .pre_save_errp should put all needed information into errp, we should not append error number here. Note, that there are some more error messages with numeric error codes in this file. We leave them for another day, our current goal is to prepare for the following commit, which will update interface of _errp() APIs. Signed-off-by: Vladimir Sementsov-Ogievskiy Link: https://lore.kernel.org/r/20251028170926.77219-1-vsementsov@yandex-te= am.ru Signed-off-by: Peter Xu --- migration/vmstate.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index fd066f910e..677e56c84a 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -157,9 +157,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, ret =3D vmsd->pre_load_errp(opaque, errp); if (ret < 0) { error_prepend(errp, "pre load hook failed for: '%s', " - "version_id: %d, minimum version_id: %d, " - "ret: %d: ", vmsd->name, vmsd->version_id, - vmsd->minimum_version_id, ret); + "version_id: %d, minimum version_id: %d: ", + vmsd->name, vmsd->version_id, + vmsd->minimum_version_id); return ret; } } else if (vmsd->pre_load) { @@ -259,8 +259,8 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, ret =3D vmsd->post_load_errp(opaque, version_id, errp); if (ret < 0) { error_prepend(errp, "post load hook failed for: %s, version_id= : " - "%d, minimum_version: %d, ret: %d: ", vmsd->name, - vmsd->version_id, vmsd->minimum_version_id, ret); + "%d, minimum_version: %d: ", vmsd->name, + vmsd->version_id, vmsd->minimum_version_id); } } else if (vmsd->post_load) { ret =3D vmsd->post_load(opaque, version_id); @@ -441,8 +441,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, ret =3D vmsd->pre_save_errp(opaque, errp); trace_vmstate_save_state_pre_save_res(vmsd->name, ret); if (ret < 0) { - error_prepend(errp, "pre-save for %s failed, ret: %d: ", - vmsd->name, ret); + error_prepend(errp, "pre-save for %s failed: ", vmsd->name); return ret; } } else if (vmsd->pre_save) { --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204164; cv=none; d=zohomail.com; s=zohoarc; b=U3jNatSKf7EIsNvWQAe/QjR6V4kH7pv7wXNpz4PxqBiFPuLy9FSj188H2+MXPYEnL0hGOI1u9QekF86cl+SdPcfv7hXaJLz+N0UaGbqf4CH6IlWPNA8zbUotFHD+gSQNTEDLVauq9FHDn0ewJp+h+OcTaE8H6sFaFGs16C4zIv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204164; 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=anCfRgq4fY1GZ9xyeHtt3Q7FEvb9Q1pOwKBw9dmSJoQ=; b=nTUbA5uyGpYVKthdIuYX3BX8hvcI3Wsm3YNqY9LM6LdQ3qc0qKP7hP6MZ19PYSMnzsJarKgHrMdeyVLfDaMEfRJ5cSjYMaEDvnpXqwLe/UhtprYjYGbA6x7Birh47xGvaJyaLjor700SXW++Rg+1S6KLFZHm+AzqBZkF85wZ6Ow= 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 1762204164786257.0465130080901; Mon, 3 Nov 2025 13:09:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1ly-00016V-Q5; Mon, 03 Nov 2025 16:07: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 1vG1lv-00014u-4l for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1lf-0005QS-DH for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:26 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-532-KyOofikrPdqjqplr-xkWkg-1; Mon, 03 Nov 2025 16:07:08 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4eb7853480dso142643341cf.0 for ; Mon, 03 Nov 2025 13:07:08 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204030; 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=anCfRgq4fY1GZ9xyeHtt3Q7FEvb9Q1pOwKBw9dmSJoQ=; b=MPQfdc5eU7ImXNF0JPLREA6xx65OnHVfPVZ+bQM4RdKRbkB5Akuch45WxqxIHlnMT1IdMa U5rzwIqLzyJ0IgTFzyY3QVKiloPJzmrdIsAzV85g9allbumTMnUwThH6Ir3ZYFCkwhQ7cH ulMzmp5XEAIUW48AaUGgAgnqvRQRnBg= X-MC-Unique: KyOofikrPdqjqplr-xkWkg-1 X-Mimecast-MFC-AGG-ID: KyOofikrPdqjqplr-xkWkg_1762204028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204028; x=1762808828; 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=anCfRgq4fY1GZ9xyeHtt3Q7FEvb9Q1pOwKBw9dmSJoQ=; b=R4fCqfjgWqO23x/XqV6esuJFZDnNXiNo6U5BMl45tGBEE0eq/bNwoBvSEl+qiLZ3WD m3AMiSgx8BnPcY4hJ9G6mylsaSJWzmXrF/CIA5B5BBh0vH1g+9ASYWqdz3S7mlRfsTEi /aqpCnhNlnLRTJMPtjALMYN+n+E9Oh+dGMdKokbXcPIyAkAl9YaI+el+LiN/jvavKaPn xdJEd2YEyS7BIKvpHKjxcdmUCQ8rYXJMkht2uAz45oHQ1OxJDmt0w/Vdl3jw+HWZq3FJ HeH+ecbVusu2Ut8/ySBkMepPiTRzuRxCMSaC3LGbG4QcXAaFzZ6V/IC4nmZNZEzFXr8m bBKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204028; x=1762808828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=anCfRgq4fY1GZ9xyeHtt3Q7FEvb9Q1pOwKBw9dmSJoQ=; b=fBDXD1Am95YciFXQcS8mrG7MSs8kCxLOyM+aAss8wl+sWUmGYIRlh3NLDPDLTaVGnu FqGUwmQHBBvsFpX4uKSfahfwJn8d5LoGSCqAJjeIH7dWNHNG/dbHY6jdqw/sjnOOjkOz FjcuYeXrS6tz76QdMMGlH8dGTNDAqlJ83ZsB0U3VA+XsO7c8pQJHaFDEf9w0V/e5ZoD9 GB9cQ/SusdYOei2nKMWW7aKO2yCxRnVdgwzHtw98JcgXnZuiMgwvMaEbuX/hKUeM9pq+ HV9dQnuOn/K1de4neETQi81q1qdQxy/KIvZKPaFPFk7MG+v072q0ixMsKCraHp6UGZbL SkGg== X-Gm-Message-State: AOJu0YyOwRSYkEgQ1lIT3o1HLyvLJhkE/6TnPERe+wf3Si2BU1/MqFBX UpwyMkiix7eRQc0Fvj8UMQzK1uMBPNaejcSPjIFR2SVOO2/GHf5QOnWSFo8roAeqzScHBUmOiQU 4CfVAbVdPCNjf2Wr+CTpC4S5E/wWdaJAMRAZpyBA916iAnwcDCmLEiZ9timxUNYT0zhg18LYyXB G58UIMTIdSPBty41vTYY8Tfk3DPxJ990j8xNqDag== X-Gm-Gg: ASbGncvr61V1I6u4Noc+y0lzRA19V9iVF0lcyLJZkb104FQ8WE2g1gD0jEWAvQ2vjZ7 dlnp0QpoDJDS72WuiPKqvUA4INd187s8Z3bK0G5F0fHGvkEWjkRTY5YrSKgRzn54zglDM53on9V YJO55d7cIhx8a5HA4FFafK/fktk13kmZRuWMxvkQ6ENp7GbWSiW1SGyb2yDLU2HHtgK+RnzXgoz DrkJRYsFkkqMzSu/fAnJz8BngUeY42jTooaoZsy9CQ9fA5dB0JY2+h+UGifU4qkOt2sR/NTCTlh eJ2Cv13o8dUuU1Ti1V/wAV12YuqAiIhWdFXZgq9e4Eu2z+v1DZcS9o239+L2mnWX X-Received: by 2002:ac8:5941:0:b0:4b7:ad88:45f9 with SMTP id d75a77b69052e-4ed30d923eemr167865031cf.7.1762204026863; Mon, 03 Nov 2025 13:07:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFajemzavcqGNoDyJ+0rIu5BmKOncZwEnivsMn39JpffSkjto2VPslZvjLeWD3SAWSsVKnrfw== X-Received: by 2002:ac8:5941:0:b0:4b7:ad88:45f9 with SMTP id d75a77b69052e-4ed30d923eemr167863361cf.7.1762204025049; Mon, 03 Nov 2025 13:07:05 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Vladimir Sementsov-Ogievskiy Subject: [PULL 26/36] migration: vmsd errp handlers: return bool Date: Mon, 3 Nov 2025 16:06:15 -0500 Message-ID: <20251103210625.3689448-27-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204182632158500 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy No code actually depend on specific errno values returned by vmstate_load_state. The only use of it is to check for success, and sometimes inject numeric error values into error messages in migration code. The latter is not a stopper for gradual conversion to "errp + bool return value" APIs. Big analysis of vmstate_load_state() callers, showing that specific errno values are not actually used, is done by Peter here: https://lore.kernel.org/qemu-devel/aQDdRn8t0B8oE3gf@x1.local/ Converting of vmstate_load_state() itself will follow in another series. Signed-off-by: Vladimir Sementsov-Ogievskiy Link: https://lore.kernel.org/r/20251028170926.77219-2-vsementsov@yandex-te= am.ru Signed-off-by: Peter Xu --- docs/devel/migration/main.rst | 6 +++--- include/migration/vmstate.h | 6 +++--- backends/tpm/tpm_emulator.c | 10 ++++------ migration/vmstate.c | 11 +++++------ 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst index 1afe7b9689..234d280249 100644 --- a/docs/devel/migration/main.rst +++ b/docs/devel/migration/main.rst @@ -446,15 +446,15 @@ The functions to do that are inside a vmstate definit= ion, and are called: =20 Following are the errp variants of these functions. =20 -- ``int (*pre_load_errp)(void *opaque, Error **errp);`` +- ``bool (*pre_load_errp)(void *opaque, Error **errp);`` =20 This function is called before we load the state of one device. =20 -- ``int (*post_load_errp)(void *opaque, int version_id, Error **errp);`` +- ``bool (*post_load_errp)(void *opaque, int version_id, Error **errp);`` =20 This function is called after we load the state of one device. =20 -- ``int (*pre_save_errp)(void *opaque, Error **errp);`` +- ``bool (*pre_save_errp)(void *opaque, Error **errp);`` =20 This function is called before we save the state of one device. =20 diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 09f1eefcfb..df57e6550a 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -218,11 +218,11 @@ struct VMStateDescription { int minimum_version_id; MigrationPriority priority; int (*pre_load)(void *opaque); - int (*pre_load_errp)(void *opaque, Error **errp); + bool (*pre_load_errp)(void *opaque, Error **errp); int (*post_load)(void *opaque, int version_id); - int (*post_load_errp)(void *opaque, int version_id, Error **errp); + bool (*post_load_errp)(void *opaque, int version_id, Error **errp); int (*pre_save)(void *opaque); - int (*pre_save_errp)(void *opaque, Error **errp); + bool (*pre_save_errp)(void *opaque, Error **errp); int (*post_save)(void *opaque); bool (*needed)(void *opaque); bool (*dev_unplug_pending)(void *opaque); diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index da9c1056ed..f10b9074fb 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -962,24 +962,22 @@ static void tpm_emulator_vm_state_change(void *opaque= , bool running, =20 /* * Load the TPM state blobs into the TPM. - * - * Returns negative errno codes in case of error. */ -static int tpm_emulator_post_load(void *opaque, int version_id, Error **er= rp) +static bool tpm_emulator_post_load(void *opaque, int version_id, Error **e= rrp) { TPMBackend *tb =3D opaque; int ret; =20 ret =3D tpm_emulator_set_state_blobs(tb, errp); if (ret < 0) { - return ret; + return false; } =20 if (tpm_emulator_startup_tpm_resume(tb, 0, true, errp) < 0) { - return -EIO; + return false; } =20 - return 0; + return true; } =20 static const VMStateDescription vmstate_tpm_emulator =3D { diff --git a/migration/vmstate.c b/migration/vmstate.c index 677e56c84a..4d28364f7b 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -154,13 +154,12 @@ int vmstate_load_state(QEMUFile *f, const VMStateDesc= ription *vmsd, return -EINVAL; } if (vmsd->pre_load_errp) { - ret =3D vmsd->pre_load_errp(opaque, errp); - if (ret < 0) { + if (!vmsd->pre_load_errp(opaque, errp)) { error_prepend(errp, "pre load hook failed for: '%s', " "version_id: %d, minimum version_id: %d: ", vmsd->name, vmsd->version_id, vmsd->minimum_version_id); - return ret; + return -EINVAL; } } else if (vmsd->pre_load) { ret =3D vmsd->pre_load(opaque); @@ -256,11 +255,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDesc= ription *vmsd, return ret; } if (vmsd->post_load_errp) { - ret =3D vmsd->post_load_errp(opaque, version_id, errp); - if (ret < 0) { + if (!vmsd->post_load_errp(opaque, version_id, errp)) { error_prepend(errp, "post load hook failed for: %s, version_id= : " "%d, minimum_version: %d: ", vmsd->name, vmsd->version_id, vmsd->minimum_version_id); + ret =3D -EINVAL; } } else if (vmsd->post_load) { ret =3D vmsd->post_load(opaque, version_id); @@ -438,7 +437,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, trace_vmstate_save_state_top(vmsd->name); =20 if (vmsd->pre_save_errp) { - ret =3D vmsd->pre_save_errp(opaque, errp); + ret =3D vmsd->pre_save_errp(opaque, errp) ? 0 : -EINVAL; trace_vmstate_save_state_pre_save_res(vmsd->name, ret); if (ret < 0) { error_prepend(errp, "pre-save for %s failed: ", vmsd->name); --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204353; cv=none; d=zohomail.com; s=zohoarc; b=ldU4VMpXTOx7oJWGfP/dnyWvFM12xU5esNoRyYiPQiocEHl5DoV0dj+hCsYPPdaBrSW8fHjEnOavcvcEJUfjqb/DkC+kfmDPOyHG5vGMXxBuHMCYw3gn/lkYi2BaaW/+IhJhuOsOMexhfYYGb0TV9goznOyt4JfMgMNyWsLc298= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204353; 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=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=hwX9C0tP/7gGsyStbtD/28gMsfxnFuT7IxMFoaf8X6Ip4Q7F7meZ1CN5aO59EufEfbg01EYIPM3yMnPXIdDxsaEmgE0VSqrnlegmP8lGLtuDK05jrYvayRe6Ob1cYCiPTaAJEbn3ds8goUkgnZTaP+quy/BLT6T6iT3ELsWOsaE= 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 1762204353117837.1544127159341; Mon, 3 Nov 2025 13:12:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m0-00017I-VC; Mon, 03 Nov 2025 16:07: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 1vG1ly-00016J-0r for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:30 -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 1vG1lf-0005QL-M0 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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-231--Ic1oF0CPEewRklV47pLsg-1; Mon, 03 Nov 2025 16:07:08 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8a4ef35cc93so1433974285a.3 for ; Mon, 03 Nov 2025 13:07:08 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204029; 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=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=LoPzSRocOYN5LmE7/hj+3XKTfO6l6LqiJ7P/6ZD5ruITksMzSUPAoF32nzIHT77SwgOwB6 8M61pYRZ41S/M2jA4EE/XTu4LB56NdTSObmWp7Ee25+uW9TrDUIwR4Ic0aKZDD/101hCvU lDhOwHub6D8dGVwX56jbS6aCLYYNHtU= X-MC-Unique: -Ic1oF0CPEewRklV47pLsg-1 X-Mimecast-MFC-AGG-ID: -Ic1oF0CPEewRklV47pLsg_1762204028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204027; x=1762808827; 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=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=Vyt6ZzyauLVYn2XDT8V0VsSvqWiRn0lyuF2TQc/rYtCWcVQD8khyIumdGzjl/ZkpAc XpB4VXFGESCfJ0cImI8xLaYhUQkVOKE1xYSmMumZ5tw7/e1yZl0BkUVKX1rmPj9zIjeh nTuin34EJ9yNwm7bT3pmtDKvBRwb354F2sOqrIiU4ySve0xu8jleF4bJ91Ock+n51pxQ 03EuKQgwv3FRfZv8bAwnYCkxdf6gIgp0lzWlZ3u8FTkGpQJdfLyZCXxHy4RFjK+bAAaG 27+BwHvfJVCqhWIpdYiYSsyLZEUPEEzyIov58tmqA+STmqf/1ujNMZiyDedcfQ1DTHVL NvrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204027; x=1762808827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=Qy2BSFtmC10X2DlYslbe3qcBCDtR+EiR19/GSPvFvNCbbRWYWHLbtNzOQLux3PWKzh HW7VUEHCtvvlB4/l8JQg/rPrbYNjLzwKKLFyK6Q6rUl+G7TeuZ1tmKlmRPt5uwRhKX31 nd2qkYakdf2N6bYh65j2EE2/uqqS7+mXJ665DhfEVEXQvCDvsroKWIHjYajGMZl0blK0 0RQ4BEGsP4Pd/YOuBVwWA5TdVPuDCyXubygsIpMD8xuFOhyGwIIIzXEClO28VPX0fHJr WnsaoAGy1AzTxeTAol3R5cZLVU7iDHwcLp6d1iM/BPslWGF14ZvxNvT+0mdD/q0QLQgu gC/Q== X-Gm-Message-State: AOJu0YxuouKDNgdswltp+wFqtCQ6Uqdcgy7r2lQC0/vckrbq95X5/GTd kMRz0q8zDzJQREKUYn1ApFxPFze5+ci2wyNd+6aKTNxnRHs+V2zLMM2ZfX2jcJnCdT9R2ZYE78H vi9w5F5Q1yvkfG3qdKx43mNW2teIG1cBZ3xorFwHnscj1qQt/SErDNce6B9FEtN3QHkq0JDb/UJ hRJ4hOYx22rYT3spfzbGnsdO9pLI/2nnHv1yffEg== X-Gm-Gg: ASbGncupe00GXmvNevY4TW231908SUpdnbjOpcfrOVugRnCpozvCJJgllma2ev6zbzg UexpA01ZTwgT7UJpIhIVyX+epRy3sni5oMKy7+ew+sDjP38I4oEamZap1PBwpEczs3rRGvlq7IU ohdtbqTVfpw6bTuIu1asF8WD1sVaDxPdKJsNgJyoII4avDN4BzEJt7CHnTVhQL5/ngbOadgj71/ crCltzoQjIJVX277Bf04mkrIAoATPm7XYduO4jxu8Ep9OvvKt3zUB+JtsH5H0fy3r/DODgC0JSc bVDQU/11Y9SndthcRJ771V6jMnNnSwgZkHwM3rmWu+GdMEa+kkfGYHGjWkLPwuzS X-Received: by 2002:a05:620a:4694:b0:89f:b32b:3416 with SMTP id af79cd13be357-8ab9abf941cmr1703194185a.75.1762204027133; Mon, 03 Nov 2025 13:07:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+UgFrud1VaU0z/9ZTengAcyb7EDZAiY2Z8Gat5ulsky5QroJbDs0wKWFeL7aHoXfJt4Tt+g== X-Received: by 2002:a05:620a:4694:b0:89f:b32b:3416 with SMTP id af79cd13be357-8ab9abf941cmr1703188685a.75.1762204026408; Mon, 03 Nov 2025 13:07:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 27/36] scripts/vmstate-static-checker: Fix deprecation warnings with latest argparse Date: Mon, 3 Nov 2025 16:06:16 -0500 Message-ID: <20251103210625.3689448-28-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204354360154100 From: Thomas Huth The argparse.FileType() type has been deprecated in the latest argparse version (e.g. the one from Fedora 43), now causing the test_bad_vmstate functional test to fail since there are unexpected strings in the output. Change the script to use pathlib.Path instead to fix the test_bad_vmstate test and to be prepared for the future when the deprecated FileType gets removed completely. Reported-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Link: https://lore.kernel.org/r/20251030092638.39505-1-thuth@redhat.com Signed-off-by: Peter Xu --- scripts/vmstate-static-checker.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-che= cker.py index 2335e25f94..89b100e6cc 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -21,6 +21,7 @@ =20 import argparse import json +import pathlib import sys =20 # Count the number of errors found @@ -382,10 +383,10 @@ def main(): help_text =3D "Parse JSON-formatted vmstate dumps from QEMU in files S= RC and DEST. Checks whether migration from SRC to DEST QEMU versions would= break based on the VMSTATE information contained within the JSON outputs. = The JSON output is created from a QEMU invocation with the -dump-vmstate p= arameter and a filename argument to it. Other parameters to QEMU do not ma= tter, except the -M (machine type) parameter." =20 parser =3D argparse.ArgumentParser(description=3Dhelp_text) - parser.add_argument('-s', '--src', type=3Dargparse.FileType('r'), + parser.add_argument('-s', '--src', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from src qemu') - parser.add_argument('-d', '--dest', type=3Dargparse.FileType('r'), + parser.add_argument('-d', '--dest', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from dest qemu') parser.add_argument('--reverse', required=3DFalse, default=3DFalse, @@ -393,10 +394,10 @@ def main(): help=3D'reverse the direction') args =3D parser.parse_args() =20 - src_data =3D json.load(args.src) - dest_data =3D json.load(args.dest) - args.src.close() - args.dest.close() + with open(args.src, 'r', encoding=3D'utf-8') as src_fh: + src_data =3D json.load(src_fh) + with open(args.dest, 'r', encoding=3D'utf-8') as dst_fh: + dest_data =3D json.load(dst_fh) =20 if args.reverse: temp =3D src_data --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204157; cv=none; d=zohomail.com; s=zohoarc; b=QgIWuL6WTNgMQAqDITzWIgAXG23liIQ/PnKSpTCpQa8IH9UbL77jMYGONFQFoW0u17BfRi32YcVSDNimcAtXKaPlj/jNy/9ctRtCRlorQ0IQ2xvy3Eh9zdERWn4X2uGXArdy2noSxAqtpR4uSQDfAFHlL9L7wn+bTDwOp9UQ1yQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204157; 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=Q+uG4ao1eGrbOCPJUjKk7ZwyE5IKgltoWEzfBrxdGb8=; b=hqJBq0469mEqT4VRTQUTNK0gUp8+9kYesA4lyGXYHOyju8szU9MpBoaRUzC7npH9NePNCABzeNxnEN75VGaetEi9HbjfxinSFzHBcUEEN9lOM+StYYbkxwBYV+BTtbin5xzTzTs+eqJHbCqUxkC2Jr57rWWzQPjkwEVOJjzT8E8= 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 1762204157346940.217021461061; Mon, 3 Nov 2025 13:09:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m1-00017L-LH; Mon, 03 Nov 2025 16:07:33 -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 1vG1lw-00015T-VM for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1lg-0005Qi-GG for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:28 -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-116-RRIxX-4nOeOXE_RufBQYhg-1; Mon, 03 Nov 2025 16:07:09 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8a9b1fa8092so1332915785a.2 for ; Mon, 03 Nov 2025 13:07:09 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204030; 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=Q+uG4ao1eGrbOCPJUjKk7ZwyE5IKgltoWEzfBrxdGb8=; b=FcVoakWsmC+X1LGZeXXoPwIBasKtNqAMa00g296C0gqj86jBwMblfZSBI2SusaOGERxiFS UCv8E4qF0G2+LwkaaE7rbTaumbaYKtjM+0ZVppodxmbQLeIPrWN4lqYhm597eY03ba24fK w09lmf2WbFPYP9HT68Q6lUsZEyXhWMQ= X-MC-Unique: RRIxX-4nOeOXE_RufBQYhg-1 X-Mimecast-MFC-AGG-ID: RRIxX-4nOeOXE_RufBQYhg_1762204029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204028; x=1762808828; 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=Q+uG4ao1eGrbOCPJUjKk7ZwyE5IKgltoWEzfBrxdGb8=; b=RQgBbq+VfwFWFOOCk0DK8blZmbNvf3Kb38urYVL7b6Z5caJlJvWHX8M7zHHx+SIRtb ovaBiia0HeTF906B+ELxxPohKo44FSXw4dzCY4HN2x6oocsejjqwGoTYe9pOlZhRXJ/U CnbRV4j6QbyP7/s0SJN/A/MAsT3Zp/U8cudP1WVmrTs+Q+clDmw0kcvu+PkGFe7Lym0f XDbXQjZjpcRb1LhS2A2NvsqqzEFBekDw3Zf52IG8m2t/MruPG0Dyy5g31BgouMP/UWe2 lFEwVPzlbTJ1R5LjKsVeEEOqLD28S4JtbTtPWvW3TzOfw1UrzOscOXqLARM/pqKTqN0i Vr5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204028; x=1762808828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q+uG4ao1eGrbOCPJUjKk7ZwyE5IKgltoWEzfBrxdGb8=; b=Pc0cnUazrFJcNOwLVDx3nm4IMSYvz3NX4IH+PSUwHnpujKl/fPyMS+4259ycD+j68W YJE/q624s/rSzem/rNZA0XNRP3lOay8gSR38wQXLrL5r71T2wKCtPyIQR+gOQyaSVmQl UGMheK1wB3WulibFQRZaFR/T6XcfN2l9ABnpxMslYzBzSkzurZlfCLbgP5G/WJCP0qfB GEFeK5Y8FztVcYkH2scnL2MOSAvYznXOBurQNWuQ52csdNl4obIdXlzTuqbFlnK4BWiX O0QnzYyAjCBFAjXx1GfAKceg2jXustHSuhbXgwMHVbo7XQIri9Qfi3+C9Z1/f2mGp/Ax ozmw== X-Gm-Message-State: AOJu0YwJVzslp0SLZ4r8fPGgD3zGjTtjgJqv9bHeB4kA1mKgxMs/wGIJ tk/TlArtOdgPC31J5g7DnZfqfpFmrxnxz+Qs54BUGCFgt6ldIKp0YekWsJDI+6iqhB73au+oa+1 x0q2vHH2ls76cWWyHZOdeccStHZ1NB9v4sxz6YRXWga+fdnL9eyOiv/iLUIXTYLxn8MK9RnYK7p VVqEGC799XS3vTu9y8zzQkseRsdbL92DT0dCyQFg== X-Gm-Gg: ASbGnct+uaIYD/6Ai/mvBl2/YAuMXaGdq2cT9Fo4ksrDIsOXJD+3P1y7gO/zwuOIlUN IlAf9hO5Qj15BovZUUkDri+OKWhBl0bqB6a5VuteSIlvivpMk27d3tjhX3BHfyUCnmvThzsvLgt o13ZIElBWLk274oRRjkuQe6jH8HDdGCsGoyf0NoSq9JfJyHKm5LBeqKZZijfjmD9+o32vAOyl7t 1QA7tdR2wEiwWCcVjDpMRrhJSE/FF6VyeW54aJrpcQcZhgIHpNm+/rXDZSjwGD0BqNFwXQWzcFD u925qxTB0N0pLw6z/Luvp2KLOH86umfXekhFI/ECw3MmGvgmfXiS/pw9gGrtZG/u X-Received: by 2002:a05:620a:4445:b0:84f:110c:b6e8 with SMTP id af79cd13be357-8ab9b3acc1dmr1675278685a.68.1762204028243; Mon, 03 Nov 2025 13:07:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlh6Wgw0MmE1vbQPt3vCdVXWfaLuaOuGuj3JOHizMJKFIWHGR0aGjC5kWzOFCtxVLJGcvb3A== X-Received: by 2002:a05:620a:4445:b0:84f:110c:b6e8 with SMTP id af79cd13be357-8ab9b3acc1dmr1675272585a.68.1762204027635; Mon, 03 Nov 2025 13:07:07 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Stefan Hajnoczi , Peixiu Hou , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 28/36] system/physmem: mark io_mem_unassigned lockless Date: Mon, 3 Nov 2025 16:06:17 -0500 Message-ID: <20251103210625.3689448-29-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, WEIRD_PORT=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: 1762204164387158500 From: Stefan Hajnoczi When the Bus Master bit is disabled in a PCI device's Command Register, the device's DMA address space becomes unassigned memory (i.e. the io_mem_unassigned MemoryRegion). This can lead to deadlocks with IOThreads since io_mem_unassigned accesses attempt to acquire the Big QEMU Lock (BQL). For example, virtio-pci devices deadlock in virtio_write_config() -> virtio_pci_stop_ioeventfd() when waiting for the IOThread while holding the BQL. The IOThread is unable to acquire the BQL but the vcpu thread won't release the BQL while waiting for the IOThread. io_mem_unassigned is trivially thread-safe since it has no state, it simply rejects all load/store accesses. Therefore it is safe to enable lockless I/O on io_mem_unassigned to eliminate this deadlock. Here is the backtrace described above: Thread 9 (Thread 0x7fccfcdff6c0 (LWP 247832) "CPU 4/KVM"): #0 0x00007fcd11529d46 in ppoll () from target:/lib64/libc.so.6 #1 0x000056468a1a9bad in ppoll (__fds=3D, __nfds=3D, __timeout=3D0x0, __ss=3D0x0) at /usr/include/bits/poll2.h:88 #2 0x000056468a18f9d9 in fdmon_poll_wait (ctx=3D0x5646c6a1dc30, ready_li= st=3D0x7fccfcdfb310, timeout=3D-1) at ../util/fdmon-poll.c:79 #3 0x000056468a18f14f in aio_poll (ctx=3D, blocking=3Dblo= cking@entry=3Dtrue) at ../util/aio-posix.c:730 #4 0x000056468a1ad842 in aio_wait_bh_oneshot (ctx=3D, cb= =3Dcb@entry=3D0x564689faa420 , opaque=3D) at ../util/aio-wait.c:85 #5 0x0000564689faaa89 in virtio_blk_stop_ioeventfd (vdev=3D0x5646c8fd7e9= 0) at ../hw/block/virtio-blk.c:1644 #6 0x0000564689d77880 in virtio_bus_stop_ioeventfd (bus=3Dbus@entry=3D0x= 5646c8fd7e08) at ../hw/virtio/virtio-bus.c:264 #7 0x0000564689d780db in virtio_bus_stop_ioeventfd (bus=3Dbus@entry=3D0x= 5646c8fd7e08) at ../hw/virtio/virtio-bus.c:256 #8 0x0000564689d7d98a in virtio_pci_stop_ioeventfd (proxy=3D0x5646c8fcf8= e0) at ../hw/virtio/virtio-pci.c:413 #9 virtio_write_config (pci_dev=3D0x5646c8fcf8e0, address=3D4, val=3D, len=3D) at ../hw/virtio/virtio-pci.c:803 #10 0x0000564689dcb45a in memory_region_write_accessor (mr=3Dmr@entry=3D0= x5646c6dc2d30, addr=3D3145732, value=3Dvalue@entry=3D0x7fccfcdfb528, size= =3Dsize@entry=3D2, shift=3D, mask=3Dmask@entry=3D65535, attr= s=3D...) at ../system/memory.c:491 #11 0x0000564689dcaeb0 in access_with_adjusted_size (addr=3Daddr@entry=3D= 3145732, value=3Dvalue@entry=3D0x7fccfcdfb528, size=3Dsize@entry=3D2, acces= s_size_min=3D, access_size_max=3D, access_fn= =3D0x564689dcb3f0 , mr=3D0x5646c6dc2d30, attr= s=3D...) at ../system/memory.c:567 #12 0x0000564689dcb156 in memory_region_dispatch_write (mr=3Dmr@entry=3D0= x5646c6dc2d30, addr=3Daddr@entry=3D3145732, data=3D, op=3D, attrs=3Dattrs@entry=3D...) at ../system/memory.c:1554 #13 0x0000564689dd389a in flatview_write_continue_step (attrs=3D..., attr= s@entry=3D..., buf=3Dbuf@entry=3D0x7fcd05b87028 "", mr_addr=3D3145732, l=3D= l@entry=3D0x7fccfcdfb5f0, mr=3D0x5646c6dc2d30, len=3D2) at ../system/physme= m.c:3266 #14 0x0000564689dd3adb in flatview_write_continue (fv=3D0x7fcadc0d8930, a= ddr=3D3761242116, attrs=3D..., ptr=3D0xe0300004, len=3D2, mr_addr=3D, l=3D, mr=3D) at ../system/physmem.c= :3296 #15 flatview_write (fv=3D0x7fcadc0d8930, addr=3Daddr@entry=3D3761242116, = attrs=3Dattrs@entry=3D..., buf=3Dbuf@entry=3D0x7fcd05b87028, len=3Dlen@entr= y=3D2) at ../system/physmem.c:3327 #16 0x0000564689dd7191 in address_space_write (as=3D0x56468b433600 , addr=3D3761242116, attrs=3D..., buf=3D0x7fcd05b87028, len= =3D2) at ../system/physmem.c:3447 #17 address_space_rw (as=3D0x56468b433600 , addr=3D= 3761242116, attrs=3Dattrs@entry=3D..., buf=3Dbuf@entry=3D0x7fcd05b87028, le= n=3D2, is_write=3D) at ../system/physmem.c:3457 #18 0x0000564689ff1ef6 in kvm_cpu_exec (cpu=3Dcpu@entry=3D0x5646c6dab810)= at ../accel/kvm/kvm-all.c:3248 #19 0x0000564689ff32f5 in kvm_vcpu_thread_fn (arg=3Darg@entry=3D0x5646c6d= ab810) at ../accel/kvm/kvm-accel-ops.c:53 #20 0x000056468a19225c in qemu_thread_start (args=3D0x5646c6db6190) at ..= /util/qemu-thread-posix.c:393 #21 0x00007fcd114c5b68 in start_thread () from target:/lib64/libc.so.6 #22 0x00007fcd115364e4 in clone () from target:/lib64/libc.so.6 Thread 3 (Thread 0x7fcd0503a6c0 (LWP 247825) "IO iothread1"): #0 0x00007fcd114c2d30 in __lll_lock_wait () from target:/lib64/libc.so.6 #1 0x00007fcd114c8fe2 in pthread_mutex_lock@@GLIBC_2.2.5 () from target:= /lib64/libc.so.6 #2 0x000056468a192538 in qemu_mutex_lock_impl (mutex=3D0x56468b432e60 , file=3D0x56468a1e26a5 "../system/physmem.c", line=3D3198) at ../util/q= emu-thread-posix.c:94 #3 0x0000564689dc12e2 in bql_lock_impl (file=3Dfile@entry=3D0x56468a1e26= a5 "../system/physmem.c", line=3Dline@entry=3D3198) at ../system/cpus.c:566 #4 0x0000564689ddc151 in prepare_mmio_access (mr=3D0x56468b433800 ) at ../system/physmem.c:3198 #5 address_space_lduw_internal_cached_slow (cache=3D, add= r=3D2, attrs=3D..., result=3D0x0, endian=3DDEVICE_LITTLE_ENDIAN) at ../syst= em/memory_ldst.c.inc:211 #6 address_space_lduw_le_cached_slow (cache=3D, addr=3Dad= dr@entry=3D2, attrs=3Dattrs@entry=3D..., result=3Dresult@entry=3D0x0) at ..= /system/memory_ldst.c.inc:253 #7 0x0000564689fd692c in address_space_lduw_le_cached (result=3D0x0, cac= he=3D, addr=3D2, attrs=3D...) at /var/tmp/qemu/include/exec/= memory_ldst_cached.h.inc:35 #8 lduw_le_phys_cached (cache=3D, addr=3D2) at /var/tmp/q= emu/include/exec/memory_ldst_phys.h.inc:66 #9 virtio_lduw_phys_cached (vdev=3D, cache=3D, pa=3D2) at /var/tmp/qemu/include/hw/virtio/virtio-access.h:166 #10 vring_avail_idx (vq=3D0x5646c8fe2470) at ../hw/virtio/virtio.c:396 #11 virtio_queue_split_set_notification (vq=3D0x5646c8fe2470, enable=3D0)= at ../hw/virtio/virtio.c:534 #12 virtio_queue_set_notification (vq=3D0x5646c8fe2470, enable=3D0) at ..= /hw/virtio/virtio.c:595 #13 0x000056468a18e7a8 in poll_set_started (ctx=3Dctx@entry=3D0x5646c6c74= e30, ready_list=3Dready_list@entry=3D0x7fcd050366a0, started=3Dstarted@entr= y=3Dtrue) at ../util/aio-posix.c:247 #14 0x000056468a18f2bb in poll_set_started (ctx=3D0x5646c6c74e30, ready_l= ist=3D0x7fcd050366a0, started=3Dtrue) at ../util/aio-posix.c:226 #15 try_poll_mode (ctx=3D0x5646c6c74e30, ready_list=3D0x7fcd050366a0, tim= eout=3D) at ../util/aio-posix.c:612 #16 aio_poll (ctx=3D0x5646c6c74e30, blocking=3Dblocking@entry=3Dtrue) at = ../util/aio-posix.c:689 #17 0x000056468a032c26 in iothread_run (opaque=3Dopaque@entry=3D0x5646c69= f3380) at ../iothread.c:63 #18 0x000056468a19225c in qemu_thread_start (args=3D0x5646c6c75410) at ..= /util/qemu-thread-posix.c:393 #19 0x00007fcd114c5b68 in start_thread () from target:/lib64/libc.so.6 #20 0x00007fcd115364e4 in clone () from target:/lib64/libc.so.6 Buglink: https://issues.redhat.com/browse/RHEL-71933 Reported-by: Peixiu Hou Cc: Kevin Wolf Cc: Paolo Bonzini Signed-off-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20251029185224.420261-1-stefanha@redhat.com Signed-off-by: Peter Xu --- system/physmem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/physmem.c b/system/physmem.c index a7e2a5d07f..c9869e4049 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -3011,6 +3011,9 @@ static void io_mem_init(void) { memory_region_init_io(&io_mem_unassigned, NULL, &unassigned_mem_ops, N= ULL, NULL, UINT64_MAX); + + /* Trivially thread-safe since memory accesses are rejected */ + memory_region_enable_lockless_io(&io_mem_unassigned); } =20 AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204521; cv=none; d=zohomail.com; s=zohoarc; b=ncUQTSP30g5DM5OvJK8ehywydqatZVYtBdvFJ1axoONnsOinsx+78CDMsBCzb/HIbzzHPFcLAnMXIpzWirCQm+7nArIEMqxBI/NjqerNT/tG53VT4FjrHZJkjEebt0pR5xr7s7CamRm+Vk1amg0rj2gggoWMENHRyWv3i8plff8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204521; 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=oY2id3rFEVPzvrffR4IZg61aFvVc7inxMPEhQ7ItsAI=; b=XmWvcSXgsEjzBOWb497aJ0EVNwS0zlT1ckpvgrUnCLAFtR5D3aroYPcqArOURAhyMvpY5CG1eFMjOxTIDC0rHKDZZyq4g8sVDzo5DvJkj+XzmlSlRbP1YESfePzLFWfLF9nmRRRkl8kL86Mm3bGyY49kfqIt46hcwgNSrtU59vE= 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 1762204521663454.2859926910853; Mon, 3 Nov 2025 13:15:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mD-0001A8-8I; Mon, 03 Nov 2025 16:07:45 -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 1vG1mA-000192-CN for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:42 -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 1vG1lj-0005R4-3E for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:35 -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-695-aSUJGqDoPeKFvV-TIQ3UpQ-1; Mon, 03 Nov 2025 16:07:10 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8908a248048so1185751085a.0 for ; Mon, 03 Nov 2025 13:07:10 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204031; 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=oY2id3rFEVPzvrffR4IZg61aFvVc7inxMPEhQ7ItsAI=; b=La1oGigJN2PddBZ4zHXofpLGks44Z7+f09jE2uS/yvcYrk2TrtLHFnYbzTHUTOJuqWj7kl Y363us1rYBpZ8lYDafVw2MUj3U3yDFgW4bOkvQoPcsRTcdhGKapHde4V4HzsasitRJ/ukw sYUEvx5McNB5JoXBRwMf0GSObawszZ4= X-MC-Unique: aSUJGqDoPeKFvV-TIQ3UpQ-1 X-Mimecast-MFC-AGG-ID: aSUJGqDoPeKFvV-TIQ3UpQ_1762204030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204030; x=1762808830; 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=oY2id3rFEVPzvrffR4IZg61aFvVc7inxMPEhQ7ItsAI=; b=kCWPnqNK+y12OZK5IT8xlL1sGHpDxYfbDfHjcYCYTB+MY2rfMh9mD87lcGiTyCDyeM 5SI3x/blIwwDBtukIMa1p2FmIl3jrrQ+kzshgx41kCPX2Kj2SNqdvJv47JtfHkJLd15z wEIvc8oXhCCqgr2K+1i4GZ1lTokSozaenIigEM7INuNAbm95WX5CpHqscagM5aKI3885 j/yqctI8oxBweppHNsmDBf05vPor7K+/CjufYKHg+I9PdDdgvZDB/8az8Bb+rhcHSRhj 6F7D4/wqYEWCGIfWSBska+oTvfGQ5+9LUB6uqi6DxQSbArK2jB9H3yJUkFQxbXTOzLYm 3WlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204030; x=1762808830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oY2id3rFEVPzvrffR4IZg61aFvVc7inxMPEhQ7ItsAI=; b=pTa34B7/NoDjxqNYnHi5wq3ZduvcZxH0mYUGNN4tXld9FQ1/41Pp1jhd0YSWQyPscV gLB7u1sW5kXIvE0J+j/olpZ9cgK2vr4iE3bdEU+FZd7ObTBSVocQ/tdXvKJdqjjp0vgt R3CqE7hcsNpaqKBzEq99kYAT+bN/ai6HQT8MGLn7SAFZKt4WkzkNxqB1Q/NGdNhumFE6 5cmhILY8kGPTZBBG0uLAJD2vLRrb8OTovXki3zCP7RZPslBnUAmt9Ns71zsDM6zaEXkb 2lr3KsR4EWdBMcE8wY6qEil5lJCH89YJyE5faTT0pwrIEqwaa/VZYZc0LYfWUOfvg63B OQVA== X-Gm-Message-State: AOJu0Yxy4aHZvVwppsvQS7q9m8AzZtrgYrjVexU4l/JZTT1Jo8Zef3Nw GzAnvnsDDLXjQWkDmugqnYG/y2xAzP3UMQNFk/pZzKUjWp+XExPU2aedJTt7dyDT7Gn1EoDvB9f 6+Oshxqnf17LDFV4V+bxwrm618AP51oOw91xoM8gHhGtVXLmqLS962O/YakUeM1L1pFdpueHIsd IlVlGud0Rfy4AgEOz2hLD4JUdfMfBLPp0239TxAA== X-Gm-Gg: ASbGncvuNkwWSFloIy08EHUBBN1hDleQsRbAs4jCOTLaVddIUpizv7LPRwGx11We52h OLarLZLre3lrYeNS/zME+xWwlQoWkB6hZjqWbEoAq1VUgi7HBoXjHU5Z3Wh4FFR+REOSk9q52Vk LuUwDJ2lymBqi2yrGjHl8pBmWnyUQy9ZURx0hv//4vUfVwf+yLeCJjcA3CfZTnou2rg/TFb/3kh qqjD7LJEzN0EnYde8A+6bipPe+EKREAWY4DVIe7HAYF4Yi5vJDBShEIyp9lB7IJZ36Bx/Au4IyD UnQbfsXC3f4LJw/pjyYyUudysncXASkAtGqwTy4kkICVScsOxcVWbPxWLdB5PFjA X-Received: by 2002:a05:620a:1924:b0:883:b565:1acf with SMTP id af79cd13be357-8ab9b3ac76dmr1775846885a.60.1762204029359; Mon, 03 Nov 2025 13:07:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRZ6OjdfDD+TQ8XTjqLTg1SjK2wE8DkJdCLLkZQhP+lsEQY77zvMcplyzZzomB++2xOf9cog== X-Received: by 2002:a05:620a:1924:b0:883:b565:1acf with SMTP id af79cd13be357-8ab9b3ac76dmr1775840985a.60.1762204028752; Mon, 03 Nov 2025 13:07:08 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 29/36] migration: Flush migration channel after sending data of CMD_PACKAGED Date: Mon, 3 Nov 2025 16:06:18 -0500 Message-ID: <20251103210625.3689448-30-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204528888158500 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin If the length of the data sent after CMD_PACKAGED is just right, and there is not much data to send afterward, it is possible part of the CMD_PACKAGED payload will get left behind in the sending buffer. This causes the destination side to hang while it tries to load the whole package and initiate postcopy. Signed-off-by: Juraj Marcin Link: https://lore.kernel.org/r/20251103183301.3840862-2-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/savevm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/savevm.c b/migration/savevm.c index 232cae090b..fa017378db 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1142,6 +1142,7 @@ int qemu_savevm_send_packaged(QEMUFile *f, const uint= 8_t *buf, size_t len) qemu_savevm_command_send(f, MIG_CMD_PACKAGED, 4, (uint8_t *)&tmp); =20 qemu_put_buffer(f, buf, len); + qemu_fflush(f); =20 return 0; } --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204445; cv=none; d=zohomail.com; s=zohoarc; b=ehrvG2fVMP6O9vN1XLuEYC04qGK7FMNtWYvjYWO2WqqAX9WyrCfRxeZF1WF8BvYYDARgIPaEQZIuTeSLcc0MEiQ5A+hkG0HUyXimHU67eyYDKThXeXDBwBZMNJwNUL2oX/x7kth/g73PBJ8Nrdw9hILAZ29rmW79qy7jWY6e0x4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204445; 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=/7FjPA8GdfJf4kCb2i7TngezmlYaUsti3XGlUtftU7k=; b=QxAwAwitodxdC/dcApeDC/0mckY7Ic67nL07zXBprbDU9UHlJxnHcPKCpB73MEawg5EMBvZvR+pCnfJRMm/xlZ5kbFniE0tAGG2ljwyMhkBAfCwI7+GVLey6v8MX9C+0gGju1cAytky77RJr6yVb067cSK0N3/6bpxYNB/nlNTU= 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 1762204445497205.63390068338424; Mon, 3 Nov 2025 13:14:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m0-00017H-VV; Mon, 03 Nov 2025 16:07: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 1vG1lz-00016o-Mf for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:31 -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 1vG1li-0005RN-F4 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:30 -0500 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-Anv7iClrO6eiQjgWriHVWg-1; Mon, 03 Nov 2025 16:07:11 -0500 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4eceefa36d0so135203651cf.1 for ; Mon, 03 Nov 2025 13:07:11 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204032; 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=/7FjPA8GdfJf4kCb2i7TngezmlYaUsti3XGlUtftU7k=; b=M5RJUo5hQ4l6Qv7w9tcDI1WSmfnXEu+eH64xeWVx0R4gc8w13IL1i2x53MDB9Pqh097OHQ HlP5ZFAGunJiUc+6H3hOyyCwRtTKyHnJTWfeJZYmH6vlYWWnjFAAt40TgJC3/VYww/6tcb kUjCIDxwt45LdERRg9769Y26PaDu63E= X-MC-Unique: Anv7iClrO6eiQjgWriHVWg-1 X-Mimecast-MFC-AGG-ID: Anv7iClrO6eiQjgWriHVWg_1762204031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204031; x=1762808831; 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=/7FjPA8GdfJf4kCb2i7TngezmlYaUsti3XGlUtftU7k=; b=mtk+JyGZK1968tH8xtnsQhja9Ow3FIwoG6aVgpSk61BgX7PgCsXq6iB99rlUNYFXOH VD/I/JvajyJplCt1eCkbixL951+ZEcnfuyhEEXi9dvY4lW87x2gfaGx2q7wTTQ5CZ7dd fhh3ZsFnU3zbUMAc3GBxt7Tw8TpxPHA02Z1QQ0AJYOf3MmM7NKlrOYAPq7uLtjZYaXU2 /8OMz1grif0WLwiy2lAmu/QH8qewK8xO0zlMpqsyf2S4sRZzcfRLloeK/5TogBoUKVoX auFBMo+KyDypAHxFa6H+Xo4ke8cCdkGCYSWsKcIQtx5a273ihUugbXzCHTYqdl8LwpaF 9h7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204031; x=1762808831; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/7FjPA8GdfJf4kCb2i7TngezmlYaUsti3XGlUtftU7k=; b=NgClbZvciTX+iquVZgGxVfWpXcZT7kp94C4BKMn9gMyPV6MM/QSHGXydKB9V2Dz8u2 btmUda57xmEZG1+nmbnm28GivBaSswUMY8qDWvscIFtvkdJOlcehlkHQEySt7gvmsCHG KBN+QREp26QFURuj340EOaTFK3nsjWdGsr3L7N+jTr8fCIZqwWykdYrI7YWhBaJUQ8uj s3lB8EtGLCz7Nf1mFyoZ9bdIQxmT1DYV6Eb4LEVsppd7WjG3G8lwMjJOoPUABrRwgBAY hzoXUBqdA2Oiu6oESZuq7MSd24v/KlyXYO8gVIu259za6kVwWuf+VsHEHqsSgwT9FqG1 052Q== X-Gm-Message-State: AOJu0YwcXtju3Gr709//pGnoiUn2hmDcYKS1O4IPBJpAFsFNhaU6uEVv qTHNSS7ozgYFmKjwtmzR7bluWWRu9M2uGen0SDJZch7k26YA8YAyQvhiYCPUcTivgsvWuTIgVs/ njTkhJMUDK8kLDUbpJV6OQd2SR9o+IJVR8PvouAb5gyqvXn3/1RO4SSFMWId9O/L9osaoJj7pg4 AIdfpGnogDXB8bh70AGkk9QiYBISRX7KjjnrN7iQ== X-Gm-Gg: ASbGnctL1kwoAeakVLEmEpdQX5QJNhBlxYLCEJGfLSs3TkHxRtxKbPtyoevNkKFZYWK QoLgcqgRMCrnS8AftldBD6LFDcJPWv1TiYle1MTTh1RtjJP1kZtqQhabBGbCM338kIr/m0l9H3g 87fH5ftD8EddzptIntFORwD8TDPeudlwd6vJRhiaIUvgqjqfr7EuMDE44pg6/rK00hDDZYlU6VI pi8E/PipG+vNIN7Gwj2E4KDoPSwqq69MqCJkaZKLr/iUtLGXJMcmhyc8yGneKjYoSTzFFXTVTki aJC5iOAq+HmrcDrfG3HgQEwBZYnlNpCOVZ+sMDzs0Bmsudeu1pTlDjFXfWQW2EUi X-Received: by 2002:ac8:7d0f:0:b0:4e8:ad2a:b0cf with SMTP id d75a77b69052e-4ed30d512aamr182178991cf.9.1762204030525; Mon, 03 Nov 2025 13:07:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2g7WbmHbwwQnJV5qAqgm7TSs/zKMtTn0/RSQC2RgaKHvU8HDoCv/7gw8vWFek+RI80cPURQ== X-Received: by 2002:ac8:7d0f:0:b0:4e8:ad2a:b0cf with SMTP id d75a77b69052e-4ed30d512aamr182178531cf.9.1762204029978; Mon, 03 Nov 2025 13:07:09 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini Subject: [PULL 30/36] migration: Do not try to start VM if disk activation fails Date: Mon, 3 Nov 2025 16:06:19 -0500 Message-ID: <20251103210625.3689448-31-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1762204452356158500 Content-Type: text/plain; charset="utf-8" If a rare split brain happens (e.g. dest QEMU started running somehow, taking shared drive locks), src QEMU may not be able to activate the drives anymore. In this case, src QEMU shouldn't start the VM or it might crash the block layer later with something like: Meanwhile, src QEMU cannot try to continue either even if dest QEMU can release the drive locks (e.g. by QMP "stop"). Because as long as dest QEMU started running, it means dest QEMU's RAM is the only version that is consistent with current status of the shared storage. Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251103183301.3840862-3-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/migration.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5e74993b46..6e647c7c4a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3526,6 +3526,8 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) =20 static void migration_iteration_finish(MigrationState *s) { + Error *local_err =3D NULL; + bql_lock(); =20 /* @@ -3549,11 +3551,28 @@ static void migration_iteration_finish(MigrationSta= te *s) case MIGRATION_STATUS_FAILED: case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_CANCELLING: - /* - * Re-activate the block drives if they're inactivated. Note, COLO - * shouldn't use block_active at all, so it should be no-op there. - */ - migration_block_activate(NULL); + if (!migration_block_activate(&local_err)) { + /* + * Re-activate the block drives if they're inactivated. + * + * If it fails (e.g. in case of a split brain, where dest QEMU + * might have taken some of the drive locks and running!), do + * not start VM, instead wait for mgmt to decide the next step. + * + * If dest already started, it means dest QEMU should contain + * all the data it needs and it properly owns all the drive + * locks. Then even if src QEMU got a FAILED in migration, it + * normally should mean we should treat the migration as + * COMPLETED. + * + * NOTE: it's not safe anymore to start VM on src now even if + * dest would release the drive locks. It's because as long as + * dest started running then only dest QEMU's RAM is consistent + * with the shared storage. + */ + error_free(local_err); + break; + } if (runstate_is_live(s->vm_old_state)) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { vm_start(); --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204153; cv=none; d=zohomail.com; s=zohoarc; b=P4O5ARni0AwlcItRZtu59P0a/Jer7WD+BEY2UmKz7pZcnDfYr13o56M93zW7AHYoOebZmEFBGdvjGu51PYpg2MDjfgwUpvcFM3sSlWWrZVaF2FxEGmjjZPwBolNDBUBYeBWd59fCFH9FkUH9JYlK9y6XRtL0ZGsC5VqO96W9YI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204153; 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=nEkjkfuvOhHIY1QnKh8dFMR2whXzjtCTaNgURMh8zm4=; b=Lpo/qbCxWuv9oiwqbVYNfVPkTeDPsErELNtmup1OrsiOhqDDLcNhsG0A/HF64UZ+/8qRVrHxEkk98x0PiaULF06xg5obW8rKhhbzBiHn11bO5zEkbnifxYrtK9mCY74rkY1JIWvUZoH0MudTKPesieFqol9trS/cedZqgBCPoZk= 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 1762204153716678.0805378796352; Mon, 3 Nov 2025 13:09:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mB-00019S-9O; Mon, 03 Nov 2025 16:07:43 -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 1vG1m9-00018m-DG for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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 1vG1ln-0005S6-Ol for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:37 -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-643-gzpa3W_pPQCj6yNMF0oShg-1; Mon, 03 Nov 2025 16:07:13 -0500 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8a65ae81245so1487614085a.3 for ; Mon, 03 Nov 2025 13:07:13 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204034; 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=nEkjkfuvOhHIY1QnKh8dFMR2whXzjtCTaNgURMh8zm4=; b=cUeHMLPROBOxE1pQQ6xWyyW8fVcftPNoS81AVkO91uejXCVlLgWihaNMXW2Jmuv6LCVSu7 J83NotJJrzGraARfh7irQ9jiXXuED0zJOqxsXQsFIAB3A5T0EXH3Z/dJduhfeIkfhY41Yb 6DnC58ahs5Ej8xcjsmiSqNqSlQQMXXE= X-MC-Unique: gzpa3W_pPQCj6yNMF0oShg-1 X-Mimecast-MFC-AGG-ID: gzpa3W_pPQCj6yNMF0oShg_1762204033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204033; x=1762808833; 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=nEkjkfuvOhHIY1QnKh8dFMR2whXzjtCTaNgURMh8zm4=; b=hxfr4g9BxQ4BpageouL05dT/KKVVKzemOb0q4PzHIhfM78iJoJJXQMnNPHuXZPbgPR yOXqTU0rzEqOc4ENcgpZAmt/DGqfFFjy0kpzsRuznIA+i+damZAkeDRnJuk3/M0+ITHA lSCrrYzRFTlnIJJ21CoEVmhVSBrGVIQf7gZhlvv9qEjRxOIWJp1G3nS0/Qb7524wCTuk ew02Q6JxKnxhPJ3EdZYywgMQ3nJ137QQIn2ndJWx+OgnkxR5uL2JhTQHms0GW4JIRwmx 7xWNynrOVcBYTci5SpVUSRr3dtFIclAGaIJ/tZ8VzzR5kAYA35dvnkGqwM8M7ZQhz/Qw 7pLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204033; x=1762808833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nEkjkfuvOhHIY1QnKh8dFMR2whXzjtCTaNgURMh8zm4=; b=IthILar+7K6w/reb+ruBQBi+8MrCcssXgSCE6RQzd6YzshTUXq8a9IozmH7LCDqXp3 1kOYj9OtyEs2B+mpI++TDqR5g6vl6kF05++eAOf1v5ZHIIjSsZv+EA3l/6J5UYmWZq83 dp4W23lTU/80xTrIGCA9ruiebZwHlu+SKpMOUSgG3+Wb39wPpz0hzAksIE9PJUqgN2gy ONqhhPP+Ab3h0S99nk+RcC+M2Z5njaieptaWRbLV8kcR5rKeJSDCP+mJWZBNTBQ+AfCH 75PHpyVM8TodLspEOYwAKKOLk10lLOOmjOq1EufxiZEIoUKuRKB7Mngf/WBxQmQjoWvm 1p7g== X-Gm-Message-State: AOJu0Yz+8wyl9UEPjL/3PPeN57OX4QHxsxaCr0JE6xqJ0kVDSj665t6L KgtPwsZkBSItmwCC9mZTc0B8WvhYQ7B/Jag1q/Xc5UrL3KlylQVDzuuUTXo1+TzECPxS4/XhonE HEg2SvLw/pOJimz9apmYWcj4VloOyoNMaa5GOtMHs8x/Buydhlnbj9b4OUe4IVVFO4laXcUne4I E8SXtti8Xxq8ktWZFdH3GcLXM/kIPkn4m0hM8mOw== X-Gm-Gg: ASbGncs0Q+T4fUo2AZUpe8S3QggvMVOo+n2JpcXCC52cdbB7cyjR0p1f8a9gtfYe1Zh iF7vSHSOCv8nQxmexjefD2SJSjRUMTZzlV3qjy0FBr9WGPtZB2yDE6TRLZAx/wOO8WDB3GgeoEV 3xFEKkBKlWrj4jPXIBWf2LZdFMUnVx7fvdTeQWhiUQPJEJFhtkbgUIwCb5j5hFKk6C7tv4Hi3x0 6axO8OmtnmUM00Zzamm9iDhwjVGLcj7Dvd7QzA/SlPPLDonfzyBHNoJxs/sHR5VzZI/nx4IpkXL mFyO9oHsUrandxyd+fVDJT9Qzz9f09UX8MOdo7y8HGuer7Y+/dRZR+mTzKuOdR+v X-Received: by 2002:a05:620a:1a2a:b0:859:a927:e7cf with SMTP id af79cd13be357-8ab9997878bmr1772546385a.36.1762204032448; Mon, 03 Nov 2025 13:07:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPey1l+9g+rqRZhiy3qOL5teAswN82GBYBgdZAmKL2hr3wg7l1gvtCo503RchLhZpHnkSbLg== X-Received: by 2002:a05:620a:1a2a:b0:859:a927:e7cf with SMTP id af79cd13be357-8ab9997878bmr1772538185a.36.1762204031663; Mon, 03 Nov 2025 13:07:11 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 31/36] migration: Move postcopy_ram_listen_thread() to postcopy-ram.c Date: Mon, 3 Nov 2025 16:06:20 -0500 Message-ID: <20251103210625.3689448-32-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 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: 1762204158458158500 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin This patch addresses a TODO about moving postcopy_ram_listen_thread() to postcopy file. Signed-off-by: Juraj Marcin Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251103183301.3840862-4-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/postcopy-ram.h | 2 + migration/postcopy-ram.c | 105 ++++++++++++++++++++++++++++++++++++++ migration/savevm.c | 107 --------------------------------------- 3 files changed, 107 insertions(+), 107 deletions(-) diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index ca19433b24..3e26db3e6b 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -199,4 +199,6 @@ bool postcopy_is_paused(MigrationStatus status); void mark_postcopy_blocktime_begin(uintptr_t addr, uint32_t ptid, RAMBlock *rb); =20 +void *postcopy_ram_listen_thread(void *opaque); + #endif diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 5471efb4f0..880b11f154 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2077,3 +2077,108 @@ bool postcopy_is_paused(MigrationStatus status) return status =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED || status =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP; } + +/* + * Triggered by a postcopy_listen command; this thread takes over reading + * the input stream, leaving the main thread free to carry on loading the = rest + * of the device state (from RAM). + */ +void *postcopy_ram_listen_thread(void *opaque) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + QEMUFile *f =3D mis->from_src_file; + int load_res; + MigrationState *migr =3D migrate_get_current(); + Error *local_err =3D NULL; + + object_ref(OBJECT(migr)); + + migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, + MIGRATION_STATUS_POSTCOPY_ACTIVE); + qemu_event_set(&mis->thread_sync_event); + trace_postcopy_ram_listen_thread_start(); + + rcu_register_thread(); + /* + * Because we're a thread and not a coroutine we can't yield + * in qemu_file, and thus we must be blocking now. + */ + qemu_file_set_blocking(f, true, &error_fatal); + + /* TODO: sanity check that only postcopiable data will be loaded here = */ + load_res =3D qemu_loadvm_state_main(f, mis, &local_err); + + /* + * This is tricky, but, mis->from_src_file can change after it + * returns, when postcopy recovery happened. In the future, we may + * want a wrapper for the QEMUFile handle. + */ + f =3D mis->from_src_file; + + /* And non-blocking again so we don't block in any cleanup */ + qemu_file_set_blocking(f, false, &error_fatal); + + trace_postcopy_ram_listen_thread_exit(); + if (load_res < 0) { + qemu_file_set_error(f, load_res); + dirty_bitmap_mig_cancel_incoming(); + if (postcopy_state_get() =3D=3D POSTCOPY_INCOMING_RUNNING && + !migrate_postcopy_ram() && migrate_dirty_bitmaps()) + { + error_report("%s: loadvm failed during postcopy: %d: %s. All s= tates " + "are migrated except dirty bitmaps. Some dirty " + "bitmaps may be lost, and present migrated dirty " + "bitmaps are correctly migrated and valid.", + __func__, load_res, error_get_pretty(local_err)); + g_clear_pointer(&local_err, error_free); + load_res =3D 0; /* prevent further exit() */ + } else { + error_prepend(&local_err, + "loadvm failed during postcopy: %d: ", load_res); + migrate_set_error(migr, local_err); + g_clear_pointer(&local_err, error_report_err); + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, + MIGRATION_STATUS_FAILED); + } + } + if (load_res >=3D 0) { + /* + * This looks good, but it's possible that the device loading in t= he + * main thread hasn't finished yet, and so we might not be in 'RUN' + * state yet; wait for the end of the main thread. + */ + qemu_event_wait(&mis->main_thread_load_event); + } + postcopy_ram_incoming_cleanup(mis); + + if (load_res < 0) { + /* + * If something went wrong then we have a bad state so exit; + * depending how far we got it might be possible at this point + * to leave the guest running and fire MCEs for pages that never + * arrived as a desperate recovery step. + */ + rcu_unregister_thread(); + exit(EXIT_FAILURE); + } + + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_COMPLETED); + /* + * If everything has worked fine, then the main thread has waited + * for us to start, and we're the last use of the mis. + * (If something broke then qemu will have to exit anyway since it's + * got a bad migration state). + */ + bql_lock(); + migration_incoming_state_destroy(); + bql_unlock(); + + rcu_unregister_thread(); + mis->have_listen_thread =3D false; + postcopy_state_set(POSTCOPY_INCOMING_END); + + object_unref(OBJECT(migr)); + + return NULL; +} diff --git a/migration/savevm.c b/migration/savevm.c index fa017378db..2f7ed0db64 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2088,113 +2088,6 @@ static int loadvm_postcopy_ram_handle_discard(Migra= tionIncomingState *mis, return 0; } =20 -/* - * Triggered by a postcopy_listen command; this thread takes over reading - * the input stream, leaving the main thread free to carry on loading the = rest - * of the device state (from RAM). - * (TODO:This could do with being in a postcopy file - but there again it's - * just another input loop, not that postcopy specific) - */ -static void *postcopy_ram_listen_thread(void *opaque) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - QEMUFile *f =3D mis->from_src_file; - int load_res; - MigrationState *migr =3D migrate_get_current(); - Error *local_err =3D NULL; - - object_ref(OBJECT(migr)); - - migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_POSTCOPY_ACTIVE); - qemu_event_set(&mis->thread_sync_event); - trace_postcopy_ram_listen_thread_start(); - - rcu_register_thread(); - /* - * Because we're a thread and not a coroutine we can't yield - * in qemu_file, and thus we must be blocking now. - */ - qemu_file_set_blocking(f, true, &error_fatal); - - /* TODO: sanity check that only postcopiable data will be loaded here = */ - load_res =3D qemu_loadvm_state_main(f, mis, &local_err); - - /* - * This is tricky, but, mis->from_src_file can change after it - * returns, when postcopy recovery happened. In the future, we may - * want a wrapper for the QEMUFile handle. - */ - f =3D mis->from_src_file; - - /* And non-blocking again so we don't block in any cleanup */ - qemu_file_set_blocking(f, false, &error_fatal); - - trace_postcopy_ram_listen_thread_exit(); - if (load_res < 0) { - qemu_file_set_error(f, load_res); - dirty_bitmap_mig_cancel_incoming(); - if (postcopy_state_get() =3D=3D POSTCOPY_INCOMING_RUNNING && - !migrate_postcopy_ram() && migrate_dirty_bitmaps()) - { - error_report("%s: loadvm failed during postcopy: %d: %s. All s= tates " - "are migrated except dirty bitmaps. Some dirty " - "bitmaps may be lost, and present migrated dirty " - "bitmaps are correctly migrated and valid.", - __func__, load_res, error_get_pretty(local_err)); - g_clear_pointer(&local_err, error_free); - load_res =3D 0; /* prevent further exit() */ - } else { - error_prepend(&local_err, - "loadvm failed during postcopy: %d: ", load_res); - migrate_set_error(migr, local_err); - g_clear_pointer(&local_err, error_report_err); - migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, - MIGRATION_STATUS_FAILED); - } - } - if (load_res >=3D 0) { - /* - * This looks good, but it's possible that the device loading in t= he - * main thread hasn't finished yet, and so we might not be in 'RUN' - * state yet; wait for the end of the main thread. - */ - qemu_event_wait(&mis->main_thread_load_event); - } - postcopy_ram_incoming_cleanup(mis); - - if (load_res < 0) { - /* - * If something went wrong then we have a bad state so exit; - * depending how far we got it might be possible at this point - * to leave the guest running and fire MCEs for pages that never - * arrived as a desperate recovery step. - */ - rcu_unregister_thread(); - exit(EXIT_FAILURE); - } - - migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_COMPLETED); - /* - * If everything has worked fine, then the main thread has waited - * for us to start, and we're the last use of the mis. - * (If something broke then qemu will have to exit anyway since it's - * got a bad migration state). - */ - bql_lock(); - migration_incoming_state_destroy(); - bql_unlock(); - - rcu_unregister_thread(); - mis->have_listen_thread =3D false; - postcopy_state_set(POSTCOPY_INCOMING_END); - - object_unref(OBJECT(migr)); - - return NULL; -} - /* After this message we must be able to immediately receive postcopy data= */ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis, Error **errp) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204146; cv=none; d=zohomail.com; s=zohoarc; b=nwbY1h8LBro8JbD3hqer4CaUHKyW1CLZyGh0gX5rrrwVDe8OGh7yJAvOCCAa+SJdlD8bOpbRbZLrNmnu2kfgPG/QIoIIAQytGMHg/1ci4zxrpab0ocwRnBdpA1cxfqxrAvjspM5yxRKKg+Mt1qbAaMa1Gvtxhq0cp5QH9p38DyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204146; 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=q4ySTRIKxvKeAz7Lm6tYyYb5uTFDHyjOqpDQGbAI3Y8=; b=KHD00f4Ncv+PANBGQerLBOfz5EsAvq+iTErM+Ex1Jx8PfsNhK1vkqWM7ew7lPgCGgyW2Iq/OOMUkV++o9eh9OgcS01kn2dEJmeK+F8O7zZ2mL3mcFN6DU2E5Qk+aAw7Di9SeqwA7lyd2b4Sfbcxp8bZ6FnZgi7yRzOLwfhMP9Ko= 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 1762204146460736.9766280369205; Mon, 3 Nov 2025 13:09:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m2-00017K-HO; Mon, 03 Nov 2025 16:07:35 -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 1vG1lz-00016p-Mt for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:31 -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 1vG1ll-0005SO-Hk for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:31 -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-645-SqiFMpKeOHGOkRVPc-DYUw-1; Mon, 03 Nov 2025 16:07:15 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8910b0fb780so735406285a.3 for ; Mon, 03 Nov 2025 13:07:15 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204036; 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=q4ySTRIKxvKeAz7Lm6tYyYb5uTFDHyjOqpDQGbAI3Y8=; b=OcJy0QULyHsUZaEva3E4L1LOrs+mrTgipQvgA5ag0YxNXlTP5NdJuTl70/c89q39phwymJ FTstv6niECYKNUbhFtvxlBcjPazCpD3T4djTHMTK4Bqw43Bmj8UlJu+2N7gbDmazkitLiD 0Kp3w91J0LXiOezGqGypBU+VacCIyaY= X-MC-Unique: SqiFMpKeOHGOkRVPc-DYUw-1 X-Mimecast-MFC-AGG-ID: SqiFMpKeOHGOkRVPc-DYUw_1762204034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204034; x=1762808834; 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=q4ySTRIKxvKeAz7Lm6tYyYb5uTFDHyjOqpDQGbAI3Y8=; b=hAJ8n+umGriDi5qZwL3GDUcOz+zN3ZgCJXJKyfEzVDCSZGhVaQPfBYIqKZ52YU3MKv IdFDl8PWefCQ2egLpMT3r8HmoGnB2oc2bgx2XIFLeMK6sfOOR0pafe0k2HJpOGoslA6r AJC4//Z3qrYbn+v1ljlZytclWnqIYRgPDkt2/WYSaHE+6wdCtMOsM0b+jA7gRSXZKoJk /n87rLaOd0APALZDLs6ANuxGrVZ1+9VC24K8krjANGAvHRI8jmfaU1dDnBb9UAbwEAG9 pmtu/OJLGGL5h35bxUAoy/4Z1DvIPFS70pSSjq2RVFwqqzKgqSGMKLetnPiGN8YGla8N 2xWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204034; x=1762808834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q4ySTRIKxvKeAz7Lm6tYyYb5uTFDHyjOqpDQGbAI3Y8=; b=wXXuHwXIZeKpWSkXsvEDHgIbRvWdRbYixf5rhQVnjnxdUiU/AbXde98scx/1kIyb07 lHYYiygzPT0H7gcZ1TA1ddNTXbWpH3/xEE0Z46BQa+BuAAg82j56WFjRte0O3EUsxSaW GOM1khIupSuK5Je8jyUOeuIa+f7ZDjXMq3KdeifHbwfjmYyiRq5ofnI50AhzUkTkCdwj rEkuE0sqCuGVra1H6bc+qzaI5QqqQu4U14WarjiS5yTxsq853Wxiw7mahMpU/I1dOuvT aHAT0ncdjF7ZehtWtlGwn727IeMqdgO8qsSNLuo9LUdgfiGWQOUn1c0Dn9Hk+Qm1qv3W 4DUA== X-Gm-Message-State: AOJu0YxvscNF02K04SA+s5UgJrn/4XFWtQYAcE6p4OAYrTUeI030/36d dQNpr8+lQlMrkSEL5ya9O8EQyAG3sEQLHnik+RjPg4NAIxpG5eHrJ41GO62dzdkQ0waT2KC1tC2 mdvPuAOXUfApxZTC2LuZhatHpTOvjmBDDxFsz+Dtaxe22VvMneXuVvNOcWeSDZDE33H5y8IBqRt o3xDnp8d67AhNwcxX/fq6rqRmOYI9Nqu3je4JiVQ== X-Gm-Gg: ASbGnctrg5Vu2pQQefM24/n5KmgMGjUDnWcuN3lwD21S06+RTearHSXBPiQo6KPCnNH Uyg8xErWf2CSWYTpsAjch26LNpjw2d53f6/5XEmXA+M7Gq738H7+xkwRcvpWlVEWTSIlCCEi+qV lKkrLovjaaMHxbALtMfw0UzIah6JZGtD3+LlqQmkkeS0kJyrECzhwnSxoWACDpE5mJ8exGV7DWe ldgz82iEI8us8IHusODmI8G5UfY9UIgpdKMRQ4qJsLXxxQhhgEthlzPqzk10gvk+w5NnritbdXl MgNWNm1gZa2+r3rnDfwUAi1TjFVaSAJTE7th+byvSbR0UwHpyZLxgVRvZ/NbfAZn X-Received: by 2002:a05:620a:40c3:b0:88f:aff9:d89d with SMTP id af79cd13be357-8ab9bd5bcf7mr1790896585a.89.1762204033626; Mon, 03 Nov 2025 13:07:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDMk7cFEQdXCXslPMf3f2xhVMiskTIkyu5pTd9mUYBpA+cKfZTtXm/9NYmCmDssQjOEg0PJQ== X-Received: by 2002:a05:620a:40c3:b0:88f:aff9:d89d with SMTP id af79cd13be357-8ab9bd5bcf7mr1790890485a.89.1762204033015; Mon, 03 Nov 2025 13:07:13 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 32/36] migration: Introduce postcopy incoming setup and cleanup functions Date: Mon, 3 Nov 2025 16:06:21 -0500 Message-ID: <20251103210625.3689448-33-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204148922154100 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin After moving postcopy_ram_listen_thread() to postcopy file, this patch introduces a pair of functions, postcopy_incoming_setup() and postcopy_incoming_cleanup(). These functions encapsulate setup and cleanup of all incoming postcopy resources, postcopy-ram and postcopy listen thread. Furthermore, this patch also renames the postcopy_ram_listen_thread to postcopy_listen_thread, as this thread handles not only postcopy-ram, but also dirty-bitmaps and in the future it could handle other postcopiable devices. Signed-off-by: Juraj Marcin Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251103183301.3840862-5-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/postcopy-ram.h | 3 ++- migration/migration.c | 2 +- migration/postcopy-ram.c | 44 ++++++++++++++++++++++++++++++++++++++-- migration/savevm.c | 25 ++--------------------- 4 files changed, 47 insertions(+), 27 deletions(-) diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 3e26db3e6b..a080dd65a7 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -199,6 +199,7 @@ bool postcopy_is_paused(MigrationStatus status); void mark_postcopy_blocktime_begin(uintptr_t addr, uint32_t ptid, RAMBlock *rb); =20 -void *postcopy_ram_listen_thread(void *opaque); +int postcopy_incoming_setup(MigrationIncomingState *mis, Error **errp); +int postcopy_incoming_cleanup(MigrationIncomingState *mis); =20 #endif diff --git a/migration/migration.c b/migration/migration.c index 6e647c7c4a..9a367f717e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -892,7 +892,7 @@ process_incoming_migration_co(void *opaque) * but managed to complete within the precopy period, we can u= se * the normal exit. */ - postcopy_ram_incoming_cleanup(mis); + postcopy_incoming_cleanup(mis); } else if (ret >=3D 0) { /* * Postcopy was started, cleanup should happen at the end of t= he diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 880b11f154..b47c955763 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2083,7 +2083,7 @@ bool postcopy_is_paused(MigrationStatus status) * the input stream, leaving the main thread free to carry on loading the = rest * of the device state (from RAM). */ -void *postcopy_ram_listen_thread(void *opaque) +static void *postcopy_listen_thread(void *opaque) { MigrationIncomingState *mis =3D migration_incoming_get_current(); QEMUFile *f =3D mis->from_src_file; @@ -2149,7 +2149,7 @@ void *postcopy_ram_listen_thread(void *opaque) */ qemu_event_wait(&mis->main_thread_load_event); } - postcopy_ram_incoming_cleanup(mis); + postcopy_incoming_cleanup(mis); =20 if (load_res < 0) { /* @@ -2182,3 +2182,43 @@ void *postcopy_ram_listen_thread(void *opaque) =20 return NULL; } + +int postcopy_incoming_setup(MigrationIncomingState *mis, Error **errp) +{ + /* + * Sensitise RAM - can now generate requests for blocks that don't exi= st + * However, at this point the CPU shouldn't be running, and the IO + * shouldn't be doing anything yet so don't actually expect requests + */ + if (migrate_postcopy_ram()) { + if (postcopy_ram_incoming_setup(mis)) { + postcopy_ram_incoming_cleanup(mis); + error_setg(errp, "Failed to setup incoming postcopy RAM blocks= "); + return -1; + } + } + + trace_loadvm_postcopy_handle_listen("after uffd"); + + if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_LISTEN, errp)) { + return -1; + } + + mis->have_listen_thread =3D true; + postcopy_thread_create(mis, &mis->listen_thread, + MIGRATION_THREAD_DST_LISTEN, + postcopy_listen_thread, QEMU_THREAD_DETACHED); + + return 0; +} + +int postcopy_incoming_cleanup(MigrationIncomingState *mis) +{ + int rc =3D 0; + + if (migrate_postcopy_ram()) { + rc =3D postcopy_ram_incoming_cleanup(mis); + } + + return rc; +} diff --git a/migration/savevm.c b/migration/savevm.c index 2f7ed0db64..01b5a8bfff 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2113,32 +2113,11 @@ static int loadvm_postcopy_handle_listen(MigrationI= ncomingState *mis, =20 trace_loadvm_postcopy_handle_listen("after discard"); =20 - /* - * Sensitise RAM - can now generate requests for blocks that don't exi= st - * However, at this point the CPU shouldn't be running, and the IO - * shouldn't be doing anything yet so don't actually expect requests - */ - if (migrate_postcopy_ram()) { - if (postcopy_ram_incoming_setup(mis)) { - postcopy_ram_incoming_cleanup(mis); - error_setg(errp, "Failed to setup incoming postcopy RAM blocks= "); - return -1; - } - } + int rc =3D postcopy_incoming_setup(mis, errp); =20 - trace_loadvm_postcopy_handle_listen("after uffd"); - - if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_LISTEN, errp)) { - return -1; - } - - mis->have_listen_thread =3D true; - postcopy_thread_create(mis, &mis->listen_thread, - MIGRATION_THREAD_DST_LISTEN, - postcopy_ram_listen_thread, QEMU_THREAD_DETACHE= D); trace_loadvm_postcopy_handle_listen("return"); =20 - return 0; + return rc; } =20 static void loadvm_postcopy_handle_run_bh(void *opaque) --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204306; cv=none; d=zohomail.com; s=zohoarc; b=Km9Ms0WMZ2yHkh6cv5iyPTDzxdRVNGwAu+O2QShQN5COqD/7S5Du2APTqmB4m6+fMNLbaHbMGEFHXh4vp7T328KiKh9qu4Ma5Ka8FEh4rZ1MPAcos8mAiQMExoDQG/tx5v5jQVMHnoW+ywD79B14ZuSaDHwFpEk5Qs25KxQTp3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204306; 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=QKMPVMoNMgHMuyq+3Hjcjr8NaNmoAw5q1rOR6GQTNrk=; b=miLs5yFbxyz0v9ry6YWxZ5FE3cz8W2LRg7IxuIBoESlIwTHJmy6N+b6IEQDpQEPMS7Rg6txGUg8LznbNqTNr383nt5hxe0sLFO47+z9fsh8g2cZlLCZJZrTwYFqwfevI79pYvzwJC+Sx3XTVI4fsXg0pT78gGRlzHw71CxxTJcY= 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 1762204306080479.5647797750995; Mon, 3 Nov 2025 13:11:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mF-0001B0-GM; Mon, 03 Nov 2025 16:07: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 1vG1mC-00019s-95 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:45 -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 1vG1lo-0005St-Tn for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:44 -0500 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-82-VJE_d9GhOxy78fv1nPvHnA-1; Mon, 03 Nov 2025 16:07:16 -0500 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4ecf4540bb6so133880761cf.3 for ; Mon, 03 Nov 2025 13:07:15 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204038; 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=QKMPVMoNMgHMuyq+3Hjcjr8NaNmoAw5q1rOR6GQTNrk=; b=LLSq1vQq89TyaIWR5/6sbtHJdDJeEmp9j4C3a236SdYOdMDroDMRlyVH9K4CxrUyXxiC9i fgQXh705LvI02xaeQ3L7ALi4g5wpaQt9JE1if7tbBYFYsT76FKf8MdH3jM1FKjCG8Ub7S1 QZuFxnajjLI+8O5YFLuO1WeAbdcLMjA= X-MC-Unique: VJE_d9GhOxy78fv1nPvHnA-1 X-Mimecast-MFC-AGG-ID: VJE_d9GhOxy78fv1nPvHnA_1762204035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204035; x=1762808835; 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=QKMPVMoNMgHMuyq+3Hjcjr8NaNmoAw5q1rOR6GQTNrk=; b=Q6T0t4DDUmYYHajRf91Pta9Cp7NLTlDySYLd5AZKX8HoIzyClGUjagQ6jDmE0lCPba j95Mvyy74alm+60pleEANSDAa7xISGhrvlZsToMrXYk0M5KtvTlfjsK/Ve2+jgiQnD3O PpcfxtvB9U/UmQEq+1pXwmyqAwnbnCQacvq0I1knaSbliYe+fKJsdG265/7gNwaHB6jY gcpRMAsO6cF5SmtnZrw2++tBWE8FuosPJ3IlO3rV5Rgf8m/yc8OyK6mw+LDI1mBBSBzh sjalU5Ji+ZUB4pQlMq79uG1MVx1BoVBsaZ95494uxsHGoGDBxssZBM0Eua5raOiPs1sd r8sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204035; x=1762808835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QKMPVMoNMgHMuyq+3Hjcjr8NaNmoAw5q1rOR6GQTNrk=; b=fZLF+nfQvEYWvkkZa7ZUyErlFI7M++xG5Z47QB7Uc8AFsVjd5FaEgmwfLBe2PPl4+J ZsHhpwTOKJ+sHk22At3DB+p+ypP6Fyt5LssOM2Jcf7EIjtUvQKpgw7B0J9nvRVZdlMSF yDcoqIX3kNcnIOJiuE4bzh72WgoU5KZsdVlNrhtyBcUDB6QYwpGay2lYWlNwkwAnIRt5 ZQBvTYhj2t2hwfpiYHJNHVPEQPXcfJpGhv+MYodqNeMdL3uyPP1Am/E59+26nQIpk2Lc Bg1zApZQjuWYMEman3U6mJfqyP29I5HxdHy72UX4yRlzYlSEU6nWPTtJTc/1Qh/k1q9O q4IQ== X-Gm-Message-State: AOJu0YwZEMcxedlvOqA1I9RIPDRIl38rTzNMBYhGlzp9dpnXAiIpBJxt DIUd/i90BB/RGpPWYrEKZuW6Fl+YO7G6n9R4X279+ZeZjDb0hNxVZKU3zdkExuUyuGym9lqoXns u6eN/71gNRnsheijbZuipXjLCF30UWSEyLkRVrVHnXyupNxr7KXPvwkMhGrjQM+3/+Phnq+pnin TfZ0Lv7H25wrHdRjCSMeJssvP5IkZ31zM8l8pg+w== X-Gm-Gg: ASbGncspy79B6NvIW5qMb2i+44/IY+89TJoUXbcJfjg1zjs4A1EeDZSqZXJ/KxlAnp6 5yMUA1vrXdcQ9wtJ6kXlAbIocpYOTI64D/jbUYZRsS5mch+Q43z95gdN8+3E9EsGJ+9hTjutd22 H1mxEFP+9F+cw8KWzk42FOfvKhgKwxXDSYUx5hGp3m53Bbox4dvC1P7x7FQ9Zzw2A+/VgNp0H89 bnsOWHjQS8kDM6wgaz/uyxKf63ovCuuddgWAfx5kPXufm9cgeMTY+Us6l1Dgqf41CdWk4pg8S3s B6Shy8B188tAg0YmZrcsjqjsymuLPfag4AoGmI6nkJ7nmMiBo/VANqYQyhorC0mZ X-Received: by 2002:a05:622a:15c2:b0:4e8:912a:bdc5 with SMTP id d75a77b69052e-4ed30f57aadmr190215011cf.27.1762204034895; Mon, 03 Nov 2025 13:07:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzXAW+9REqy2X9XkTadXyvfhgARn4v1dbo9COoQ6U+3R9zbjv6xXWoWsIY34lt3C+PSpCzyQ== X-Received: by 2002:a05:622a:15c2:b0:4e8:912a:bdc5 with SMTP id d75a77b69052e-4ed30f57aadmr190214281cf.27.1762204034187; Mon, 03 Nov 2025 13:07:14 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 33/36] migration: Refactor all incoming cleanup info migration_incoming_destroy() Date: Mon, 3 Nov 2025 16:06:22 -0500 Message-ID: <20251103210625.3689448-34-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1762204307387158500 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin Currently, there are two functions that are responsible for calling the cleanup of the incoming migration state. With successful precopy, it's the incoming migration coroutine, and with successful postcopy it's the postcopy listen thread. However, if postcopy fails during in the device load, both functions will try to do the cleanup. This patch refactors all cleanup that needs to be done on the incoming side into a common function and defines a clear boundary, who is responsible for the cleanup. The incoming migration coroutine is responsible for calling the cleanup function, unless the listen thread has been started, in which case the postcopy listen thread runs the incoming migration cleanup in its BH. Signed-off-by: Juraj Marcin Fixes: 9535435795 ("migration: push Error **errp into qemu_loadvm_state()") Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251103183301.3840862-6-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/migration.h | 1 + migration/migration.c | 44 +++++++++------------------- migration/postcopy-ram.c | 63 +++++++++++++++++++++------------------- migration/trace-events | 2 +- 4 files changed, 49 insertions(+), 61 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 01329bf824..4a37f7202c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -254,6 +254,7 @@ struct MigrationIncomingState { MigrationIncomingState *migration_incoming_get_current(void); void migration_incoming_state_destroy(void); void migration_incoming_transport_cleanup(MigrationIncomingState *mis); +void migration_incoming_qemu_exit(void); /* * Functions to work with blocktime context */ diff --git a/migration/migration.c b/migration/migration.c index 9a367f717e..637be71bfe 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -438,10 +438,15 @@ void migration_incoming_transport_cleanup(MigrationIn= comingState *mis) =20 void migration_incoming_state_destroy(void) { - struct MigrationIncomingState *mis =3D migration_incoming_get_current(= ); + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyState ps =3D postcopy_state_get(); =20 multifd_recv_cleanup(); =20 + if (ps !=3D POSTCOPY_INCOMING_NONE) { + postcopy_incoming_cleanup(mis); + } + /* * RAM state cleanup needs to happen after multifd cleanup, because * multifd threads can use some of its states (receivedmap). @@ -866,7 +871,6 @@ process_incoming_migration_co(void *opaque) { MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); - PostcopyState ps; int ret; Error *local_err =3D NULL; =20 @@ -883,25 +887,14 @@ process_incoming_migration_co(void *opaque) =20 trace_vmstate_downtime_checkpoint("dst-precopy-loadvm-completed"); =20 - ps =3D postcopy_state_get(); - trace_process_incoming_migration_co_end(ret, ps); - if (ps !=3D POSTCOPY_INCOMING_NONE) { - if (ps =3D=3D POSTCOPY_INCOMING_ADVISE) { - /* - * Where a migration had postcopy enabled (and thus went to ad= vise) - * but managed to complete within the precopy period, we can u= se - * the normal exit. - */ - postcopy_incoming_cleanup(mis); - } else if (ret >=3D 0) { - /* - * Postcopy was started, cleanup should happen at the end of t= he - * postcopy thread. - */ - trace_process_incoming_migration_co_postcopy_end_main(); - goto out; - } - /* Else if something went wrong then just fall out of the normal e= xit */ + trace_process_incoming_migration_co_end(ret); + if (mis->have_listen_thread) { + /* + * Postcopy was started, cleanup should happen at the end of the + * postcopy listen thread. + */ + trace_process_incoming_migration_co_postcopy_end_main(); + goto out; } =20 if (ret < 0) { @@ -933,15 +926,6 @@ fail: } =20 exit(EXIT_FAILURE); - } else { - /* - * Report the error here in case that QEMU abruptly exits - * when postcopy is enabled. - */ - WITH_QEMU_LOCK_GUARD(&s->error_mutex) { - error_report_err(s->error); - s->error =3D NULL; - } } out: /* Pairs with the refcount taken in qmp_migrate_incoming() */ diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index b47c955763..48cbb46c27 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2078,6 +2078,24 @@ bool postcopy_is_paused(MigrationStatus status) status =3D=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP; } =20 +static void postcopy_listen_thread_bh(void *opaque) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + migration_incoming_state_destroy(); + + if (mis->state =3D=3D MIGRATION_STATUS_FAILED) { + /* + * If something went wrong then we have a bad state so exit; + * we only could have gotten here if something failed before + * POSTCOPY_INCOMING_RUNNING (for example device load), otherwise + * postcopy migration would pause inside qemu_loadvm_state_main(). + * Failing dirty-bitmaps won't fail the whole migration. + */ + exit(1); + } +} + /* * Triggered by a postcopy_listen command; this thread takes over reading * the input stream, leaving the main thread free to carry on loading the = rest @@ -2131,53 +2149,38 @@ static void *postcopy_listen_thread(void *opaque) "bitmaps are correctly migrated and valid.", __func__, load_res, error_get_pretty(local_err)); g_clear_pointer(&local_err, error_free); - load_res =3D 0; /* prevent further exit() */ } else { + /* + * Something went fatally wrong and we have a bad state, QEMU = will + * exit depending on if postcopy-exit-on-error is true, but the + * migration cannot be recovered. + */ error_prepend(&local_err, "loadvm failed during postcopy: %d: ", load_res); migrate_set_error(migr, local_err); g_clear_pointer(&local_err, error_report_err); migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, MIGRATION_STATUS_FAILED); + goto out; } } - if (load_res >=3D 0) { - /* - * This looks good, but it's possible that the device loading in t= he - * main thread hasn't finished yet, and so we might not be in 'RUN' - * state yet; wait for the end of the main thread. - */ - qemu_event_wait(&mis->main_thread_load_event); - } - postcopy_incoming_cleanup(mis); - - if (load_res < 0) { - /* - * If something went wrong then we have a bad state so exit; - * depending how far we got it might be possible at this point - * to leave the guest running and fire MCEs for pages that never - * arrived as a desperate recovery step. - */ - rcu_unregister_thread(); - exit(EXIT_FAILURE); - } + /* + * This looks good, but it's possible that the device loading in the + * main thread hasn't finished yet, and so we might not be in 'RUN' + * state yet; wait for the end of the main thread. + */ + qemu_event_wait(&mis->main_thread_load_event); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, MIGRATION_STATUS_COMPLETED); - /* - * If everything has worked fine, then the main thread has waited - * for us to start, and we're the last use of the mis. - * (If something broke then qemu will have to exit anyway since it's - * got a bad migration state). - */ - bql_lock(); - migration_incoming_state_destroy(); - bql_unlock(); =20 +out: rcu_unregister_thread(); mis->have_listen_thread =3D false; postcopy_state_set(POSTCOPY_INCOMING_END); =20 + migration_bh_schedule(postcopy_listen_thread_bh, NULL); + object_unref(OBJECT(migr)); =20 return NULL; diff --git a/migration/trace-events b/migration/trace-events index e8edd1fbba..772636f3ac 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -193,7 +193,7 @@ source_return_path_thread_resume_ack(uint32_t v) "%"PRI= u32 source_return_path_thread_switchover_acked(void) "" migration_thread_low_pending(uint64_t pending) "%" PRIu64 migrate_transferred(uint64_t transferred, uint64_t time_spent, uint64_t ba= ndwidth, uint64_t avail_bw, uint64_t size) "transferred %" PRIu64 " time_sp= ent %" PRIu64 " bandwidth %" PRIu64 " switchover_bw %" PRIu64 " max_size %"= PRId64 -process_incoming_migration_co_end(int ret, int ps) "ret=3D%d postcopy-stat= e=3D%d" +process_incoming_migration_co_end(int ret) "ret=3D%d" process_incoming_migration_co_postcopy_end_main(void) "" postcopy_preempt_enabled(bool value) "%d" migration_precopy_complete(void) "" --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204271; cv=none; d=zohomail.com; s=zohoarc; b=PxjIZvMTnu473zmC+xw60P8DqBqZptc7lQNsBoPD0DbBSshUxmUR5CZP++hQtxCtnXDFZQ+Gxv/xnnVUcNfxECdYfUQ04fNgAUra4+HsiM/fGlB3XDtvrzfb3tvt5l+cZjaIPlg8MIe6wBBJQN5sPvd8ilv/MIiaNYJGSSNDBr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204271; 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=qZP2PnPKVBWQomBr97OAT4HbbncDAsu0HYbYYz3qNmQ=; b=hpX5FB6V9VtvKFSHNCmqMUOB3jx2UjzZOX0tXkrLCiD/r2hm4PAUReqdPQ98BzB4E1807xdpUVgULSJdyDHhpSbmbHk5+GdWWfnK75si5R4dQMNgSs0P+g/pBgGmwuQozHwPs51IUYFzk1HJs9OhNfMYwm7YwbE+8IOkix253+c= 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 1762204271443387.03590146041347; Mon, 3 Nov 2025 13:11:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mC-00019T-PK; Mon, 03 Nov 2025 16:07: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 1vG1m9-00018q-QU for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07: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 1vG1lp-0005TY-TX for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:41 -0500 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-uuMiFDS6M5Cph9MyWT0EgA-1; Mon, 03 Nov 2025 16:07:18 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4e8984d8833so130677351cf.0 for ; Mon, 03 Nov 2025 13:07:17 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204040; 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=qZP2PnPKVBWQomBr97OAT4HbbncDAsu0HYbYYz3qNmQ=; b=IphOitoehr2SUJ2pPN34b0euONQwCA0tx0akUDmepyYmTdIpzXyUJDj/Qa+Bn89o9RWIbJ W/N4u8g85Rc1ooUQZxF1Tdd+4HbHwqdCRfsA9pkECjqQYx6dCa09Cm+/lZiQSiY0XT/BZ7 Af07+em/aQwQgnCudWTCvXOyNIwFk5Q= X-MC-Unique: uuMiFDS6M5Cph9MyWT0EgA-1 X-Mimecast-MFC-AGG-ID: uuMiFDS6M5Cph9MyWT0EgA_1762204036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204036; x=1762808836; 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=qZP2PnPKVBWQomBr97OAT4HbbncDAsu0HYbYYz3qNmQ=; b=rDbKAeADPFNM7ZCeM3ZN/n73XqALGE9oCg2x9W4K+XI6YgZ+0aAugXvvHMx26pOsyb dk5jpjceieTNkoUvfsx6wkK0+S1loA90JwHUPDlwLAfwclwYNcsUI0RSYJ1DKS3sFD+g g/GnZ5vUBfU9iI2a5A6D3W55QKQuBWKxVQ36/eTMGPefED0lM/jUBfZmpl6at//6frGj JVBMreAYnhoynbSEm1s9xKiU3UsPrmo3jAFQtyeGqfZ2nwWUXb/pp8B+aYbpnqG7L3qj YKvmYeuL4+3UdLqlxtlbbn60aWUrWJMDaHeUWb9kk98tTuE5CWBY7PXhqduwqH2QrBf9 aimw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204036; x=1762808836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qZP2PnPKVBWQomBr97OAT4HbbncDAsu0HYbYYz3qNmQ=; b=owTo+MxkcMMQ854LwHISCvcZ3JOIGZvxs9VaPUYPs/aqXCDMLsb9n8QntqtnSH35H4 BUxGriYXKtFHRsDS6ItxwCKgFmteIi7ALA5enXLSQWVkbyEO4k92gj+MvQcsWLfhVEEe Xv9Ob5oMF9Jh5rx8Kg+TJ3EuRyf+6QK7b9xlZDeLc/wq36aswGFnYNc5jx1XQciYuHeB MuZiwy/eRv19gvTNGITll/TDsG6jvP4egMAQjN3kawnN0DAFcct6MiGX4mnsszyjx0b0 HByHu47xa8pTMv3bKLzMRTDCxdxCl1eFlVcc9TZzzw1V2J6o6V/uTWYCtMWEQan0te3T /BYQ== X-Gm-Message-State: AOJu0Yz9/HQt7/7cPIaLmJFl5t8o2iUwwW7n8f1GYdUEdf4CTwx8esmc ZrQA+F5u84+RLfV/y7KmygklTw2CUc41l3aX/pu9RKm/Q/yuTXnxJVdyD0iiI7h4/gSAhgVMaVZ FIvmxJwrjh3U3CgQeNQtK1beAcT/8R7j6SI7N1IwpkVD5Wnx98ZQU+YFDqUmwyZOXUH47yEByxG RAtDThDIQhN2DVj1K3iZny2HESAp98kPjZZZQNjw== X-Gm-Gg: ASbGnctsiij8yyx3oTQ02lg67UDUXeB4zhsYMQsCdfOOhAal8xXSRwIScpDxcZmjCo7 QI5gIBxUY0XDXzBZQ7Dg5C6KYfX8mpM/WHnsTuDpY5pcEfRfgCEDa/cZg75joMGl8aWmGXN/aRd grNBzrHCQprNADVwhF8M2yV6b0W4hEVuIOI0XeK8rPDozUXLVM1RxRCgj8UNnCRkFNXEWmOmhi4 uyJ3D8ia3E36PNCdCpGlHzYINUY/RFZSzgL1ItLOxqKJqsLVUyi8psrc/VVyK18bpdF1gCSntnk dx1LhFYrTOvwKguixPJuC2Sx0xB5ATzIWys5EwmcHD+pTW6AlC5hmVZddwv7fSjy X-Received: by 2002:ac8:57c3:0:b0:4eb:a07a:5fce with SMTP id d75a77b69052e-4ed30d4d0b2mr187804651cf.17.1762204035986; Mon, 03 Nov 2025 13:07:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQSKS8RAzFsVO9bB3rFwZ0J+dWetBAgREtqNgyzX5gGBz4WEK5QDDmjHqOInVVmXdGY7cx3w== X-Received: by 2002:ac8:57c3:0:b0:4eb:a07a:5fce with SMTP id d75a77b69052e-4ed30d4d0b2mr187804011cf.17.1762204035350; Mon, 03 Nov 2025 13:07:15 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 34/36] migration: Respect exit-on-error when migration fails before resuming Date: Mon, 3 Nov 2025 16:06:23 -0500 Message-ID: <20251103210625.3689448-35-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204273721154100 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin When exit-on-error was added to migration, it wasn't added to postcopy. Even though postcopy migration will usually pause and not fail, in cases it does unrecoverably fail before destination side has been started, exit-on-error will allow management to query the error. Signed-off-by: Juraj Marcin Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251103183301.3840862-7-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 48cbb46c27..91431f02a4 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2080,11 +2080,16 @@ bool postcopy_is_paused(MigrationStatus status) =20 static void postcopy_listen_thread_bh(void *opaque) { + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 migration_incoming_state_destroy(); =20 - if (mis->state =3D=3D MIGRATION_STATUS_FAILED) { + if (mis->state =3D=3D MIGRATION_STATUS_FAILED && mis->exit_on_error) { + WITH_QEMU_LOCK_GUARD(&s->error_mutex) { + error_report_err(s->error); + s->error =3D NULL; + } /* * If something went wrong then we have a bad state so exit; * we only could have gotten here if something failed before --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204143; cv=none; d=zohomail.com; s=zohoarc; b=FxwL1zc6SH0Svi3mjGTVZCbm0Aj41HmxMlex3oURAXmF5A+kh/QqmNyel3ni5tzJrMJRb1QR+MB8XgvIi24Sf9l0223kL7FI2qQBwQMGG4PDAZ4EupsPWn7rcDnTpBLsqZXXFt/YhSJwZ/Cf2iolBv5Ii+D4WX2qcdBDxFtjjKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204143; 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=7JUxEIo0LRTKvG88sXg9U9GCAdj7XhcKAw4AkAelO9A=; b=OjfDEaG1+nvsje7V1hXswbsPGBhHI/cn0rApx2dXmpGu0zC/fm94vlzLEspdEaWQ/wv9dyvWlyg1N9doNMUj7SUgZq72dIWMG4O6I7nRuqdEBVshuk8GnOrg74EAVTMv3wFiWZnsbHR+GD+RYmbcGZTNr7EP0rEl7K+m2idLqAk= 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 1762204143392517.4307387292042; Mon, 3 Nov 2025 13:09:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mE-0001Ak-Hu; Mon, 03 Nov 2025 16:07: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 1vG1mC-00019U-SI for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:45 -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 1vG1lp-0005TQ-Tq for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:43 -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-333-b18S-B_ePoOXyVw4vWqhxA-1; Mon, 03 Nov 2025 16:07:18 -0500 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8910b0fb780so735411585a.3 for ; Mon, 03 Nov 2025 13:07:18 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204039; 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=7JUxEIo0LRTKvG88sXg9U9GCAdj7XhcKAw4AkAelO9A=; b=OgBOZe0d4eZ08YacJIeFZgXd2yrWC4Yk6vdIxmOKD0r3M1LTmoZCP9H9H1Mio4J3FiFRU/ gcfve2glQ48O55RZxPMGEpHoIP35WEr24nfu0FNr4ecHGr6EEr3ausAkZS6e6GcHEIhs1G jhXEhLjUjKGKi0SHJo1xOXClD6vU/0k= X-MC-Unique: b18S-B_ePoOXyVw4vWqhxA-1 X-Mimecast-MFC-AGG-ID: b18S-B_ePoOXyVw4vWqhxA_1762204037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204037; x=1762808837; 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=7JUxEIo0LRTKvG88sXg9U9GCAdj7XhcKAw4AkAelO9A=; b=gtB/gS/xFaHWRjJiOazjHWNqkk5AROXGgcio2fDCsxoTvObo0ahfEsu1xdzG7q4uE9 CwVFiIt9uRz5vSYIPIkdAe8jKWfaM4gkoSMH3AHGbXZYr/TLKXFvfTgM9KhLMr9o2eff fFpKIvJv53Mmt64sVlaMh8MNFKMIX5XbRSNhpFdfUyALr/FCI9detNpelzPSbs6qDmF1 ONcH10+7Fp/tJ0POAfWC5O44czA/yQUdqmBuDdxRGxU3xs2z8ZKPcPsWmAy41Lj17sbf 9rqUqSjUf3jqn/8kgCY/JBphEf0wLjVbFfHpM3qxqaChhqJ/0NClI4eebASzyFtu8HTC OEvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204037; x=1762808837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7JUxEIo0LRTKvG88sXg9U9GCAdj7XhcKAw4AkAelO9A=; b=mzsJUr1AT/GM25dyk3U0MFUaZfnx9l6nIJBiP/I2ZZm2BleYmncUEYVTVlUwZ1KcNg ajPHBkaNjzeH5TIaE2H+a/+z7DjeVQjTJ08jSQx6ITRBen4t1UMU2c/AnOppsp9/Ja9i kLJMjzb+srxJFXS6u9FmwiHuFSBT5Fn8QYOIuUuy6C+WRErJze7LkL62hZb/sV7JhUDt bNSfQXsClw3vj27GM+dnAc2d5rJWFF4wu7jKwcDKDOMx7M6ya+a1NdZZx2L/XLXQgQgJ wIZKUi1EvC+T86IjWGXAORNLTLwsDbeVtb1mFw6H2aPT3s5UVd3XsNqVsM7spqCQIWPh Wj8Q== X-Gm-Message-State: AOJu0Yw5BAkh0/HYLXBWrPvbKFkbgd8pSz348w4oeIjlBcDFep7AWadO fFQbdTc6lL0uozrx2tJp6rZiVTXQbVyWInJpAWxpqgOyOETWcvikmUrE1Mp35G1CCJuIkPe3Psn z8rXke+xxPZf3Wir2/T+A7WjHPi8P0tphFp2MERph5rMmVlOWWZcPzgVNs2ytrTeV5w5IW1WHjV FMo2TZkWaSRzctDndyBQ6nmnzLhlZ1dTKIyAMrcQ== X-Gm-Gg: ASbGnct2OvLsq8Jtz5jVG51SzbXNwdEKZiqJWs60Nk/yZzs7hTd0m5ZlF42HFP4P7+a cRMadcAdx1aMSQSEJLlI1dgfzllbm1qRWb4oZfSh71OPdBdpKtd+emil7qMlWCS0X6on+Ood4HQ GKuPQDK0EiAYSiY7Grp4ajYsxR71yKdlHqAyFHHfw7O/S5uJ2QpDfjfXhGggERbiz6XNv0uIdz2 iJzSXn5H1beFhIJFRkaRdmoCJXQb1Wr+L4ybYntD1JjMc7uARep4qGHt6ZaduQYPlS5jrhE9mDu fPwYzuhoWNhduhtrie2vb2MOIafXVDJzo2FAj+8YUu2l1oDYMq+TLZhY65QHt68S X-Received: by 2002:a05:620a:4507:b0:8a3:1b83:fd9 with SMTP id af79cd13be357-8ab99979159mr1824108085a.24.1762204037209; Mon, 03 Nov 2025 13:07:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJnc+nmZcPQYPieMjLQJcnC1SSx3u4ZHlqZKQuZHk244jdzmbNWBHK1RWNlD0dYr0vsqQpug== X-Received: by 2002:a05:620a:4507:b0:8a3:1b83:fd9 with SMTP id af79cd13be357-8ab99979159mr1824100685a.24.1762204036512; Mon, 03 Nov 2025 13:07:16 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 35/36] migration: Make postcopy listen thread joinable Date: Mon, 3 Nov 2025 16:06:24 -0500 Message-ID: <20251103210625.3689448-36-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204144834154100 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin This patch makes the listen thread joinable instead detached, and joins it alongside other postcopy threads. Signed-off-by: Juraj Marcin Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20251103183301.3840862-8-jmarcin@redhat.com Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 91431f02a4..8405cce7b4 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2181,7 +2181,6 @@ static void *postcopy_listen_thread(void *opaque) =20 out: rcu_unregister_thread(); - mis->have_listen_thread =3D false; postcopy_state_set(POSTCOPY_INCOMING_END); =20 migration_bh_schedule(postcopy_listen_thread_bh, NULL); @@ -2215,7 +2214,7 @@ int postcopy_incoming_setup(MigrationIncomingState *m= is, Error **errp) mis->have_listen_thread =3D true; postcopy_thread_create(mis, &mis->listen_thread, MIGRATION_THREAD_DST_LISTEN, - postcopy_listen_thread, QEMU_THREAD_DETACHED); + postcopy_listen_thread, QEMU_THREAD_JOINABLE); =20 return 0; } @@ -2224,6 +2223,11 @@ int postcopy_incoming_cleanup(MigrationIncomingState= *mis) { int rc =3D 0; =20 + if (mis->have_listen_thread) { + qemu_thread_join(&mis->listen_thread); + mis->have_listen_thread =3D false; + } + if (migrate_postcopy_ram()) { rc =3D postcopy_ram_incoming_cleanup(mis); } --=20 2.50.1 From nobody Fri Nov 14 22:20:19 2025 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=1762204496; cv=none; d=zohomail.com; s=zohoarc; b=Y735lE82R5CQmc9cmgbEgd4dQql9yP2pVsH8pNMcjactWpX9ALxNZamADje/ESw4dqAwm3qQuayD7Gqp22STejyre8UNiFpjz7VxERIoEp+0JTpNSgQBD2YeK3CZH58dDiCCZ2KMWHENbjtlzqiFianQ3/C76W/hO/Jq+/mXdSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204496; 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=o8ERM4pYYY4KJ4lCWCOZId0nsbezKUKvl/rCjsGxowM=; b=Ak8N59yG4s2+uvxtydsuFumU3Y7e+MTonFAQGjVZa3w4rCvt3vS6UM1hPfO5tw5Ed6BjfN4LY03hZzcNpkneygUP/mFrMAX6p18lp2+6eLkA65Lj7sXqAsahSmMNbdOFWDptwKFHs1pXJRopjwZ1XEJtdPSfnRmYLJ9xy2CkqOc= 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 1762204496252892.637291526718; Mon, 3 Nov 2025 13:14:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1mD-0001A9-9P; Mon, 03 Nov 2025 16:07:45 -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 1vG1mB-00019V-TR for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:43 -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 1vG1lt-0005Tl-26 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:43 -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-663-R3nrD7rKM0aQ-CJfOVJ3gw-1; Mon, 03 Nov 2025 16:07:20 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-891d8184bebso993798585a.3 for ; Mon, 03 Nov 2025 13:07:20 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204041; 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=o8ERM4pYYY4KJ4lCWCOZId0nsbezKUKvl/rCjsGxowM=; b=HVMhJQwaWwD+7ZAOznDP5Inyrqbi129obt10iKCde0lpds8SVRDfr4z0csXvHiFuY4r971 7FI/Yyy2CGQXn788HH5ZAx/0PViHyfsVqM6agIOSzAUAXCy8+FtbWruykgs6knkMOswJBG SGkUmL/u5OgQ9KYPu2kE/8EjDdyb2Nc= X-MC-Unique: R3nrD7rKM0aQ-CJfOVJ3gw-1 X-Mimecast-MFC-AGG-ID: R3nrD7rKM0aQ-CJfOVJ3gw_1762204040 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204039; x=1762808839; 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=o8ERM4pYYY4KJ4lCWCOZId0nsbezKUKvl/rCjsGxowM=; b=IhQHy0XJa67ai/lOSvkBH1SgMeHodDZau1ZlHJjSMIdthv+bPsGCmOH7xHwfqxuzHC DtnSLRqIcFsx5GHMy8/C/H5GIKH8ZGi2aDZRHgTgM6tLV/Nrzhvsy35cReN8VeFO4aWf oNA/D1OdvM6bCkhe4RE+n4sL0y0FH5dC1Ccsls9zcrJd+/Pu8YSXbYh3CzyfXvwgoDpd tqHGf+jZeBTSpFaQeKcK2g+Vd64AxUvcLlo2pZzFrl74o6TfVy8kI9B1rJnpYpcr+8CN ENLSYANwOukFnvu7gD23tQh22vW+Y54EUUo7k4SKlbtCpRh5r56yJ64uaokMF29qf0vo C6vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204039; x=1762808839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o8ERM4pYYY4KJ4lCWCOZId0nsbezKUKvl/rCjsGxowM=; b=VxFl8PWp/4liHH50xaN52/TaJmPK7tgI2EcT86rM0AtZqTV+PCp5sYBLpg2vYnZWUE vdHWpS5uvINRs2t8il6az5Dd7HyTlfbYk2zQG5ofnrvp7Ac/hnrV7zOePRTzfnIHlaDe idsj5jMLXMs/Ba+8/7LRC9BemlwO6Tap6A1vY23QH3Towbac3WBFCWQ56UDD1FodpcKI EvrQjl8Rvr9SQGrQica4h/1t9O/aNJwhRkkPPmHSGwgA7AAIqp9PZy1GI5tJls4ka+ge SDgpOJjxvIXP0AlVFsiMd6LuCMyK1IxsSPtIRpN2VIWANITlVdWUImBE8iEeeDd5y/AQ wPBg== X-Gm-Message-State: AOJu0YzSXBLj7Fqh5FOFcjc0wOMEJWXW0U7Dzq/fPHDCfWKEmwtoNhrf dFp2+7U/5ZrcqL/xFyQEWL5lUXtAYPfpCothdhJucaXfeT1WxHo9wlvLy2mfHyDNiN3zSegjlUY 44pX2RlxdcBDkWqjJ7wj9pY47TqHhWvrIXl2WV3IiZTrUHBcc6a3trlHueIYjd/GV4LS01O+kdd eP5sR254mOscnl0WUqwXje1RGq8JDHFd1O1XCNtw== X-Gm-Gg: ASbGncuiuefIa/0qH6NJ0lcRss7MIE03qMM8Ahxn2RBrCODiH12NRg9I32d+w5PTrwl CXaZPPEVETN+nck9PhOkfLrPxjPAyziNzN62Fej1PyrvcxPswKKoiCqJ0qqXzE3WVD6M9MqW3r2 qvN6bg4tVUbgKTxy6qnMuAXv+Q7+N/83vGRMTgN3Gv77URSpEzNDNO2lOkyotaAjmuvjBvvd7cu pKTeNtsXAzrCIXeSrgs5cKj8Nfawq7KXlWLpX3NTYOGLt9u8zgcDRddVEY5AXQkueSGf+/Ef2Xj q9YqzENGzEVmwy5h85M1uhMLD23YN/9mU3z0vz7ZZW2Kksrqvk/NIpsE6bgsXONc X-Received: by 2002:a05:620a:3705:b0:865:cacf:e11c with SMTP id af79cd13be357-8ab990ab2bamr1592932785a.11.1762204038906; Mon, 03 Nov 2025 13:07:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEck6oGmp2bwI52tE+uCQdS21KUS+LcVLnEJmNxKF0rLYX6CiDjsvytICISZ5msG4D4bnDdvg== X-Received: by 2002:a05:620a:3705:b0:865:cacf:e11c with SMTP id af79cd13be357-8ab990ab2bamr1592925685a.11.1762204038196; Mon, 03 Nov 2025 13:07:18 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Juraj Marcin Subject: [PULL 36/36] migration: Introduce POSTCOPY_DEVICE state Date: Mon, 3 Nov 2025 16:06:25 -0500 Message-ID: <20251103210625.3689448-37-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1762204497473154100 Content-Type: text/plain; charset="utf-8" From: Juraj Marcin Currently, when postcopy starts, the source VM starts switchover and sends a package containing the state of all non-postcopiable devices. When the destination loads this package, the switchover is complete and the destination VM starts. However, if the device state load fails or the destination side crashes, the source side is already in POSTCOPY_ACTIVE state and cannot be recovered, even when it has the most up-to-date machine state as the destination has not yet started. This patch introduces a new POSTCOPY_DEVICE state which is active while the destination machine is loading the device state, is not yet running, and the source side can be resumed in case of a migration failure. Return-path is required for this state to function, otherwise it will be skipped in favor of POSTCOPY_ACTIVE. To transition from POSTCOPY_DEVICE to POSTCOPY_ACTIVE, the source side uses a PONG message that is a response to a PING message processed just before the POSTCOPY_RUN command that starts the destination VM. Thus, this feature is effective even if the destination side does not yet support this new state. Signed-off-by: Juraj Marcin Link: https://lore.kernel.org/r/20251103183301.3840862-9-jmarcin@redhat.com Signed-off-by: Peter Xu --- qapi/migration.json | 10 ++++-- migration/migration.h | 3 ++ migration/savevm.h | 2 ++ migration/migration.c | 50 ++++++++++++++++++++++++--- migration/postcopy-ram.c | 10 ++++-- migration/savevm.c | 5 +++ tests/qtest/migration/precopy-tests.c | 3 +- migration/trace-events | 1 + tests/qemu-iotests/194 | 2 +- 9 files changed, 75 insertions(+), 11 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index c7a6737cc1..93f71de3fe 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -142,6 +142,12 @@ # @postcopy-active: like active, but now in postcopy mode. # (since 2.5) # +# @postcopy-device: like postcopy-active, but the destination is still +# loading device state and is not running yet. If migration fails +# during this state, the source side will resume. If there is no +# return-path from destination to source, this state is skipped. +# (since 10.2) +# # @postcopy-paused: during postcopy but paused. (since 3.0) # # @postcopy-recover-setup: setup phase for a postcopy recovery @@ -173,8 +179,8 @@ ## { 'enum': 'MigrationStatus', 'data': [ 'none', 'setup', 'cancelling', 'cancelled', - 'active', 'postcopy-active', 'postcopy-paused', - 'postcopy-recover-setup', + 'active', 'postcopy-device', 'postcopy-active', + 'postcopy-paused', 'postcopy-recover-setup', 'postcopy-recover', 'completed', 'failed', 'colo', 'pre-switchover', 'device', 'wait-unplug' ] } ## diff --git a/migration/migration.h b/migration/migration.h index 4a37f7202c..213b33fe6e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -510,6 +510,9 @@ struct MigrationState { /* Is this a rdma migration */ bool rdma_migration; =20 + bool postcopy_package_loaded; + QemuEvent postcopy_package_loaded_event; + GSource *hup_source; }; =20 diff --git a/migration/savevm.h b/migration/savevm.h index c337e3e3d1..125a2507b7 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -29,6 +29,8 @@ #define QEMU_VM_COMMAND 0x08 #define QEMU_VM_SECTION_FOOTER 0x7e =20 +#define QEMU_VM_PING_PACKAGED_LOADED 0x42 + bool qemu_savevm_state_blocked(Error **errp); void qemu_savevm_non_migratable_list(strList **reasons); int qemu_savevm_state_prepare(Error **errp); diff --git a/migration/migration.c b/migration/migration.c index 637be71bfe..c2daab6bdd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1206,6 +1206,7 @@ bool migration_is_running(void) =20 switch (s->state) { case MIGRATION_STATUS_ACTIVE: + case MIGRATION_STATUS_POSTCOPY_DEVICE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: @@ -1227,6 +1228,7 @@ static bool migration_is_active(void) MigrationState *s =3D current_migration; =20 return (s->state =3D=3D MIGRATION_STATUS_ACTIVE || + s->state =3D=3D MIGRATION_STATUS_POSTCOPY_DEVICE || s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); } =20 @@ -1349,6 +1351,7 @@ static void fill_source_migration_info(MigrationInfo = *info) break; case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_CANCELLING: + case MIGRATION_STATUS_POSTCOPY_DEVICE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_PRE_SWITCHOVER: case MIGRATION_STATUS_DEVICE: @@ -1402,6 +1405,7 @@ static void fill_destination_migration_info(Migration= Info *info) case MIGRATION_STATUS_CANCELLING: case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_ACTIVE: + case MIGRATION_STATUS_POSTCOPY_DEVICE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: case MIGRATION_STATUS_POSTCOPY_RECOVER: @@ -1732,6 +1736,7 @@ bool migration_in_postcopy(void) MigrationState *s =3D migrate_get_current(); =20 switch (s->state) { + case MIGRATION_STATUS_POSTCOPY_DEVICE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_PAUSED: case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: @@ -1833,6 +1838,9 @@ int migrate_init(MigrationState *s, Error **errp) memset(&mig_stats, 0, sizeof(mig_stats)); migration_reset_vfio_bytes_transferred(); =20 + s->postcopy_package_loaded =3D false; + qemu_event_reset(&s->postcopy_package_loaded_event); + return 0; } =20 @@ -2568,6 +2576,11 @@ static void *source_return_path_thread(void *opaque) tmp32 =3D ldl_be_p(buf); trace_source_return_path_thread_pong(tmp32); qemu_sem_post(&ms->rp_state.rp_pong_acks); + if (tmp32 =3D=3D QEMU_VM_PING_PACKAGED_LOADED) { + trace_source_return_path_thread_postcopy_package_loaded(); + ms->postcopy_package_loaded =3D true; + qemu_event_set(&ms->postcopy_package_loaded_event); + } break; =20 case MIG_RP_MSG_REQ_PAGES: @@ -2813,6 +2826,15 @@ static int postcopy_start(MigrationState *ms, Error = **errp) if (migrate_postcopy_ram()) { qemu_savevm_send_ping(fb, 3); } + if (ms->rp_state.rp_thread_created) { + /* + * This ping will tell us that all non-postcopiable device state ha= s been + * successfully loaded and the destination is about to start. When + * response is received, it will trigger transition from POSTCOPY_D= EVICE + * to POSTCOPY_ACTIVE state. + */ + qemu_savevm_send_ping(fb, QEMU_VM_PING_PACKAGED_LOADED); + } =20 qemu_savevm_send_postcopy_run(fb); =20 @@ -2868,8 +2890,13 @@ static int postcopy_start(MigrationState *ms, Error = **errp) */ migration_rate_set(migrate_max_postcopy_bandwidth()); =20 - /* Now, switchover looks all fine, switching to postcopy-active */ + /* + * Now, switchover looks all fine, switching to POSTCOPY_DEVICE, or + * directly to POSTCOPY_ACTIVE if there is no return path. + */ migrate_set_state(&ms->state, MIGRATION_STATUS_DEVICE, + ms->rp_state.rp_thread_created ? + MIGRATION_STATUS_POSTCOPY_DEVICE : MIGRATION_STATUS_POSTCOPY_ACTIVE); =20 bql_unlock(); @@ -3311,8 +3338,8 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) return postcopy_pause(s); } else { /* - * For precopy (or postcopy with error outside IO), we fail - * with no time. + * For precopy (or postcopy with error outside IO, or before dest + * starts), we fail with no time. */ migrate_set_state(&s->state, state, MIGRATION_STATUS_FAILED); trace_migration_thread_file_err(); @@ -3447,7 +3474,8 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) { uint64_t must_precopy, can_postcopy, pending_size; Error *local_err =3D NULL; - bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; + bool in_postcopy =3D (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_DEVICE= || + s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); bool can_switchover =3D migration_can_switchover(s); bool complete_ready; =20 @@ -3463,6 +3491,18 @@ static MigIterateState migration_iteration_run(Migra= tionState *s) * POSTCOPY_ACTIVE it means switchover already happened. */ complete_ready =3D !pending_size; + if (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_DEVICE && + (s->postcopy_package_loaded || complete_ready)) { + /* + * If package has been loaded, the event is set and we will + * immediatelly transition to POSTCOPY_ACTIVE. If we are ready= for + * completion, we need to wait for destination to load the pos= tcopy + * package before actually completing. + */ + qemu_event_wait(&s->postcopy_package_loaded_event); + migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_DEVICE, + MIGRATION_STATUS_POSTCOPY_ACTIVE); + } } else { /* * Exact pending reporting is only needed for precopy. Taking RAM @@ -4117,6 +4157,7 @@ static void migration_instance_finalize(Object *obj) qemu_sem_destroy(&ms->rp_state.rp_pong_acks); qemu_sem_destroy(&ms->postcopy_qemufile_src_sem); error_free(ms->error); + qemu_event_destroy(&ms->postcopy_package_loaded_event); } =20 static void migration_instance_init(Object *obj) @@ -4138,6 +4179,7 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->wait_unplug_sem, 0); qemu_sem_init(&ms->postcopy_qemufile_src_sem, 0); qemu_mutex_init(&ms->qemu_file_lock); + qemu_event_init(&ms->postcopy_package_loaded_event, 0); } =20 /* diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 8405cce7b4..3f98dcb6fd 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -2117,7 +2117,8 @@ static void *postcopy_listen_thread(void *opaque) object_ref(OBJECT(migr)); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_POSTCOPY_ACTIVE); + mis->to_src_file ? MIGRATION_STATUS_POSTCOPY_DEVICE : + MIGRATION_STATUS_POSTCOPY_ACTIVE); qemu_event_set(&mis->thread_sync_event); trace_postcopy_ram_listen_thread_start(); =20 @@ -2164,8 +2165,7 @@ static void *postcopy_listen_thread(void *opaque) "loadvm failed during postcopy: %d: ", load_res); migrate_set_error(migr, local_err); g_clear_pointer(&local_err, error_report_err); - migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, - MIGRATION_STATUS_FAILED); + migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FA= ILED); goto out; } } @@ -2176,6 +2176,10 @@ static void *postcopy_listen_thread(void *opaque) */ qemu_event_wait(&mis->main_thread_load_event); =20 + /* + * Device load in the main thread has finished, we should be in + * POSTCOPY_ACTIVE now. + */ migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, MIGRATION_STATUS_COMPLETED); =20 diff --git a/migration/savevm.c b/migration/savevm.c index 01b5a8bfff..62cc2ce25c 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2170,6 +2170,11 @@ static int loadvm_postcopy_handle_run(MigrationIncom= ingState *mis, Error **errp) return -1; } =20 + /* We might be already in POSTCOPY_ACTIVE if there is no return path */ + if (mis->state =3D=3D MIGRATION_STATUS_POSTCOPY_DEVICE) { + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_DEVICE, + MIGRATION_STATUS_POSTCOPY_ACTIVE); + } postcopy_state_set(POSTCOPY_INCOMING_RUNNING); migration_bh_schedule(loadvm_postcopy_handle_run_bh, mis); =20 diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index bb38292550..57ca623de5 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -1316,13 +1316,14 @@ void migration_test_add_precopy(MigrationTestEnv *e= nv) } =20 /* ensure new status don't go unnoticed */ - assert(MIGRATION_STATUS__MAX =3D=3D 15); + assert(MIGRATION_STATUS__MAX =3D=3D 16); =20 for (int i =3D MIGRATION_STATUS_NONE; i < MIGRATION_STATUS__MAX; i++) { switch (i) { case MIGRATION_STATUS_DEVICE: /* happens too fast */ case MIGRATION_STATUS_WAIT_UNPLUG: /* no support in tests */ case MIGRATION_STATUS_COLO: /* no support in tests */ + case MIGRATION_STATUS_POSTCOPY_DEVICE: /* postcopy can't be cancel= led */ case MIGRATION_STATUS_POSTCOPY_ACTIVE: /* postcopy can't be cancel= led */ case MIGRATION_STATUS_POSTCOPY_PAUSED: case MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: diff --git a/migration/trace-events b/migration/trace-events index 772636f3ac..bf11b62b17 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -191,6 +191,7 @@ source_return_path_thread_pong(uint32_t val) "0x%x" source_return_path_thread_shut(uint32_t val) "0x%x" source_return_path_thread_resume_ack(uint32_t v) "%"PRIu32 source_return_path_thread_switchover_acked(void) "" +source_return_path_thread_postcopy_package_loaded(void) "" migration_thread_low_pending(uint64_t pending) "%" PRIu64 migrate_transferred(uint64_t transferred, uint64_t time_spent, uint64_t ba= ndwidth, uint64_t avail_bw, uint64_t size) "transferred %" PRIu64 " time_sp= ent %" PRIu64 " bandwidth %" PRIu64 " switchover_bw %" PRIu64 " max_size %"= PRId64 process_incoming_migration_co_end(int ret) "ret=3D%d" diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 index e114c0b269..806624394d 100755 --- a/tests/qemu-iotests/194 +++ b/tests/qemu-iotests/194 @@ -76,7 +76,7 @@ with iotests.FilePath('source.img') as source_img_path, \ =20 while True: event1 =3D source_vm.event_wait('MIGRATION') - if event1['data']['status'] =3D=3D 'postcopy-active': + if event1['data']['status'] in ('postcopy-device', 'postcopy-activ= e'): # This event is racy, it depends do we really do postcopy or b= itmap # was migrated during downtime (and no data to migrate in post= copy # phase). So, don't log it. --=20 2.50.1