HomeFreeBSD

Use the correct idle routine on recent AMD EPYC servers

Description

Use the correct idle routine on recent AMD EPYC servers

We have been incorrectly choosing the "hlt" idle method on modern AMD
EPYC servers for C1 idle. This is because AMD also uses the Functional
Fixed Hardware interface. Due to not parsing the table properly for
AMD, and due to a weird quirk where the mwait latency for C1 is
mis-interpreted as the latency for hlt, we wind up choosing hlt for
c1, which has a far higher wake up latency (similar to IO) of roughly
400us on my test system (AMD 7502P).

This patch fixes this by:

  • Looking for AMD in addition to Intel in the FFH (Note the vendor id of "2" for AMD is not publically documented, but AMD has confirmed they are using "2" and has promised to document it.)
  • Using mwait on AMD when specified in the table, and when CPUid says its supported
  • Fixing a weird issue where we copy the contents of cx_ptr for C1 and when moving to C2, we do not reinitialize cx_ptr. This leads to mwait being selected, and ignoring the specified i/o halt method unless we clear mwait before looking at the table for C2.

Differential Revision: https://reviews.freebsd.org/D47444
Reviewed by: dab, kib, vangyzen
Sponsored by: Netflix

Details

Provenance
gallatinAuthored on Nov 8 2024, 9:37 PM
Reviewer
dab
Differential Revision
D47444: Use correct idle routine on AMD
Parents
rG1eb3f15c149b: fwget: add -q for quiet output
Branches
Unknown
Tags
Unknown