From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796396566; b=G0+/QvispW60C4fPCAiZZMkhkC4Pbw1JmRq42+wNXGaO2J37n9zTMmFrSj3pX2+acez0 Wd4BSe7bMG4bdiJdQLp1oCYZKAGH8qgvqHNw2m1YoJkfer1rfqHwcPLBtkI8bCY1HKwXS zPgdpQOtwzrhVS154Nsy2+O9iFhwyAG8/5WSu0w8CV9i27UoQH/hXPsmwCYS1EDPLqtQW zg2DJ8pOXlDIBpxm33DheaFXn96JDY30/1uTG+CGAYsU2UEpCyiaph0igsj0+WLYOE+3h aIhf5KLO+pxyW2ymMlptHE/eAeF2vVD1HI4bIdU4f4Or5KZjADU4cW045s8G5dIICrQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796396566; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=YqtD4iK4WXF5nboJQqNFCIuUByGuQV2l+bM7JPDv6zI=; b=c2L4CqlN6wiGYfsH0WRaLp/8/81hP9A//AyhJMwHDZoNdPVdGYGB5LzXJRSNsf218kmr G/NfPO+40b8345jwcXA27B3oFX2A/NCgI6+huMiLKLofheFhFZ00aCFGQDEfx5AN1FMaB ttliig2eC1FKr9oEQiuzwxGh5F/Ervm0srv0+pGn3HrUzT/bAM0rF3oMffdBhXRK3Sts7 5m1zsiIP0XlQCEjzHKt8QLICciHeAFkOllcQ8v5j0ZcVSLB9AByc0R4QD3If0uskMBIcc vq2+ngZFYBp2AwqA8hPNTT3Np583bjFxFt4qYl2R5QGLd2pEGBgAULHExw/0ok6CJxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EjHDoaPx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0826E606A322; Fri, 4 Dec 2026 15:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EjHDoaPx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 817A01F000C2; Fri, 4 Dec 2026 15:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796396565; bh=YqtD4iK4WXF5nboJQqNFCIuUByGuQV2l+bM7JPDv6zI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=EjHDoaPxMjuprWg5TM5ywe5HRs3JwDpnKddRs8HX3GFUpzxN82rYmP7xS8ATtJGCo ot9LbsprcdO+0x9gF+8F70j6FTTzIVIcgBUIGK1xuHP/HJA6OTK6IBuKizam4vPDs2 m2vE0G0kB4DUlx6zRLcCpBR0zzNHA+3QOygSpB4/j4NmxhSijG5+uEQUGGXNCDOiBP nT6HT1Van3I0V+gGggZRj38Xq+o1j5gB4C41hO+AJ8j3fIdkqumAzLpPqpjk2aub92 kP5UYcEq7Y2+pAqaeF3P8CUUe0cxtv+hYLY69B2l91VEDXEzKZzuGTvALxZ8BbFiqn u8amuiz7VUVNg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 3/4] PCI: Fix isolated PCI function probing with ARI and SR-IOV Reply-To: sashiko-reviews@lists.linux.dev To: "Niklas Schnelle" Cc: linux-s390 , linux-pci@vger.kernel.org, virtualization@lists.linux.dev, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" , "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261204-ari_no_bus_dev-v6-3-855e75237600@linux.ibm.com> References: <20261204-ari_no_bus_dev-v6-0-855e75237600@linux.ibm.com> <20261204-ari_no_bus_dev-v6-3-855e75237600@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 15:02:45 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] pci: next_fn() skips ARI functions 8..255 on downstream ports - [Medium] PCI: unconditional hypervisor_isolated_pci_functions() adds scan overhead -- commit ae63abdc9ce8242a0676132ebc8d8a1f2843aa23 Author: Niklas Schnelle PCI: Fix isolated PCI function probing with ARI and SR-IOV This commit updates pci_scan_slot() and next_fn() to probe all functions sequentially when hypervisor_isolated_pci_functions() is true, bypassing the ARI next-function chain and multifunction checks. Link: https://lore.kernel.org/linux-pci/d3f11e8562f589ddb2c1c83e74161bd8948= 084c3.camel@linux.ibm.com/ > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index bbce3756f8f8a..404dce0a4f80f 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2825,16 +2825,19 @@ static int next_ari_fn(struct pci_bus *bus, struc= t pci_dev *dev, int fn) > return next_fn; > } > =20 > -static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn) > +static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn, > + bool probe_all_fns) > { > - if (pci_ari_enabled(bus)) > - return next_ari_fn(bus, dev, fn); > + if (!probe_all_fns) { > + if (pci_ari_enabled(bus)) > + return next_ari_fn(bus, dev, fn); > =20 > + /* only multifunction devices may have more functions */ > + if (dev && !dev->multifunction) > + return -ENODEV; > + } > if (fn >=3D 7) > return -ENODEV; > - /* only multifunction devices may have more functions */ > - if (dev && !dev->multifunction) > - return -ENODEV; > =20 > return fn + 1; > } [Severity: High] Does capping fn at 7 when probe_all_fns is true break enumeration of ARI functions 8..255 behind a PCIe Downstream Port? For a PCIe Downstream Port, only_one_child(bus) returns 1 unless PCI_SCAN_ALL_PCIE_DEVS is set. During bus enumeration, devfn 0 now stops at fn 7 and pci_scan_slot() immediately returns 0 for devfn 8..248, assuming devfn 0 already scanned all 256 ARI functions. Similarly, pciehp_configure_device() only calls pci_scan_slot(parent, PCI_DEVFN(0, 0)) once. This is a regression for intact ARI chains when hypervisor_isolated_pci_functions() is true, and it leaves isolated ARI or SR-IOV functions at devfn >=3D 8 undiscovered. When function 0 is missing behind a Downstream Port, pci_configure_ari() also skips setting ari_enabled while only_one_child(bus) still skips devfn > 0. [ ... ] > @@ -2887,11 +2888,12 @@ static bool pci_stop_at_missing_fn0(struct pci_bu= s *bus) > int pci_scan_slot(struct pci_bus *bus, int devfn) > { > struct pci_dev *dev; > + bool probe_all_fns; > int fn =3D 0, nr =3D 0; > =20 > if (only_one_child(bus) && (devfn > 0)) > return 0; /* Already scanned the entire slot */ > - > + probe_all_fns =3D hypervisor_isolated_pci_functions(); [Severity: Medium] Can calling hypervisor_isolated_pci_functions() unconditionally here add noticeable scan and hotplug overhead on non-s390 platforms? Previously it only ran when function 0 was missing, so populated PCI slots, PCIe Downstream Ports, and pciehp_configure_device() skipped it. Now every call invokes jailhouse_paravirt(), which is uncached. On non-x86 CONFIG_OF systems, jailhouse_paravirt() calls of_find_compatible_node(), taking devtree_lock with IRQs disabled to walk the full device tree and causing IRQ latency spikes during hotplug. On x86 guests with CONFIG_JAILHOUSE_GUEST under other hypervisors such as KVM, jailhouse_paravirt() executes 256 CPUID VM-exits per call. Caching the result at boot would avoid this overhead. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-ari_no_bus= _dev-v6-0-855e75237600@linux.ibm.com?part=3D3