From nobody Wed Nov 27 17:29:48 2024 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; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1697730113; cv=none; d=zohomail.com; s=zohoarc; b=a9oTEHi5gmhyZYYV2/weo/bbe4OedznLKIm0e82SORPVPNIEV9OiJwwPrV/P87aLPnNdBY3VMzn6lWAYPn+9tCeQjYYpsUJBQf5JUm2asyXZlF6a2FYw+45TW4kTJu8GAS/zffRxE/UT6DtvbJKIuPUhW1SyU555xt2cYLLQDMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697730113; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ASyx27ABg/WdxWXFMwdeXHtm2HUFOe8n8pbrbgV+R1U=; b=H3l1CXRp4q9woeloIRZB0c4Sx43zJ/6frzrEfqyoWvufsDV2dXstylSBSlwza7ecMBKSOHlzq+6N0qfJZFbDbvNTY0mL+uKS/yfhiglaE8Vva1XGsHC+dUm6Gjzz3pOvmPPKQgZ1VTcu+DIqNpct2NyTEj0wBU3TEstCECWvpf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 169773011315098.47896469030195; Thu, 19 Oct 2023 08:41:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.619425.964528 (Exim 4.92) (envelope-from ) id 1qtV8w-0000yY-Vp; Thu, 19 Oct 2023 15:41:02 +0000 Received: by outflank-mailman (output) from mailman id 619425.964528; Thu, 19 Oct 2023 15:41:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtV8w-0000ty-3g; Thu, 19 Oct 2023 15:41:02 +0000 Received: by outflank-mailman (input) for mailman id 619425; Thu, 19 Oct 2023 15:40:58 +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 1qtV8r-0006dc-Va for xen-devel@lists.xenproject.org; Thu, 19 Oct 2023 15:40:57 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e3ac646c-6e95-11ee-9b0e-b553b5be7939; Thu, 19 Oct 2023 17:40:54 +0200 (CEST) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qtV8N-007osu-Ka; Thu, 19 Oct 2023 15:40:27 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qtV8M-000Pun-2t; Thu, 19 Oct 2023 16:40:26 +0100 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 X-Inumbo-ID: e3ac646c-6e95-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=ASyx27ABg/WdxWXFMwdeXHtm2HUFOe8n8pbrbgV+R1U=; b=Q+6ncjmIFo7hTNy+ZtPc79xrDg U0NPXNlvZPU1d6HeGintbbtqvIYEobGpIB0sVq48i90OOnNVC0x5hreYF3WC+S7oFhdU/13C0cLWM UrhTnsczsHoP4H+j6SHuGqaEn2fGYbMjx7xUkY9vRx883FDUmsO01FIdAmlwBby8fb35TEO/07CkS 4au4CXHmp+EBgIGBx39jcVmNxzfU0dKzcCq80PArVikh/em2Z8PYOnQPSUv2S0RwM2XY7x4eVYYGR wbhOd/4VV4zgWXwR8ewuYpktTU6ZEdD0hc2QTnjpwZ4IEaguUj3sAUgXLdwxiyp7sVTNcpGVQwFAF xn1VjjWw==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Kevin Wolf , Hanna Reitz , Stefano Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Jason Wang , Marcelo Tosatti , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , qemu-block@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Bernhard Beschow , Joel Upham Subject: [PATCH v2 17/24] hw/xen: only remove peers of PCI NICs on unplug Date: Thu, 19 Oct 2023 16:40:13 +0100 Message-Id: <20231019154020.99080-18-dwmw2@infradead.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231019154020.99080-1-dwmw2@infradead.org> References: <20231019154020.99080-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1697730115291100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse When the Xen guest asks to unplug *emulated* NICs, it's kind of unhelpful also to unplug the peer of the *Xen* PV NIC. Signed-off-by: David Woodhouse --- hw/i386/xen/xen_platform.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index 17457ff3de..e2dd1b536a 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -140,9 +140,14 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *= o) /* Remove the peer of the NIC device. Normally, this would be a tap device= . */ static void del_nic_peer(NICState *nic, void *opaque) { - NetClientState *nc; + NetClientState *nc =3D qemu_get_queue(nic); + ObjectClass *klass =3D module_object_class_by_name(nc->model); + + /* Only delete peers of PCI NICs that we're about to delete */ + if (!klass || !object_class_dynamic_cast(klass, TYPE_PCI_DEVICE)) { + return; + } =20 - nc =3D qemu_get_queue(nic); if (nc->peer) qemu_del_net_client(nc->peer); } --=20 2.40.1