3. BAR1 128 GiB on every card, behind PCIe switches
Russian: 03-bar1-128g.ru.md
Why: a large BAR1 is a precondition for P2P and RDMA. It is not needed for pipeline-parallel inference.
P2P itself is not done: nvidia-smi topo -p2p r still reports GNS.
Platform
Gigabyte G292-Z20, UEFI boot, Above 4G decoding on. Each root bus has a 64-bit window of about 1.7 TB, but the firmware gives each switch only 224 MiB because the cards announce a 64 MiB BAR1 at power-on. There is enough address space; the windows only have to be redistributed.
What works
- Block automatic loading of nvidia:
server/modprobe/cmp-nvidia-hold.conf(install nvidia /bin/falseand the same for uvm, modeset, drm). A plainblacklistdid not stop the module. cmp-bar1set <bdf> 128on every card, with no driver bound: -COMMAND=0002(memory decode on), - BAR0+0x88724=0x30, - BAR0+0x88DCC=0x8000000B(0x8000000Afor 64 GiB), - the ReBAR capability then reads0x003ffc00; set ReBAR control (config0xbc0) bits 13:8 to 17 (16 for 64 GiB), -COMMAND=0000.- Remove the root ports above the switches and rescan:
echo 1 > /sys/bus/pci/devices/<root port>/remove; echo 1 > /sys/bus/pci/rescan. A stock Debian 6.12 kernel then lays the windows out again (384 GiB per switch here). No kernel patch and no shim module. - Check
Region 1 ... size=128Gon every card. - Only then
modprobe --ignore-install nvidia nvidia_uvm.
cmp-bar1-boot does all five steps as an early service (cmp-bar1-boot.service, before nvidia-persistenced and
cmp-pcie-boot). BAR1 plus driver load takes about 35 s.
Where the register offsets come from: they are the ReBAR unlock registers used by community BAR1 work (the unlocker's BAR1 patch, cmp170hx-rebar-shim). We did not discover them. Exact provenance: not verified.
Rules that keep the host alive
- If any card is not at the target size after the rescan, the script does not load nvidia. A card whose ReBAR
control says 64/128 GiB while
Region 1is still 64 MiB hangs CUDA at the first context, and only a power cycle helps. - With the driver loaded, the second card of a pair cannot be resized. That is why this runs before the driver.
inflight-bar1marker: if the host hangs during the pass, the next boot createsno-bar1and leaves BAR1 stock./etc/default/cmp-bar1:CMP_BAR1_GB=64|128.
Checking
nvidia-smi -q | grep -A3 'BAR1 Memory' | grep Total # 131072 MiB
lspci -s <bdf> -vv | grep 'Region 1' # size=128G
Not verified
- A legacy (CSM) boot.
install.shonly warns. - Other platforms, and cards that are not behind a switch.
- P2P with this BAR1 on burned 80 GB cards.