On 09/18/13 13:19, Laszlo Ersek wrote:
> Rod,
>
> On 09/18/13 01:24, Jordan Justen wrote:
>> QEMU 1.6 enables using KVM READONLY memory regions. There
>> appears to be a bug when page tables are stored in the
>> READONLY memory region. To work-around this, we create
>> page table entries in RAM. Since RAM is present in QEMU/KVM
>> without any initialization, this is easily accomplished
>> for OVMF.
>>
>> Since the firmware-device no longer needs to store 24KB of
>> uncompressed page table data, we also reclaim nearly all
>> of that for use with OVMF's compressed firmware.
>
> Can you please test this series on your AMD machine? Your previous
> config should work (qemu-1.6, recent (3.10+ ?) kernel, KVM enabled).
>
> If the series doesn't help on AMD, IMO that should *not* block this
> series. However if it fixes the AMD case too, then maybe one of the
> commit messages could mention that.
>
> CC'ing Paolo & Gleb, and also here's a reference into the earlier
> discussion:
>
> http://thread.gmane.org/gmane.comp.bios.tianocore.devel/3961
>
> In that thread I think I tested this series on AMD (then-available
> from Jordan's tree) and it technically fixed the problem on SVM too,
> but it seemed to incur (or expose) a ~40 sec busy loop at startup,
> with many EXIT_INTRs in KVM.
>
> http://thread.gmane.org/gmane.comp.bios.tianocore.devel/3961/focus=3998
>
> But, again, if this symptom persists on SVM, I don't think it should
> block this series.
I couldn't resist and had to test the series on AMD too. I realized I
could permanently enlist my home Debian Wheezy desktop for quick
turn-around :)
Host CPU: AMD Athlon(tm) II X2 B22 Processor
Host kernel: 3.11.1 (fresh from kernel.org)
KVM: in use
QEMU: 1.6.50 (at commit 6c2679fc19560699679200fb42ab4659bcbe7f79)
The symptoms I'm seeing are identical to those in the thread linked
above:
(1) When starting qemu with OVMF, there's a long loop (about 1min) when
apparently nothing happens, but qemu is working very hard:
SecCoreStartupWithStack(0xFFFCC000, 0x80000)
File->Type: 0xB
Section->Type: 0x2
----[LONG LOOP HERE]----
Section->Type: 0x19
Section->Type (0x19) != SectionType (0x17)
Section->Type: 0x17
File->Type: 0x2
File->Type (0x2) != FileType (0x4)
(2) After the long loop, OVMF continues to load and it can start the
UEFI shell, the config TUI etc. Everything seems normal.
The debug messages quoted above help:
SecCoreStartupWithStack()
[OvmfPkg/Sec/SecMain.c]
// prints "SecCoreStartupWithStack(0xFFFCC000, 0x80000)"
InitializeDebugAgent()
[MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c]
SecStartupPhase2()
[OvmfPkg/Sec/SecMain.c]
FindAndReportEntryPoints()
FindPeiCoreImageBase()
DecompressGuidedFv()
FindFfsFileAndSection(...,
EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE ==
0x0B, [MdePkg/Include/Pi/PiFirmwareFile.h]
EFI_SECTION_GUID_DEFINED ==
0x02, [MdePkg/Include/Pi/PiFirmwareFile.h]
...)
// prints "File->Type: 0xB"
FindFfsSectionInSections()
// prints "Section->Type: 0x2"
ExtractGuidedSectionGetInfo()
ExtractGuidedSectionDecode() <------ long loop runs here
FindFfsSectionInSections(...,
EFI_SECTION_FIRMWARE_VOLUME_IMAGE == 0x17,
[MdePkg/Include/Pi/PiFirmwareFile.h]
...)
// prints "Section->Type: 0x19"
// prints "Section->Type (0x19) != SectionType (0x17)"
// prints "Section->Type: 0x17"
I think that ExtractGuidedSectionDecode() decompresses the compressed
part of the firmware image, and that it takes unusually long probably
because the initial 4GB mapping we've set up in the reset vector
disables caching for all pages covered. (Not sure why that doesn't cause
such a visible difference on VMX -- maybe different defaults?) Later on,
in "MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c", we build page
tables that enable caching.
For what it's worth, I committed the attached patch on top of this
series. This accelerates the OVMF startup on SVM to be on par with the
VMX experience. However, I'm not sure if it's *safe* to enable caching
that early!
Until we figure this all out, I think the slower startup on AMD should
not be a problem; the series is strictly an improvement on AMD too.
So, for SVM too,
series
Tested-by: Laszlo Ersek <[email protected]>
From 5653632cf9510dee78bad34b55edf4572eb2a41b Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <[email protected]>
Date: Sat, 21 Sep 2013 16:55:09 +0200
Subject: [PATCH] OvmfPkg/ResetVector: enable caching in initial page tables
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
OvmfPkg/ResetVector/Bin/ResetVector.x64.raw | Bin 628 -> 676 bytes
OvmfPkg/ResetVector/Ia32/PageTables64.asm | 4 +---
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw
b/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw
index
ff083636008d2f4cd6836ab8daeee15b29bda600..28dcf5b4397957d3691cbfab6752020d621fc205
100644
GIT binary patch
delta 505
zcmW-d&ubGw6vy9WGwp_o30tM172GsITA|Y5LDN>L6lD>F^io2^>w?#H7jkR%ki!^+
z$X>j+{tZn}-8TJ^*0T~QNVOmx1y7QeT04HH1M}wd=6&bQcjixWm0K;0Vmw6|qDMre
zywZECupHJ3NGRA79iw6gvAl+?y@4Ti<X@!}7M36?9*VEx#BIKsW<BqjG@zRI9yelt
zh7W?h`-QW&m63kO_D`D5jqn>zQfl8nWSf4%`&_SCMv#)DP&VQqCAxA8f?_O|cN_g6
z;a|!Xrc1uZv(S{fZ(i4HM#i@hEq|_=4Uct0T)oKk)!y^Mh5Ujoo<!z`4_{P+2kEuS
z9P5O$<)?Vhq_Hp|@1S_45FIz1U8)Ad#)8Qwu$x|cIWXCi+yb{TNxJAJr$EsyHeNlr
zR4Pldk9?hA309NuF4Q1>Ki%U*Cgn3Gfe`byCR5Y2ri`X}O<7H46CF$<(RDVDZt~;k
z1G9%cb<a(+5x1SkH>Ss9_vcddiH%*CuuiSpREL>XEBejumWDQ-lz$DlVjF)hPn8Un
i{P+)6&vod*rqhO4;T$=+T_?BW<hC7gq<%z;iTr=wF~NQS
delta 510
zcmWlW&1=*^7{=cun>Fph35&8Tg8R`Ns<5&jAeL2(6d@O3PqNgnTP|KCCa?!#H^e<m
z7lN|?g8xHPd+3yO>sk<cYhY302eRoX2ui7<JDog-hu`qNJkJdCTK=8Mz2vHsDyRTA
z0f1S}S2?Zcbv1DIaVT|4PDmGmZ7w{fb39HC1%Ub#f5bC$_^>8KR*Ooyb!|ZGhDXj=
zRqbTGlRpki_R-Kd=YC?0!NNQHgRo<Z)?vS!lbkHg4~Ub+6S`j~cyDm*i1s{r!E<@Y
zV~-S8dXs0JepgcMi`;W|V_0y%q(Qt*_lRV*w10H!k&NkHzq{sC(MIQn5W21Q9RQ~&
ztuE6dAL7t-TldzSv(l>Kk!7@TKYKZ%a=>2+$#Wh@tEd#CH!~Sk;>|t)K@EOVPz{Y9
z35&|XoUsBVKSoc53%#bQz*`x(H%logDb-R^Q_@o^q|{bm6BGbEF?Qnf@-JS7Gw)A|
z3Vi;~s}(?%D0#x$|8Bugf4XI}t0ofiX0QaHqY5#P9`K<Gfu04v8=HXwex&-ukNuf{
zKyMYH&lg6Q#49U{+qc_PHt{YM=^whDME@B}G=A;mE4P5JF{8X^l*dMS*T6CRmVS1s
Ikt;5p0wTEEjsO4v
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index 5ebf211..8280e8f 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -28,14 +28,12 @@ BITS 32
%define PAGE_2M_PAT 0x01000
%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \
- PAGE_CACHE_DISABLE + \
PAGE_ACCESSED + \
PAGE_DIRTY + \
PAGE_READ_WRITE + \
PAGE_PRESENT)
-%define PAGE_PDP_ATTR (PAGE_CACHE_DISABLE + \
- PAGE_ACCESSED + \
+%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
PAGE_READ_WRITE + \
PAGE_PRESENT)
--
1.8.3.1
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13.
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel