diff mbox

[edk2,2/2] OvmfPkg: set SMM stack size to 16KB

Message ID 1464807811-14917-3-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek June 1, 2016, 7:03 p.m. UTC
The default stack size (from UefiCpuPkg/UefiCpuPkg.dec) is 8KB, which
proved too small (i.e., led to stack overflow) across commit range
98c2d9610506^..f85d3ce2efc2^, during certificate enrollment into "db".

As the edk2 codebase progresses and OVMF keeps including features, the
stack demand constantly fluctuates; double the SMM stack size for good
measure.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/12864
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1341733
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 OvmfPkg/OvmfPkgIa32.dsc    | 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.dsc     | 1 +
 3 files changed, 3 insertions(+)

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek June 2, 2016, 9:19 p.m. UTC | #1
On 06/02/16 22:50, Jordan Justen wrote:
> On 2016-06-01 12:03:31, Laszlo Ersek wrote:

>> The default stack size (from UefiCpuPkg/UefiCpuPkg.dec) is 8KB, which

>> proved too small (i.e., led to stack overflow) across commit range

>> 98c2d9610506^..f85d3ce2efc2^, during certificate enrollment into "db".

>>

>> As the edk2 codebase progresses and OVMF keeps including features, the

>> stack demand constantly fluctuates; double the SMM stack size for good

>> measure.

>>

>> Cc: Jeff Fan <jeff.fan@intel.com>

>> Cc: Jiewen Yao <jiewen.yao@intel.com>

>> Cc: Jordan Justen <jordan.l.justen@intel.com>

>> Cc: Michael D Kinney <michael.d.kinney@intel.com>

>> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/12864

>> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1341733

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>> ---

>>  OvmfPkg/OvmfPkgIa32.dsc    | 1 +

>>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +

>>  OvmfPkg/OvmfPkgX64.dsc     | 1 +

>>  3 files changed, 3 insertions(+)

>>

>> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc

>> index 338c9ba4f8e5..737f30028bcd 100644

>> --- a/OvmfPkg/OvmfPkgIa32.dsc

>> +++ b/OvmfPkg/OvmfPkgIa32.dsc

>> @@ -424,6 +424,7 @@ [PcdsFixedAtBuild]

>>  !if $(SMM_REQUIRE) == TRUE

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000

>> +  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000

> 

> Should the default for this PCD be adjusted? I would expect that OVMF

> would be on the low side in terms of SMM stack usage. (Considering how

> little it does with SMM.)


I considered it, but I had no idea what to change the default to. I
didn't even have your insight above, about OVMF's demand likely being
relatively low. :)

So it should be a good suggestion, but I'd leave the actual number to
people with more experience here...

> Series Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>


Thanks!
Laszlo

> 

>>  !endif

>>  

>>  !if $(SECURE_BOOT_ENABLE) == TRUE

>> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc

>> index 8475280b2cda..854cf6dd916e 100644

>> --- a/OvmfPkg/OvmfPkgIa32X64.dsc

>> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc

>> @@ -430,6 +430,7 @@ [PcdsFixedAtBuild.X64]

>>  !if $(SMM_REQUIRE) == TRUE

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000

>> +  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000

>>  !endif

>>  

>>  !if $(SECURE_BOOT_ENABLE) == TRUE

>> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc

>> index 200c06baaa16..0cb2f60234b6 100644

>> --- a/OvmfPkg/OvmfPkgX64.dsc

>> +++ b/OvmfPkg/OvmfPkgX64.dsc

>> @@ -429,6 +429,7 @@ [PcdsFixedAtBuild]

>>  !if $(SMM_REQUIRE) == TRUE

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01

>>    gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000

>> +  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000

>>  !endif

>>  

>>  !if $(SECURE_BOOT_ENABLE) == TRUE

>> -- 

>> 1.8.3.1

>>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 338c9ba4f8e5..737f30028bcd 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -424,6 +424,7 @@  [PcdsFixedAtBuild]
 !if $(SMM_REQUIRE) == TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000
 !endif
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 8475280b2cda..854cf6dd916e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -430,6 +430,7 @@  [PcdsFixedAtBuild.X64]
 !if $(SMM_REQUIRE) == TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000
 !endif
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 200c06baaa16..0cb2f60234b6 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -429,6 +429,7 @@  [PcdsFixedAtBuild]
 !if $(SMM_REQUIRE) == TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000
 !endif
 
 !if $(SECURE_BOOT_ENABLE) == TRUE