Public bug reported:

Due to an inefficiency in the way older host kernels manage pfnmaps for
guest VM memory ranges[0], guests with large-BAR GPUs passed through
have a very long (multiple minutes) initialization time when the MMIO
window advertised by OVMF is sufficiently sized for the passed-through
BARs (i.e., the correct OVMF behavior). However, in the past, users have
benefited from fast guest boot times when OVMF advertised an MMIO window
that was too small to accommodate the full BAR, since this resulted in
the long PCI initialization process being skipped (and retried later, if
pci=realloc pci=nocrs were set).

While the root cause is being fully addressed in the upstream kernel[1],
the solution relies on huge pfnmap support, which is not expected to be
backported into the 6.8 or 6.11 -generic kernels. As a result, the only
kernel improvement supported on those kernels is this patch[2], which
reduces the extra boot time by about half. Unfortunately, that boot time
is still an average of 1-3 minutes longer per-VM-boot than what can be
achieved when the host is running a version of OVMF without
PlatformDynamicMmioWindow (PDMW) support (introduced in [3]) (as was the
case in Jammy's version of OVMF).

Since there is no way to force the use of the classic MMIO window
size[4] in any version of OVMF after [3], and since we have a use case
for such functionality on Noble that would yield significant, recurring
compute time savings across all impacted VMs, I propose adding a boolean
fw_cfg knob "opt/ovmf/X-PciMmioClassicWindow", which, when TRUE, would
bypass the PDMW functionality in [3] and instead use the "classic" MMIO
window. When set, users' guest VMs would need to set the `pci=nocrs
pci=realloc` kernel options for passed-through GPUs to be usable, but
boots would be short again, as they were in Jammy.

I am *not* planning to submit this patch to upstream edk2 since this
option should not be necessary for any users running newer kernels, once
the requisite patches[1] land in the mainline tree.

[0]: 
https://lore.kernel.org/all/cahta-uyp07fgm6t1ozqkqadsa5jrzo0reneyzgqzub4mdrr...@mail.gmail.com/
[1]: 
https://lore.kernel.org/all/20250205231728.2527186-1-alex.william...@redhat.com/
[2]: 
https://lore.kernel.org/all/20250111210652.402845-1-alex.william...@redhat.com/
[3]: 
https://github.com/tianocore/edk2/commit/ecb778d0ac62560aa172786ba19521f27bc3f650
[4]: https://edk2.groups.io/g/devel/topic/109651206?p=Created,,,20,1,0,0

** Affects: edk2 (Ubuntu)
     Importance: Undecided
     Assignee: Mitchell Augustin (mitchellaugustin)
         Status: Confirmed

** Changed in: edk2 (Ubuntu)
     Assignee: (unassigned) => Mitchell Augustin (mitchellaugustin)

** Changed in: edk2 (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2101903

Title:
  UBUNTU: SAUCE: Introduce X-PciMmioClassicWindow option to fw_cfg

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/2101903/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to