From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FAF4CA0EFA for ; Tue, 26 Aug 2025 10:58:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1094329.1449648 (Exim 4.92) (envelope-from ) id 1uqrNH-0001XW-Ox; Tue, 26 Aug 2025 10:57:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1094329.1449648; Tue, 26 Aug 2025 10:57:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uqrNH-0001XP-Kg; Tue, 26 Aug 2025 10:57:59 +0000 Received: by outflank-mailman (input) for mailman id 1094329; Tue, 26 Aug 2025 10:57:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uqrNG-0001XH-27 for xen-devel@lists.xenproject.org; Tue, 26 Aug 2025 10:57:58 +0000 Received: from fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 846f9078-826b-11f0-a32c-13f23c93f187; Tue, 26 Aug 2025 12:57:55 +0200 (CEST) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id C1D361D00178; Tue, 26 Aug 2025 06:57:53 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Tue, 26 Aug 2025 06:57:53 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Aug 2025 06:57:52 -0400 (EDT) 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: 846f9078-826b-11f0-a32c-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1756205873; x=1756292273; bh=FpvDcoY/i89amBfbg856eFmlD/GJra+fiQBad2nf+fc=; b= OcZLKJpoXZQXvq+brn1q5snT7WmUL7/Tf7LXZD7ylaAqcYuUjEfj11aWdVIcSodL O/eGYukKZtgUIP3dC1RCIeG7JTAaLYVZx8DRzOnauOsNjxSdTiUBogLuuRllFrWY 1QazxnpMCj2osTIeJTckzQB1c8ZBzjSMN9bUiufWu8VBmovg4mH3dx8P2tsTHQrA 2jsH6FCxUeO79DzJgpdgFyYN6iTLYv/EKrtnfT/gOkK3wltzn+l3ZYaEFLenGT9h y9LDK48Q9eEeNnJyE/ubHjQsfpmCeTBIwHNPGLWXpMDyqeGOyY0Vv0hl1N3dZ+B1 r9ShmuNa4eksnMpUVJM9yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756205873; x=1756292273; bh=FpvDcoY/i89amBfbg856eFmlD/GJra+fiQB ad2nf+fc=; b=kjjHr9jrojNKUPfV+ZeBhixw0SIX87l1bSTh5mu9UDMoA16Xaay kVFs2fiPBp3Z7gXWbL8LGLAdSLrhOjUabfrnHa1ze6SUpTuffeGneIij2vWe79F7 o1Cq5iikPUyCCecBCeOjKUlvTQiV9df//34clPayIbI9yWc4vUTJHqY+iGLDp5iO p8JMrkDf6eBAv2TgoQiP+NjEux2DLzu14yMnxGD1dLCcbdEwRQ1ZNGbR99Ou3tau hJjS390AhiW/ENdAPxoVO1hsINcZ5P6xuVFO5U4ZbaWnDnHrr9HSaEdHV5QOki5g aJA5pZ1f6+UgZ7pqHPpd9HtdBzeM04oxayw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeehtdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofgrrhgvkhcu ofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinhhvih hsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepueekteet gefggfekudehteegieeljeejieeihfejgeevhfetgffgteeuteetueetnecuffhomhgrih hnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehmrghrmhgrrhgvkhesihhnvhhishhisghlvghthhhinhhgshhlrg gsrdgtohhmpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphht thhopehrohhgvghrrdhprghusegtihhtrhhigidrtghomhdprhgtphhtthhopehjsggvuh hlihgthhesshhushgvrdgtohhmpdhrtghpthhtohepgigvnhdquggvvhgvlheslhhishht shdrgigvnhhprhhojhgvtghtrdhorhhg X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Date: Tue, 26 Aug 2025 12:57:50 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Roger Pau =?utf-8?B?TW9ubsOp?= Cc: Jan Beulich , xen-devel Subject: Re: MSI-X cleanup(?) issue with passthrough after domU restart Message-ID: References: <2aafbace-3aa2-4f58-8f6c-2815cd2315ad@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h8MF4Jebq8oeROdV" Content-Disposition: inline In-Reply-To: --h8MF4Jebq8oeROdV Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Aug 2025 12:57:50 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Roger Pau =?utf-8?B?TW9ubsOp?= Cc: Jan Beulich , xen-devel Subject: Re: MSI-X cleanup(?) issue with passthrough after domU restart On Tue, Aug 26, 2025 at 10:28:56AM +0200, Roger Pau Monn=C3=A9 wrote: > On Tue, Aug 26, 2025 at 08:16:56AM +0200, Jan Beulich wrote: > > On 26.08.2025 03:49, Marek Marczykowski-G=C3=B3recki wrote: > > > Hi, > > >=20 > > > I'm hitting an MSI-X issue after rebooting the domU. The symptoms are > > > rather boring: on initial domU start the device (realtek eth card) wo= rks > > > fine, but after domU restart, the link doesn't come up (there is no > > > "Link is Up" message anymore). No errors from domU driver or Xen. I > > > tracked it down to MSI-X - if I force INTx (via pci=3Dnomsi on domU > > > cmdline) it works fine. Convincing the driver to poll instead of wait= ing > > > for an interrupt also workarounds the issue. > > >=20 > > > I noticed also some interrupts are not cleaned up on restart. The list > > > of MSIs in 'Q' debug key output grows: > > >=20 > > > (XEN) 0000:03:00.0 - d22 - node -1 - MSIs < 41 42 43 44 45 46 47= > > > > restart sys-net domU > > > (XEN) 0000:03:00.0 - d24 - node -1 - MSIs < 41 42 43 44 45 46 47= 48 > > > > restart sys-net domU > > > (XEN) 0000:03:00.0 - d26 - node -1 - MSIs < 41 42 43 44 45 46 47= 48 49 > > > >=20 > > > and 'M' output is: > > >=20 > > > (XEN) MSI-X 41 vec=3Db1 lowest edge assert log lowest dest= =3D00000001 mask=3D1/H /1 > > > (XEN) MSI-X 42 vec=3Db9 lowest edge assert log lowest dest= =3D00000004 mask=3D1/HG/1 > > > (XEN) MSI-X 43 vec=3Dc1 lowest edge assert log lowest dest= =3D00000010 mask=3D1/HG/1 > > > (XEN) MSI-X 44 vec=3Dd9 lowest edge assert log lowest dest= =3D00000001 mask=3D1/HG/1 > > > (XEN) MSI-X 45 vec=3De1 lowest edge assert log lowest dest= =3D00000001 mask=3D1/HG/1 > > > (XEN) MSI-X 46 vec=3De9 lowest edge assert log lowest dest= =3D00000040 mask=3D1/HG/1 > > > (XEN) MSI-X 47 vec=3D32 lowest edge assert log lowest dest= =3D00000004 mask=3D1/HG/1 > > > (XEN) MSI-X 48 vec=3D3a lowest edge assert log lowest dest= =3D00000040 mask=3D1/HG/1 > > > (XEN) MSI-X 49 vec=3D42 lowest edge assert log lowest dest= =3D00000010 mask=3D1/ G/1 > > >=20 > > > And also, after starting and stopping the domU, `xl pci-assignable-re= move 03:00.0` > > > makes pciback to complain: > > >=20 > > > [ 1180.919874] pciback 0000:03:00.0: xen_pciback: MSI-X release f= ailed (-16) > > >=20 > > > This is all running on Xen 4.19.3, but I don't see much changes in th= is > > > area since then. > > >=20 > > > Some more info collected at https://github.com/QubesOS/qubes-issues/i= ssues/9335 > > >=20 > > > My question is: what should be responsible for this cleanup on domain > > > destroy? Xen, or maybe device model (which is QEMU in stubdomain here= )? > >=20 > > The expectation is that qemu invokes the necessary cleanup, but of cour= se ... > >=20 > > > I see some cleanup (apparently not enough) happening via QEMU when the > > > domU driver is unloaded, but logically correct cleanup shouldn't depe= nd > > > on correct domU operation... > >=20 > > ... Xen may not make itself dependent upon either DomU or QEMU. >=20 > AFAICT free_domain_pirqs() called by arch_domain_destroy() should take > care of unbinding and freeing pirqs (but obviously not in this case). > Can you repeat the test with a debug=3Dy hypervisor and post the > resulting serial or dmesg here? Some of the errors on those paths are > printed with dprintk() and won't be visible unless using a Xen debug > build. Sure, will do. > > What I find puzzling (assuming I can take the quoted output plus your a= nnotations > > verbatim) is that the device apparently uses multiple vectors,=20 No, that was not the first domU restart before I started collecting this output. At fresh boot there is just one vector. > > and we're leaking > > exactly one of them. Also, since reboot is generally nothing else than = shutdown > > and immediate relaunch, is there a leak also after shutdown? I ask beca= use it > > might help to know which of the multiple vectors is leaked (first, last= , random). >=20 > Can we maybe get the output of `lspci -vv` when the device is > attached? Both below on first domU start, when the device still works, but when it breaks it's identical. Collected in dom0: 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8= 211/8411 PCI Express Gigabit Ethernet Controller (rev 06) Subsystem: Gigabyte Technology Co., Ltd Onboard Ethernet Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Steppi= ng- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=3Dfast >TAbort- SERR- TAbort- SERR-