From nobody Sun Sep 28 17:07:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17586888051331012.0757716743872; Tue, 23 Sep 2025 21:40:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1128835.1469040 (Exim 4.92) (envelope-from ) id 1v1HHx-0003ws-Lr; Wed, 24 Sep 2025 04:39:33 +0000 Received: by outflank-mailman (output) from mailman id 1128835.1469040; Wed, 24 Sep 2025 04:39:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v1HHx-0003wN-FC; Wed, 24 Sep 2025 04:39:33 +0000 Received: by outflank-mailman (input) for mailman id 1128835; Wed, 24 Sep 2025 04:39:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v1HHu-0003tk-6P for xen-devel@lists.xenproject.org; Wed, 24 Sep 2025 04:39:31 +0000 Received: from www3579.sakura.ne.jp (www3579.sakura.ne.jp [49.212.243.89]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 730b5eda-9900-11f0-9809-7dc792cee155; Wed, 24 Sep 2025 06:39:27 +0200 (CEST) Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 58O4bSmu091795 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Sep 2025 13:37:39 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 730b5eda-9900-11f0-9809-7dc792cee155 DKIM-Signature: a=rsa-sha256; bh=jWpLp8n23CdClF2nwSY2mTKMJfX9C2XmSiyVTvW4DxU=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1758688660; v=1; b=Z/ywqlxOJlUU34+E0osmWrMy3ELkCuh2OmBTrboInpXjOqD4SffZwY/4CYZU9EMl Dzx+hMFZXJ69msVRzYu3/rva7z862cW0LJjoo/7a+OQagfk8KQoAs9iIRpTaSSa0 pt61xjJaSVVPqRurq0vu8rPC19jEuObo8buUpNjAPokMhv64OcpL5QB9Y95TzlPO DlIeieX9/8KQLvSGtaM+M1bC9SwqmIQfS3fxvyYmqXzx7aCq3R7AM6yqLJEfDQ+v CJWE+1FHrkF22D4QuYAryKLCEdfm+xmGbKGgorUxyLRleupCLTsp+J1Kg+Ny5fWK 7e33gFmpWCJMRvhjM4Rrxw== From: Akihiko Odaki Date: Wed, 24 Sep 2025 13:37:21 +0900 Subject: [PATCH v4 2/7] vfio/pci: Do not unparent in instance_finalize() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250924-use-v4-2-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp> References: <20250924-use-v4-0-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250924-use-v4-0-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Aurelien Jarno , Aleksandar Rikalo , Max Filippov , =?utf-8?q?Herv=C3=A9_Poussineau?= , Mark Cave-Ayland , Artyom Tarasenko , Alistair Francis , "Maciej S. Szmigiero" , Bin Meng , Stefano Stabellini , Anthony PERARD , Paul Durrant , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Akihiko Odaki X-Mailer: b4 0.15-dev-179e8 X-ZM-MESSAGEID: 1758688806904116600 Children are automatically unparented so manually unparenting is unnecessary. Worse, automatic unparenting happens before the insntance_finalize() callback of the parent gets called, so object_unparent() calls in the callback will refer to objects that are already unparented, which is semantically incorrect. Signed-off-by: Akihiko Odaki Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/pci.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index d14e96b2f82d..bc0b4c4d562b 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2025,7 +2025,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev) vfio_region_finalize(&bar->region); if (bar->mr) { assert(bar->size); - object_unparent(OBJECT(bar->mr)); g_free(bar->mr); bar->mr =3D NULL; } @@ -2033,9 +2032,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev) =20 if (vdev->vga) { vfio_vga_quirk_finalize(vdev); - for (i =3D 0; i < ARRAY_SIZE(vdev->vga->region); i++) { - object_unparent(OBJECT(&vdev->vga->region[i].mem)); - } g_free(vdev->vga); } } --=20 2.51.0