Project

General

Profile

Actions

Bug #13383

closed

generalize check for serializing LFENCE

Added by Patrick Mooney about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

As part of the Spectre retpoline logic, AMD chips are checked for whether their LFENCE instruction is serializing. This includes attempting to set a bit to enable that behavior in the DE_CFG MSR on newer (families 0x10 and >= 0x12). A serializing LFENCE is also useful for rdtsc, where it's preferable to using CPUID for that purpose. It would probably make sense to follow Linux's lead, and add an x86feature for serializing LFENCE, so it can be checked (and/or enabled) in one place, and then both retpoline and tsc_read_patch() consumers can make use of it.

A more accurate check for serializing LFENCE will help us inside hypervisors which do not expose RDTSCP to the guest. Until now, newer AMD chips were assumed not to have serializing LFENCE and would fall back to the much slower (VM exit inducing) CPUID serialization.


Related issues

Related to illumos gate - Bug #13387: bhyve should expose lfence serialize in DE_CFG MSRClosedPatrick Mooney

Actions
Related to illumos gate - Bug #13384: tsc_read() should use lfence when prudentClosedPatrick Mooney

Actions
Actions

Also available in: Atom PDF