Page MenuHomeFreeBSD

Use correct idle routine on AMD
AcceptedPublic

Authored by gallatin on Mon, Nov 4, 10:25 PM.

Details

Reviewers
kib
vangyzen
jhb
Summary

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 wake up higher 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
  • 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.
Test Plan

On a 7502P, sysctl dev.cpu.0.cx_method should change from C1/hlt C2/io to C1/mwait C2/io

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/acpica/acpi_cpu.c
134

I am curious where this value is defined.

I only aware about Intel 302223-007.pdf which talks only about Intel.

I share kib's curiosity, but it clearly works, so LGTM. Nice find!

This revision is now accepted and ready to land.Tue, Nov 5, 7:15 PM