On 10/20/15 22:09, Janusz wrote: > W dniu 20.10.2015 o 21:27, Laszlo Ersek pisze: >> Due to Linux kernel commit b18d5431acc7 ("KVM: x86: fix CR0.CD >> virtualization"), vCPUs need more time to start up, because: >> >> - KVM now zaps all the mappings for the guest memory in EPT or shadow page >> table, hence more VM exits are required to rebuild the mappings for all >> memory accesses. >> >> - If a physical device has been assigned to the guest, and the IOMMU lacks >> the snoop control feature, guest memory will become uncacheable after >> CR0.CD is set to 1. >> >> UefiCpuPkg/UefiCpuPkg.dec sets the timeout to 50ms; startup failures with >> 100ms have been reported. Xiao Guangrong suggested 1s, and helped word the >> commit message. >> >> Cc: Xiao Guangrong <guangrong.x...@linux.intel.com> >> Cc: Jordan Justen <jordan.l.jus...@intel.com> >> Cc: Janusz Mocek <janusz...@gmail.com> >> Cc: Alex Williamson <alex.william...@redhat.com> >> Reported-by: Janusz Mocek <janusz...@gmail.com> >> Suggested-by: Xiao Guangrong <guangrong.x...@linux.intel.com> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Laszlo Ersek <ler...@redhat.com> >> --- >> OvmfPkg/OvmfPkgIa32.dsc | 6 ++++++ >> OvmfPkg/OvmfPkgIa32X64.dsc | 8 +++++++- >> OvmfPkg/OvmfPkgX64.dsc | 6 ++++++ >> 3 files changed, 19 insertions(+), 1 deletion(-) >> >> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc >> index 0d044c2..670a80f 100644 >> --- a/OvmfPkg/OvmfPkgIa32.dsc >> +++ b/OvmfPkg/OvmfPkgIa32.dsc >> @@ -358,6 +358,12 @@ [PcdsFixedAtBuild] >> gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 >> !endif >> >> + # Initial AP detection may take a long time on KVM; dependent on device >> + # assignment, IOMMU features, VCPU count, and more. Allow a generous >> interval >> + # for the MP services initialization in UefiCpuPkg/CpuDxe to count the >> APs, >> + # and to wait until they become idle again. >> + gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|1000000 >> + >> !ifndef $(USE_OLD_SHELL) >> gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, >> 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, >> 0xB4, 0xD1 } >> !endif >> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc >> index 19d2221..8c00096 100644 >> --- a/OvmfPkg/OvmfPkgIa32X64.dsc >> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc >> @@ -51,7 +51,7 @@ [BuildOptions] >> >> [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] >> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 >> - >> + >> >> ################################################################################ >> # >> # SKU Identification section - list of all SKU IDs supported by this >> Platform. >> @@ -363,6 +363,12 @@ [PcdsFixedAtBuild] >> gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 >> !endif >> >> + # Initial AP detection may take a long time on KVM; dependent on device >> + # assignment, IOMMU features, VCPU count, and more. Allow a generous >> interval >> + # for the MP services initialization in UefiCpuPkg/CpuDxe to count the >> APs, >> + # and to wait until they become idle again. >> + gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|1000000 >> + >> !ifndef $(USE_OLD_SHELL) >> gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, >> 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, >> 0xB4, 0xD1 } >> !endif >> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc >> index b8df1dc..eb4da4f 100644 >> --- a/OvmfPkg/OvmfPkgX64.dsc >> +++ b/OvmfPkg/OvmfPkgX64.dsc >> @@ -363,6 +363,12 @@ [PcdsFixedAtBuild] >> gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 >> !endif >> >> + # Initial AP detection may take a long time on KVM; dependent on device >> + # assignment, IOMMU features, VCPU count, and more. Allow a generous >> interval >> + # for the MP services initialization in UefiCpuPkg/CpuDxe to count the >> APs, >> + # and to wait until they become idle again. >> + gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|1000000 >> + >> !ifndef $(USE_OLD_SHELL) >> gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, >> 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, >> 0xB4, 0xD1 } >> !endif > Tested-by: Janusz Mocek <janusz...@gmail.com> > > Thanks >
Thanks for testing it. We'll need a better design (see the discussion with Jordan), but until we implement that in upstream, we can perhaps ask Gerd to add this patch to his RPMs -- this should work as a short-term band-aid for assigned GPU users. For upstream, Jordan's suggestion is clearly superior, so we shall do that; once ready, this patch can be backed out of Gerd's build. Thanks Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel