From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: bjorn@helgaas.com, Mario Limonciello <mario.limonciello@amd.com>
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)
Date: Mon, 30 Nov 2026 13:55:43 +0200 (EET) [thread overview]
Message-ID: <577d5815-afd4-7a59-b883-ff8a968ed62f@linux.intel.com> (raw)
In-Reply-To: <CABhMZUW75FuU4cYQ8qeWYv-An2_gi+gysb2UwRaSrEkMrzrtNQ@mail.gmail.com>
[-- 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.
prev parent reply other threads:[~2026-11-30 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=577d5815-afd4-7a59-b883-ff8a968ed62f@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bjorn@helgaas.com \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox