bhyve should expose lfence serialize in DE_CFG MSR
The DE_CFG MSR on modern AMD CPUs controls, among other things, whether the lfence instruction is serializing. While we cannot allow the guest to control the setting, we can at least expose whether it has been set (or not) in the host. Doing so will allow guests to safely use
lfence; rdtsc for performing a TSC reading when rdtscp is not available.
Updated by Patrick Mooney about 2 years ago
Without this change, an OmniOSCE guest running inside bhyve was unable to detect serializing lfence, and thus fell back to normal retpolines for its spectre v2 mitigation. With the fix in place, the guest was then able to detect that serializing lfence was available and activated the appropriate AMD-specific retpoline. With #13383 and #13384 in place on the guest, it also chose lfence-rdtsc for performing TSC measurements instead of cpuid-rdtsc, since it detected the proper lfence behavior.
Updated by Electric Monk about 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit beed421eff10640141fe8f9da29a5c8033a97f52 Author: Patrick Mooney <firstname.lastname@example.org> Date: 2021-01-26T21:27:49.000Z 13383 generalize check for serializing LFENCE 13384 tsc_read() should use lfence when prudent 13387 bhyve should expose lfence serialize in DE_CFG MSR Reviewed by: Robert Mustacchi <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>