From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.8 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796039750; b=uSz1K2WSelyRujPaUdaTt5PtcPHYTimuQNi0Hl1aVA+TkHTpYeIlno5+v4YCCj5jiKeC UtrRJDUZIKUTH9GAy+oHHeueTt48zVGWixhE4kAE17SxT7vurUEbsTWcKyxKg7tECojDE VzTdi/kG85ZGPj5BDNQM0cDfCItuUvjaqCVh7vjniv9/Pkpvr8ONoYyo6hj+L1yGuaFrZ IT4+HxrF2RFzCk+D9aJD5fw/Pu3197DRwvEdwP0qJlmU/yxCQDnqrJPILFpqTBY1hzE3N 9dUgsLOYxEcJndyZDxHDbWuGhhulbQJOcd0rb3sTfpYyzZu92XGB47YsHJzn1BKynxQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796039750; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:Date:To:cc: Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type: Content-ID; bh=V2SXhlqA0yy+LVoMTLg85MK6Wd+sRw8Vbw8iS1YHuoc=; b=lvhMFIz3PpDXKmJ8NwU+K6YFus02nH1vjQ+vUJGzvMIi6R3tfzYjILYh04sLdYM2cFyW 6JuIjn8+Jxje/muQWa4ycvwqRPKEdJ/w1+7LjoeSF8X6fLUomY2GTzKJ6tYTX/7fJ3GM2 oK1BJolbAkSIwYrezHGJ9nc3MrLSzk7AKuTnuo1Gt96lkkE2YnRFk2YUopaR9sxALlgHz 5Al2En8XOXzPLTb8D3ggmj0HvD2OHIrCpFxRdFBEn/9Ii+DXBojq1kSvt1X6g38blziE3 ROP/uJU7KQyfreN+3DLVd+sfbuHWAjHJCTLJDXl7A9WiItkSSZQ4psixrxfJ7GmMQWw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="i/pKBf2E"; arc=none smtp.remote-ip=192.198.163.8 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E01606A31C for ; Mon, 30 Nov 2026 11:55:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36E01606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=i/pKBf2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796039749; x=1827575749; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=V2SXhlqA0yy+LVoMTLg85MK6Wd+sRw8Vbw8iS1YHuoc=; b=i/pKBf2Eakwk4/aT5NwdLzdC6RZ1CucmQkG4ajcAjzycFHzZ3b7S6RXR uFpUvLGOK53sOVfaOMaL59Go2VdE5FjKjgw9s76XBISqcJe65ISNxhZdG Qaxr+kTIrID9HGRKEnAQ5uRiAN6XzGg4mi/18K95LpKFhnBfcCLoOcCUF CkqSGxiBveGBofOIyC9RMzHDXLSMHWYeQeOXNvIUSDArDKWxuHjhErVAv RsvrtUTpl+BgqgI488lKH/DgxSVzRpUsp0r2eAJylCxf5F0T80EBhD5ct ZxKEO+I1+9x+hHtx41qyS0OZgkzjvY0jHuzfBmpEJeEr9S67jmpYq0HnN g==; X-CSE-ConnectionGUID: 8bzjSAF/S4GK1NLlEuOw+g== X-CSE-MsgGUID: FHExm1UBTCWxf7jWpB5TWg== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4747124" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4747124" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 03:55:48 -0800 X-CSE-ConnectionGUID: dLPnkJfGQeqmfUiG0Qgrxg== X-CSE-MsgGUID: 6cuiMvx8R/W+KHrJPHsYPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="13519376" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.112]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 03:55:46 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Mon, 30 Nov 2026 13:55:43 +0200 (EET) To: bjorn@helgaas.com, Mario Limonciello cc: linux-pci@vger.kernel.org Subject: Re: Fwd: [Bug 222345] New: [REGRESSION] PCI: bridge window sized as plain sum of children loses NVMe/NIC/GPU behind chipset bridge on X670E (6.12 OK, 7.3 broken) In-Reply-To: Message-ID: <577d5815-afd4-7a59-b883-ff8a968ed62f@linux.intel.com> References: X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323328-1945347051-1796039051=:21476" Content-ID: <14ec41a4-32d2-b189-4f09-9effde185896@linux.intel.com> This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1945347051-1796039051=:21476 Content-Type: text/plain; CHARSET=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: <9b572031-e6f6-605d-b04c-437cb7f7f7cc@linux.intel.com> On Sun, 29 Nov 2026, Bjorn Helgaas wrote: > [reporter in bcc] >=20 > Reporter believes this regression is caused by 3958bf16e2fe ("PCI: > Stop over-estimating bridge window size") =2E..Reporter also seems to have found out the in-flight resource placement= =20 fix & generalizaion series (or a part of it, to be more precise) already=20 solves the problem. =2E..And that series seems stalled because of the quirk investigation=20 doesn't seem to make that much progress. > ---------- Forwarded message --------- > From: > Date: Sat, Nov 28, 2026 at 9:04=E2=80=AFPM > Subject: [Bug 222345] New: [REGRESSION] PCI: bridge window sized as > plain sum of children loses NVMe/NIC/GPU behind chipset bridge on > X670E (6.12 OK, 7.3 broken) > To: >=20 >=20 > https://bugzilla.kernel.org/show_bug.cgi?id=3D222345 >=20 > Bug ID: 222345 > Summary: [REGRESSION] PCI: bridge window sized as plain sum of > children loses NVMe/NIC/GPU behind chipset bridge on > X670E (6.12 OK, 7.3 broken) > Product: Drivers > Version: 2.5 > Hardware: All > OS: Linux > Status: NEW > Severity: blocking > Priority: P3 > Component: PCI > Assignee: drivers_pci@kernel-bugs.osdl.org > Reporter: bloodviri@gmail.com > Regression: No >=20 > Created attachment 311619 > --> https://bugzilla.kernel.org/attachment.cgi?id=3D311619&action=3Dedi= t > dmesg logs for the X670E PCI bridge window regression (broken, pci=3Dreal= loc, > acpi_enforce_resources=3Dlax, v5-gap-fixed) plus the diagnostic patch and= full > report text; see README.txt inside the archive >=20 > Summary > ------- >=20 > Since the bridge window sizing change in 3958bf16e2fe ("PCI: Stop > over-estimating bridge window size"), the memory window of root port > 0000:00:02.1 on this X670E system is sized to exactly the sum of its > child windows (41 MiB) instead of being rounded up to the head > alignment (56 MiB on 6.12). The second child branch (04:08.0, which > carries GPU4, a network controller, the root NVMe, USB 3.2 and SATA) > then no longer fits and all devices below it fail to get resources. > On 6.12.117 the same topology works. >=20 > The 41 MiB window is exactly the sum of the two child windows, so the > allocation succeeds only if the children can be packed back to back. > At least one child is a composite (non power of two) window, so that > packing is not always possible, and the window is not grown by any gap. >=20 > Environment > ----------- >=20 > Mainboard: AMD X670E chipset, Ryzen 9 7900X > GPUs: 4 x NVIDIA RTX 3090 > Distro: Manjaro, kernel 7.3.4-3-MANJARO (vanilla 7.3.4) > Working: 6.12.117, same machine, same BIOS settings >=20 > PCI topology (relevant part): >=20 > 0000:00:02.1 root port > 0000:03:00.0 bridge > 0000:04:00.0 bridge -> GPU3 > 0000:04:08.0 bridge -> GPU4, NIC, NVMe (Samsung 980 PRO, root > filesystem), USB 3.2 xHCI, SATA AHCI >=20 > Observed behaviour (7.3.4) > --------------------------- >=20 > pci 0000:00:02.1: bridge window [mem 0xd8000000-0xdb4fffff]: can't clai= m; > address conflict with AMDIF031:00 [mem 0xd9200000-0xd9200fff] > pci 0000:00:02.1: bridge window [mem 0xf2000000-0xf48fffff]: assigned > pci 0000:04:08.0: bridge window [mem size 0x01500000]: can't assign; no= space > pci 0000:0b:00.0: BAR 0 [mem size 0x00004000 64bit]: can't assign; no s= pace > nvme 0000:0b:00.0: error -ENODEV: probe failed >=20 > The window at 0xf2000000 is 0x02900000 (41 MiB). The child window > of 04:08.0 needs 0x01500000 (21 MiB). >=20 > Expected behaviour (6.12.117, same machine) > ------------------------------------------- >=20 > pci 0000:00:02.1: bridge window [mem 0xf2000000-0xf57fffff]: assigned >=20 > i.e. 0x03800000 (56 MiB). All four GPUs, the NVMe, the NIC, USB and > SATA get resources and the system boots normally. >=20 > The "can't claim; address conflict with AMDIF031:00" line is also > present on 6.12 and is non-fatal there (firmware SSDT declares a > Memory32Fixed _CRS inside the firmware-assigned window). The > regression is in the re-assignment step that follows, not in the > conflict itself. >=20 > Suspected cause > --------------- >=20 > drivers/pci/setup-bus.c, pbus_size_mem() in 7.3.4: >=20 > win_align =3D pci_min_window_alignment(bus, b_res->flags); > min_align =3D calculate_head_align(aligns, max_order); > min_align =3D max(min_align, win_align); > size0 =3D calculate_memsize(size, realloc_head ? 0 : add_size, > 0, win_align); > ... > resource_set_range(b_res, min_align, size0); >=20 > The window *start* is aligned to min_align (head alignment), but the > window *size* is only aligned to win_align, which is 1 MiB. This is intentional. The alignment here only makes sure we don't violate PCI spec / arch window= =20 granularity (usually 1M). Sizing is complex and cannot really be=20 translated easily into since alignment rule like this without resulting=20 major overestimation space required (which would bring back a number of=20 problems that have been fixed by in this area over the last 3 years).=20 Thus, I added the separate gap calculator in the fix series you seem to=20 have found out. > Up to > 3958bf16e2fe the size was passed min_align: >=20 > - size0 =3D calculate_memsize(size, min_size, 0, 0, old_siz= e, > min_align); > + size0 =3D calculate_memsize(size, min_size, 0, 0, old_siz= e, > win_align); >=20 > so the room needed to place children that cannot be packed gaplessly > is no longer reserved. Here that room is 41 MiB -> 56 MiB. >=20 > calculate_head_align() (introduced by bc75c8e50711, "PCI: Rewrite > bridge window head alignment function") guarantees a gapless layout > only when the children can be placed back to back in decreasing > alignment order. At least one child window on bus 03 (04:08.0, 21 MiB) > is a composite size, so back-to-back placement is not possible and the > window needs an explicit gap. The window size is not grown by such a > gap, so the second child is left without space. >=20 > Verification of the diagnosis > ----------------------------- >=20 > Passing min_align instead of win_align to both calculate_memsize() > calls in pbus_size_mem() (i.e. restoring the 6.12 argument) and > rebuilding 7.3.4 makes the root port window 96 MiB; every device below > it, and all four GPUs, get resources and the system boots. This is > only a diagnostic, not a proposed upstream fix, because padding the > window up to min_align can waste a lot of address space when min_align > is large. >=20 > Already tried, no effect > ------------------------ >=20 > pci=3Drealloc, pci=3Dnocrs, pci=3Dbig_root_window, > acpi_enforce_resources=3Dlax, module_blacklist=3Dgpio_amdpt, > Above 4G decoding on/off, ReBAR on/off. >=20 > Related reports and current upstream state > ------------------------------------------ >=20 > I could not find an existing report for this exact setup. The closest > ones are: >=20 > https://bugzilla.kernel.org/show_bug.cgi?id=3D221493 > X870E, same AMDIF031 conflict at 00:02.1, 6.12 OK / 6.18 broken. > Resolved as CODE_FIX by the 10-patch series whose central patch is > 9036bd0efcb6 ("PCI: Align head space better"). Note that 7.3.4 > already contains that fix, so this is a further case that the > head-space relocation does not cover: the window itself is too > small, and relocating the remainder inside it cannot help. >=20 > https://bugzilla.kernel.org/show_bug.cgi?id=3D221205 > "pci=3Drealloc fails on 6.18.16 and 6.19.6", traced to > 3958bf16e2fe as well. >=20 >=20 > https://lore.kernel.org/linux-pci/a5f23340-2b84-4734-be11-f5a97c188195@ap= p.fastmail.com/ > [REGRESSION] amdgpu with Thunderbolt eGPU bracket fails since new > bridge window alignment calculation code, bisected to 3958bf16e2fe > (b855d99 in 6.18.y). >=20 > https://lore.kernel.org/linux-pci/20261108015109.65207-1-doug@calobrisi= =2Ecom/ > Test of "[PATCH v5 00/14] PCI: Resource placement algorithm fixes" > on v7.4-rc1 with four R9700s and two RTX 3090s: unpatched, the > switch window is sized as the plain sum of its child windows and > GPUs lose BARs; with v5 everything is assigned. >=20 > Mainline as of v7.4-rc4 (drivers/pci/setup-bus.c is byte-identical to > v7.3.4 here) still passes win_align, so the window is still sized as > the plain sum. The fix appears to be patch 13/14 of the v5 series, > "PCI: Fix composite resource sizing" (Fixes: 9036bd0efcb6), which adds > a gap to the window size returned by pbus_size_mem() (__pbus_size_mem() > after the refactoring done earlier in that series): >=20 > - return ALIGN(max(winsize, min_size), win_align); > + return ALIGN(max(winsize + gap, min_size), win_align); >=20 > Series and patch (links): >=20 > [PATCH v5 00/14] PCI: Resource placement algorithm fixes > Ilpo J=C3=A4rvinen, 2026-11-06 >=20 > https://lore.kernel.org/linux-pci/20261106134341.39493-1-ilpo.jarvinen@li= nux.intel.com/ >=20 > [PATCH v5 13/14] PCI: Fix composite resource sizing >=20 > https://lore.kernel.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@l= inux.intel.com/ >=20 > (mirror, if the above is unreachable: >=20 > https://lore-kernel.gnuweeb.org/linux-pci/20261106134341.39493-14-ilpo.ja= rvinen@linux.intel.com/raw > ) >=20 > Question > -------- >=20 > Is the failure above the case that "PCI: Fix composite resource > sizing" is meant to cover? >=20 > Test result > ----------- >=20 > I backported the gap calculation of patch 13/14 > (https://lore.kernel.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@= linux.intel.com/) > to the pre-refactoring shape of pbus_size_mem() as found in v7.3.4 (the > series itself does not apply there because __pbus_size_mem() only exists > after patches 10-12 of the series). With that change alone on top of > v7.3.4: >=20 > pci 0000:00:02.1: bridge window [mem 0x40000000-0x452fffff]: assigned >=20 > i.e. 0x05300000 (83 MiB) instead of 41 MiB, and everything below it > is assigned: >=20 > pci 0000:04:08.0: bridge window [mem 0x41c00000-0x43ffffff]: assigned > pci 0000:0b:00.0: BAR 0 [mem 0x41d00000-0x41d03fff 64bit]: assigned > nvme nvme1: pci function 0000:0b:00.0 (no -ENODEV) >=20 > All four RTX 3090s enumerate, all three NVMe SSDs probe, the system > boots to a working desktop. The window is 83 MiB, i.e. smaller than > the 96 MiB obtained by reverting to the pre-3958bf16e2fe argument, > which confirms that the gap is sized to the actual packing loss > rather than rounded up to min_align. >=20 > So the v5 approach fixes this case. I am happy to test the actual v5 > series on this machine (4 x RTX 3090 behind a chipset bridge, root > NVMe on the affected branch) and report back with a Tested-by if it > holds. So it helped. ...I don't know why you only took a single patch and didn't= =20 test the whole series. The full series would have likely applied cleanly=20 on top of 7.3.4. ;-) The gap calculation is expected to help multi-GPU setups. But without the= =20 other patches, the placement may still find dead-ends in some cases=20 (though it often works on its own because of the existing remainder=20 logic). > If not, I can provide full dmesg with dyndbg=3D"file drivers/pci/*.c +p" > and /proc/iomem for both 6.12.117 and 7.3.4. I don't think logs are needed because v5 series solves the issue for you.= =20 Unfortunately, the series seems stalled so I don't know when it ends up=20 into mainline. --=20 i. --8323328-1945347051-1796039051=:21476--