* 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) [not found] <bug-222345-41252@https.bugzilla.kernel.org/> @ 2026-11-29 23:25 ` Bjorn Helgaas 2026-11-30 11:55 ` Ilpo Järvinen 0 siblings, 1 reply; 4+ messages in thread From: Bjorn Helgaas @ 2026-11-29 23:25 UTC (permalink / raw) To: Ilpo Järvinen, linux-pci [reporter in bcc] Reporter believes this regression is caused by 3958bf16e2fe ("PCI: Stop over-estimating bridge window size") ---------- Forwarded message --------- From: <bugzilla-daemon@kernel.org> Date: Sat, Nov 28, 2026 at 9:04 PM 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: <bjorn@helgaas.com> https://bugzilla.kernel.org/show_bug.cgi?id=222345 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 Created attachment 311619 --> https://bugzilla.kernel.org/attachment.cgi?id=311619&action=edit dmesg logs for the X670E PCI bridge window regression (broken, pci=realloc, acpi_enforce_resources=lax, v5-gap-fixed) plus the diagnostic patch and full report text; see README.txt inside the archive Summary ------- 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. 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. Environment ----------- 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 PCI topology (relevant part): 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 Observed behaviour (7.3.4) --------------------------- pci 0000:00:02.1: bridge window [mem 0xd8000000-0xdb4fffff]: can't claim; 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 space nvme 0000:0b:00.0: error -ENODEV: probe failed The window at 0xf2000000 is 0x02900000 (41 MiB). The child window of 04:08.0 needs 0x01500000 (21 MiB). Expected behaviour (6.12.117, same machine) ------------------------------------------- pci 0000:00:02.1: bridge window [mem 0xf2000000-0xf57fffff]: assigned i.e. 0x03800000 (56 MiB). All four GPUs, the NVMe, the NIC, USB and SATA get resources and the system boots normally. 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. Suspected cause --------------- drivers/pci/setup-bus.c, pbus_size_mem() in 7.3.4: win_align = pci_min_window_alignment(bus, b_res->flags); min_align = calculate_head_align(aligns, max_order); min_align = max(min_align, win_align); size0 = calculate_memsize(size, realloc_head ? 0 : add_size, 0, win_align); ... resource_set_range(b_res, min_align, size0); The window *start* is aligned to min_align (head alignment), but the window *size* is only aligned to win_align, which is 1 MiB. Up to 3958bf16e2fe the size was passed min_align: - size0 = calculate_memsize(size, min_size, 0, 0, old_size, min_align); + size0 = calculate_memsize(size, min_size, 0, 0, old_size, win_align); so the room needed to place children that cannot be packed gaplessly is no longer reserved. Here that room is 41 MiB -> 56 MiB. 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. Verification of the diagnosis ----------------------------- 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. Already tried, no effect ------------------------ pci=realloc, pci=nocrs, pci=big_root_window, acpi_enforce_resources=lax, module_blacklist=gpio_amdpt, Above 4G decoding on/off, ReBAR on/off. Related reports and current upstream state ------------------------------------------ I could not find an existing report for this exact setup. The closest ones are: https://bugzilla.kernel.org/show_bug.cgi?id=221493 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. https://bugzilla.kernel.org/show_bug.cgi?id=221205 "pci=realloc fails on 6.18.16 and 6.19.6", traced to 3958bf16e2fe as well. https://lore.kernel.org/linux-pci/a5f23340-2b84-4734-be11-f5a97c188195@app.fastmail.com/ [REGRESSION] amdgpu with Thunderbolt eGPU bracket fails since new bridge window alignment calculation code, bisected to 3958bf16e2fe (b855d99 in 6.18.y). https://lore.kernel.org/linux-pci/20261108015109.65207-1-doug@calobrisi.com/ 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. 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): - return ALIGN(max(winsize, min_size), win_align); + return ALIGN(max(winsize + gap, min_size), win_align); Series and patch (links): [PATCH v5 00/14] PCI: Resource placement algorithm fixes Ilpo Järvinen, 2026-11-06 https://lore.kernel.org/linux-pci/20261106134341.39493-1-ilpo.jarvinen@linux.intel.com/ [PATCH v5 13/14] PCI: Fix composite resource sizing https://lore.kernel.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/ (mirror, if the above is unreachable: https://lore-kernel.gnuweeb.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/raw ) Question -------- Is the failure above the case that "PCI: Fix composite resource sizing" is meant to cover? Test result ----------- 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: pci 0000:00:02.1: bridge window [mem 0x40000000-0x452fffff]: assigned i.e. 0x05300000 (83 MiB) instead of 41 MiB, and everything below it is assigned: 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) 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. 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. If not, I can provide full dmesg with dyndbg="file drivers/pci/*.c +p" and /proc/iomem for both 6.12.117 and 7.3.4. Thanks, <Alex> -- You are receiving this mail because: You are watching the assignee of the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* 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) 2026-11-29 23:25 ` 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) Bjorn Helgaas @ 2026-11-30 11:55 ` Ilpo Järvinen 2026-12-01 4:36 ` Mario Limonciello 0 siblings, 1 reply; 4+ messages in thread From: Ilpo Järvinen @ 2026-11-30 11:55 UTC (permalink / raw) To: bjorn, Mario Limonciello; +Cc: linux-pci [-- Attachment #1: Type: text/plain, Size: 11835 bytes --] On Sun, 29 Nov 2026, Bjorn Helgaas wrote: > [reporter in bcc] > > Reporter believes this regression is caused by 3958bf16e2fe ("PCI: > Stop over-estimating bridge window size") ...Reporter also seems to have found out the in-flight resource placement fix & generalizaion series (or a part of it, to be more precise) already solves the problem. ...And that series seems stalled because of the quirk investigation doesn't seem to make that much progress. > ---------- Forwarded message --------- > From: <bugzilla-daemon@kernel.org> > Date: Sat, Nov 28, 2026 at 9:04 PM > 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: <bjorn@helgaas.com> > > > https://bugzilla.kernel.org/show_bug.cgi?id=222345 > > 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 > > Created attachment 311619 > --> https://bugzilla.kernel.org/attachment.cgi?id=311619&action=edit > dmesg logs for the X670E PCI bridge window regression (broken, pci=realloc, > acpi_enforce_resources=lax, v5-gap-fixed) plus the diagnostic patch and full > report text; see README.txt inside the archive > > Summary > ------- > > 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. > > 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. > > Environment > ----------- > > 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 > > PCI topology (relevant part): > > 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 > > Observed behaviour (7.3.4) > --------------------------- > > pci 0000:00:02.1: bridge window [mem 0xd8000000-0xdb4fffff]: can't claim; > 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 space > nvme 0000:0b:00.0: error -ENODEV: probe failed > > The window at 0xf2000000 is 0x02900000 (41 MiB). The child window > of 04:08.0 needs 0x01500000 (21 MiB). > > Expected behaviour (6.12.117, same machine) > ------------------------------------------- > > pci 0000:00:02.1: bridge window [mem 0xf2000000-0xf57fffff]: assigned > > i.e. 0x03800000 (56 MiB). All four GPUs, the NVMe, the NIC, USB and > SATA get resources and the system boots normally. > > 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. > > Suspected cause > --------------- > > drivers/pci/setup-bus.c, pbus_size_mem() in 7.3.4: > > win_align = pci_min_window_alignment(bus, b_res->flags); > min_align = calculate_head_align(aligns, max_order); > min_align = max(min_align, win_align); > size0 = calculate_memsize(size, realloc_head ? 0 : add_size, > 0, win_align); > ... > resource_set_range(b_res, min_align, size0); > > 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 granularity (usually 1M). Sizing is complex and cannot really be translated easily into since alignment rule like this without resulting major overestimation space required (which would bring back a number of problems that have been fixed by in this area over the last 3 years). Thus, I added the separate gap calculator in the fix series you seem to have found out. > Up to > 3958bf16e2fe the size was passed min_align: > > - size0 = calculate_memsize(size, min_size, 0, 0, old_size, > min_align); > + size0 = calculate_memsize(size, min_size, 0, 0, old_size, > win_align); > > so the room needed to place children that cannot be packed gaplessly > is no longer reserved. Here that room is 41 MiB -> 56 MiB. > > 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. > > Verification of the diagnosis > ----------------------------- > > 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. > > Already tried, no effect > ------------------------ > > pci=realloc, pci=nocrs, pci=big_root_window, > acpi_enforce_resources=lax, module_blacklist=gpio_amdpt, > Above 4G decoding on/off, ReBAR on/off. > > Related reports and current upstream state > ------------------------------------------ > > I could not find an existing report for this exact setup. The closest > ones are: > > https://bugzilla.kernel.org/show_bug.cgi?id=221493 > 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. > > https://bugzilla.kernel.org/show_bug.cgi?id=221205 > "pci=realloc fails on 6.18.16 and 6.19.6", traced to > 3958bf16e2fe as well. > > > https://lore.kernel.org/linux-pci/a5f23340-2b84-4734-be11-f5a97c188195@app.fastmail.com/ > [REGRESSION] amdgpu with Thunderbolt eGPU bracket fails since new > bridge window alignment calculation code, bisected to 3958bf16e2fe > (b855d99 in 6.18.y). > > https://lore.kernel.org/linux-pci/20261108015109.65207-1-doug@calobrisi.com/ > 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. > > 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): > > - return ALIGN(max(winsize, min_size), win_align); > + return ALIGN(max(winsize + gap, min_size), win_align); > > Series and patch (links): > > [PATCH v5 00/14] PCI: Resource placement algorithm fixes > Ilpo Järvinen, 2026-11-06 > > https://lore.kernel.org/linux-pci/20261106134341.39493-1-ilpo.jarvinen@linux.intel.com/ > > [PATCH v5 13/14] PCI: Fix composite resource sizing > > https://lore.kernel.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/ > > (mirror, if the above is unreachable: > > https://lore-kernel.gnuweeb.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/raw > ) > > Question > -------- > > Is the failure above the case that "PCI: Fix composite resource > sizing" is meant to cover? > > Test result > ----------- > > 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: > > pci 0000:00:02.1: bridge window [mem 0x40000000-0x452fffff]: assigned > > i.e. 0x05300000 (83 MiB) instead of 41 MiB, and everything below it > is assigned: > > 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) > > 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. > > 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 test the whole series. The full series would have likely applied cleanly on top of 7.3.4. ;-) The gap calculation is expected to help multi-GPU setups. But without the other patches, the placement may still find dead-ends in some cases (though it often works on its own because of the existing remainder logic). > If not, I can provide full dmesg with dyndbg="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. Unfortunately, the series seems stalled so I don't know when it ends up into mainline. -- i. ^ permalink raw reply [flat|nested] 4+ messages in thread
* 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) 2026-11-30 11:55 ` Ilpo Järvinen @ 2026-12-01 4:36 ` Mario Limonciello 2026-12-01 6:26 ` Maciej Grochowski 0 siblings, 1 reply; 4+ messages in thread From: Mario Limonciello @ 2026-12-01 4:36 UTC (permalink / raw) To: Ilpo Järvinen, bjorn; +Cc: linux-pci On 11/30/26 05:55, Ilpo Järvinen wrote: > On Sun, 29 Nov 2026, Bjorn Helgaas wrote: > >> [reporter in bcc] >> >> Reporter believes this regression is caused by 3958bf16e2fe ("PCI: >> Stop over-estimating bridge window size") > > ...Reporter also seems to have found out the in-flight resource placement > fix & generalizaion series (or a part of it, to be more precise) already > solves the problem. > > ...And that series seems stalled because of the quirk investigation > doesn't seem to make that much progress. I guess my take on this is that we should do the revert and play wack a mole to add quirks if people come out of the wood work. Those systems are relatively old though, maybe people won't even show up. Your approach is most certainly more correct. > >> ---------- Forwarded message --------- >> From: <bugzilla-daemon@kernel.org> >> Date: Sat, Nov 28, 2026 at 9:04 PM >> 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: <bjorn@helgaas.com> >> >> >> https://bugzilla.kernel.org/show_bug.cgi?id=222345 >> >> 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 >> >> Created attachment 311619 >> --> https://bugzilla.kernel.org/attachment.cgi?id=311619&action=edit >> dmesg logs for the X670E PCI bridge window regression (broken, pci=realloc, >> acpi_enforce_resources=lax, v5-gap-fixed) plus the diagnostic patch and full >> report text; see README.txt inside the archive >> >> Summary >> ------- >> >> 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. >> >> 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. >> >> Environment >> ----------- >> >> 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 >> >> PCI topology (relevant part): >> >> 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 >> >> Observed behaviour (7.3.4) >> --------------------------- >> >> pci 0000:00:02.1: bridge window [mem 0xd8000000-0xdb4fffff]: can't claim; >> 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 space >> nvme 0000:0b:00.0: error -ENODEV: probe failed >> >> The window at 0xf2000000 is 0x02900000 (41 MiB). The child window >> of 04:08.0 needs 0x01500000 (21 MiB). >> >> Expected behaviour (6.12.117, same machine) >> ------------------------------------------- >> >> pci 0000:00:02.1: bridge window [mem 0xf2000000-0xf57fffff]: assigned >> >> i.e. 0x03800000 (56 MiB). All four GPUs, the NVMe, the NIC, USB and >> SATA get resources and the system boots normally. >> >> 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. >> >> Suspected cause >> --------------- >> >> drivers/pci/setup-bus.c, pbus_size_mem() in 7.3.4: >> >> win_align = pci_min_window_alignment(bus, b_res->flags); >> min_align = calculate_head_align(aligns, max_order); >> min_align = max(min_align, win_align); >> size0 = calculate_memsize(size, realloc_head ? 0 : add_size, >> 0, win_align); >> ... >> resource_set_range(b_res, min_align, size0); >> >> 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 > granularity (usually 1M). Sizing is complex and cannot really be > translated easily into since alignment rule like this without resulting > major overestimation space required (which would bring back a number of > problems that have been fixed by in this area over the last 3 years). > Thus, I added the separate gap calculator in the fix series you seem to > have found out. > >> Up to >> 3958bf16e2fe the size was passed min_align: >> >> - size0 = calculate_memsize(size, min_size, 0, 0, old_size, >> min_align); >> + size0 = calculate_memsize(size, min_size, 0, 0, old_size, >> win_align); >> >> so the room needed to place children that cannot be packed gaplessly >> is no longer reserved. Here that room is 41 MiB -> 56 MiB. >> >> 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. >> >> Verification of the diagnosis >> ----------------------------- >> >> 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. >> >> Already tried, no effect >> ------------------------ >> >> pci=realloc, pci=nocrs, pci=big_root_window, >> acpi_enforce_resources=lax, module_blacklist=gpio_amdpt, >> Above 4G decoding on/off, ReBAR on/off. >> >> Related reports and current upstream state >> ------------------------------------------ >> >> I could not find an existing report for this exact setup. The closest >> ones are: >> >> https://bugzilla.kernel.org/show_bug.cgi?id=221493 >> 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. >> >> https://bugzilla.kernel.org/show_bug.cgi?id=221205 >> "pci=realloc fails on 6.18.16 and 6.19.6", traced to >> 3958bf16e2fe as well. >> >> >> https://lore.kernel.org/linux-pci/a5f23340-2b84-4734-be11-f5a97c188195@app.fastmail.com/ >> [REGRESSION] amdgpu with Thunderbolt eGPU bracket fails since new >> bridge window alignment calculation code, bisected to 3958bf16e2fe >> (b855d99 in 6.18.y). >> >> https://lore.kernel.org/linux-pci/20261108015109.65207-1-doug@calobrisi.com/ >> 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. >> >> 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): >> >> - return ALIGN(max(winsize, min_size), win_align); >> + return ALIGN(max(winsize + gap, min_size), win_align); >> >> Series and patch (links): >> >> [PATCH v5 00/14] PCI: Resource placement algorithm fixes >> Ilpo Järvinen, 2026-11-06 >> >> https://lore.kernel.org/linux-pci/20261106134341.39493-1-ilpo.jarvinen@linux.intel.com/ >> >> [PATCH v5 13/14] PCI: Fix composite resource sizing >> >> https://lore.kernel.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/ >> >> (mirror, if the above is unreachable: >> >> https://lore-kernel.gnuweeb.org/linux-pci/20261106134341.39493-14-ilpo.jarvinen@linux.intel.com/raw >> ) >> >> Question >> -------- >> >> Is the failure above the case that "PCI: Fix composite resource >> sizing" is meant to cover? >> >> Test result >> ----------- >> >> 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: >> >> pci 0000:00:02.1: bridge window [mem 0x40000000-0x452fffff]: assigned >> >> i.e. 0x05300000 (83 MiB) instead of 41 MiB, and everything below it >> is assigned: >> >> 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) >> >> 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. >> >> 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 > test the whole series. The full series would have likely applied cleanly > on top of 7.3.4. ;-) > > The gap calculation is expected to help multi-GPU setups. But without the > other patches, the placement may still find dead-ends in some cases > (though it often works on its own because of the existing remainder > logic). > >> If not, I can provide full dmesg with dyndbg="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. > Unfortunately, the series seems stalled so I don't know when it ends up > into mainline. > ^ permalink raw reply [flat|nested] 4+ messages in thread
* 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) 2026-12-01 4:36 ` Mario Limonciello @ 2026-12-01 6:26 ` Maciej Grochowski 0 siblings, 0 replies; 4+ messages in thread From: Maciej Grochowski @ 2026-12-01 6:26 UTC (permalink / raw) To: linux-pci Hi Ilpo, Mario, Bjorn, I wanted to follow up because we're already using the allocator changes from Ilpo's v5 PCI resource placement series in our downstream kernel, and I think we need them upstream. We hit the same problem on one of our switch setups. Five of eight endpoints got BARs. The child windows fit on paper if you add up their sizes, but once you account for the alignment gaps, the parent window is too small. I've posted some results from earlier revisions. So far we've tested on arm64, and I've also done some limited testing on an AMD EPYC server. We're still working through final validation. I'm happy to post more results if that would help. Are there particular layouts or failure cases you'd like us to try? I understand that this is a fairly big change. What would we need to see in testing to be comfortable moving the series forward? We have quite a few switch configurations we can run it on. I'd much rather put that testing into the upstream work than keep doing it on a private PCI branch. I suspect other people with similar setups are in the same boat. Thanks, Maciej ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-01 6:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <bug-222345-41252@https.bugzilla.kernel.org/>
2026-11-29 23:25 ` 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) Bjorn Helgaas
2026-11-30 11:55 ` Ilpo Järvinen
2026-12-01 4:36 ` Mario Limonciello
2026-12-01 6:26 ` Maciej Grochowski
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.