Project

General

Profile

Feature #10278

Prefer use of mwait on AMD Zen

Added by Robert Mustacchi 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
2019-01-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

From talking with the folks at AMD, we should prefer the use of mwait rather than the hlt instruction for idling. It turns out that we've historically disabled mwait on AMD due to issues in family 0xf and never went back and revisited that since then. While we should definitely do it for Zen (family 0x17), it may make sense to do it for others as well. In this case, there is a large performance delta between using hlt and mwait due to the implementation on Zen that means we should prefer mwait.

To validate that we were now using mwait, I used mdb in the following way on an AMD EPYC (Zen) system:

>  ::walk cpu | ::print cpu_t cpu_m.mcpu_idle_cpu ! sort | uniq -c
 128 cpu_m.mcpu_idle_cpu = cpu_idle_mwait

Then I went and ran the utiltests to make sure they all still passed and that there wasn't anything odd here.

History

#1

Updated by Electric Monk 10 months ago

  • Status changed from New to Closed

git commit 007d65bc4ff2f2e56cc6fae2335af27bf16d373f

commit  007d65bc4ff2f2e56cc6fae2335af27bf16d373f
Author: Robert Mustacchi <rm@joyent.com>
Date:   2019-02-08T14:33:06.000Z

    10278 Prefer use of mwait on AMD Zen
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Jordan Hendricks <jordan.hendricks@joyent.com>
    Approved by: Hans Rosenfeld <hans.rosenfeld@joyent.com>

Also available in: Atom PDF