From nobody Sun Dec 14 12:17:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@intel.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1751264932938856.0454272822799; Sun, 29 Jun 2025 23:28:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 09D5D1389; Mon, 30 Jun 2025 02:28:52 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4BCB81381; Mon, 30 Jun 2025 02:22:51 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EA92214D8; Mon, 30 Jun 2025 02:22:41 -0400 (EDT) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BA59314D8 for ; Mon, 30 Jun 2025 02:22:21 -0400 (EDT) Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2025 23:22:21 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2025 23:22:19 -0700 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1751264542; x=1782800542; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qAVSswuSDh9SiL3XDB2zPWPb6TabA+WAQRh7OG/NIyg=; b=g7Ad5OoDv6wILz39g/VH6lm0zmkKldGMbkj+iZS0CQqhmUXM41+MHXjt DFEUG7xvMIOBn66TUVtShXfh4VXXVZJC59+kpAoVdLzTL4PS5Zxd3o5Rk Q+YqkGGWAbZiAcLVuLBMrtgx/nzRE1jDQDaJKa8zQYW0RsyERjPPIhNOj W87JiMqI7FY7apAKFzXUW9HTm+ITdTTtSZSws61TVSKRve7NFBg3fsYox ZTdm4Gdv9W65a883V+Whw4d10vYAoCIyUr3z01/dkEG72T3CHYbdClnAu 6rkF2SR9W/sPnAnMU+W1p5MtecKM//Zy1TzdLAVP4V5m47h2nO9b3SQCt A==; X-CSE-ConnectionGUID: +OuA/ly6SO2gh4kdg1XHBg== X-CSE-MsgGUID: qXNfgI6xRR+2MkY+hIV7aQ== X-IronPort-AV: E=McAfee;i="6800,10657,11479"; a="70912566" X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="70912566" X-CSE-ConnectionGUID: 5xKOerzsQIiYHsCBmp1uLA== X-CSE-MsgGUID: EUPAmpVhTFajx9Mh8yw9DQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="153549391" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH v3 16/21] qemu: Avoid duplicate FakeReboot for secure guest Date: Mon, 30 Jun 2025 14:17:27 +0800 Message-Id: <20250630061732.303374-17-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250630061732.303374-1-zhenzhong.duan@intel.com> References: <20250630061732.303374-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JDDURIWFXZ6YWCMPTE23GXQVHIHUASV4 X-Message-ID-Hash: JDDURIWFXZ6YWCMPTE23GXQVHIHUASV4 X-MailFrom: zhenzhong.duan@intel.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: phrdina@redhat.com, pkrempa@redhat.com, jjongsma@redhat.com, jsuchane@redhat.com, chenyi.qiang@intel.com, isaku.yamahata@intel.com, xiaoyao.li@intel.com, chao.p.peng@intel.com, Zhenzhong Duan X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1751264933429116600 Content-Type: text/plain; charset="utf-8" For secure guest, FakeReboot kills original QEMU instance and create new one. During this process, QEMU send SHUTDOWN event with "host-signal" reason which can trigger another FakeReboot. Check if a FakeReboot is ongoing and bypass "host-signal" processing which originally comes from FakeReboot. Signed-off-by: Zhenzhong Duan Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1608fa86cd..ae3b13cdb2 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1073,6 +1073,16 @@ qemuMonitorEmitShutdown(qemuMonitor *mon, virTristat= eBool guest, * with it here. */ if (vm->def->sec && vm->def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_TDX) { + qemuDomainObjPrivate *priv =3D vm->privateData; + + /* For secure guest, FakeReboot kills original QEMU instance and + * create new one. During this process, QEMU send SHUTDOWN event + * with "host-signal" reason which can trigger another FakeReboot. + * Check if a FakeReboot is ongoing and bypass "host-signal" + * processing which is originally come from FakeReboot. */ + if (priv->fakeReboot && STREQ_NULLABLE(reason, "host-signal")) + return; + if ((STREQ_NULLABLE(reason, "guest-shutdown") && vm->def->onPoweroff =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTAR= T) || (STREQ_NULLABLE(reason, "guest-reset") && --=20 2.34.1