diff options
author | Ankur Arora <ankur.a.arora@oracle.com> | 2021-03-20 02:14:21 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-03-25 03:40:17 +0000 |
commit | 4bf2a5b045ebf8b5e90d9210ad5190699bddb592 (patch) | |
tree | fee39ed5b9ce6470526cf6413c8011773c1c7749 /MdePkg/MdePkg.dec | |
parent | 30691a4b40973e4b20aad3a09e9dd706ac117511 (diff) | |
download | edk2-4bf2a5b045ebf8b5e90d9210ad5190699bddb592.tar.gz edk2-4bf2a5b045ebf8b5e90d9210ad5190699bddb592.tar.bz2 edk2-4bf2a5b045ebf8b5e90d9210ad5190699bddb592.zip |
MdePkg: use CpuPause() in CpuDeadLoop()
CpuPause() might allow the CPU to go into a lower power state
state while we spin.
On X86, CpuPause() executes a PAUSE instruction which the Intel
and AMD specs describe as follows:
Intel:
"PAUSE: An additional function of the PAUSE instruction is to reduce
the power consumed by a processor while executing a spin loop. A
processor can execute a spin-wait loop extremely quickly, causing the
processor to consume a lot of power while it waits for the resource it
is spinning on to become available. Inserting a pause instruction in a
spin-wait loop greatly reduces the processor?s power consumption."
AMD:
"PAUSE: Improves the performance of spin loops, by providing a hint to
the processor that the current code is in a spin loop. The processor
may use this to optimize power consumption while in the spin loop.
Architecturally, this instruction behaves like a NOP instruction."
On RISC-V and ARM64, CpuPause() executes a NOP, which is no worse than
the tight loop we have.
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdePkg/MdePkg.dec')
0 files changed, 0 insertions, 0 deletions