diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2020-12-22 17:58:43 +0000 |
---|---|---|
committer | Patrick Mooney <pmooney@oxide.computer> | 2021-01-26 21:27:49 +0000 |
commit | beed421eff10640141fe8f9da29a5c8033a97f52 (patch) | |
tree | 48ffa995974f720d5c08e05225576d388759ac1c /usr/src/lib | |
parent | 78801af7286cd73dbc996d470f789e75993cf15d (diff) | |
download | illumos-joyent-beed421eff10640141fe8f9da29a5c8033a97f52.tar.gz |
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 <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/commpage/amd64/cp_subr.s | 11 | ||||
-rw-r--r-- | usr/src/lib/commpage/common/cp_main.c | 1 | ||||
-rw-r--r-- | usr/src/lib/commpage/i386/cp_subr.s | 11 |
3 files changed, 12 insertions, 11 deletions
diff --git a/usr/src/lib/commpage/amd64/cp_subr.s b/usr/src/lib/commpage/amd64/cp_subr.s index 09b8deaf8d..ebae0ed307 100644 --- a/usr/src/lib/commpage/amd64/cp_subr.s +++ b/usr/src/lib/commpage/amd64/cp_subr.s @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #include <sys/asm_linkage.h> @@ -110,11 +111,11 @@ movl %edx, %r10d 3: - cmpl $TSC_RDTSC_MFENCE, %esi - jne 4f - mfence - rdtsc - jmp 7f + /* + * TSC_RDTSC_MFENCE was used in the past for AMD chips, but has been + * supplanted by TSC_RDTSC_LFENCE, which works on Intel and AMD (when + * lfence can be confirmed as serializing). + */ 4: cmpl $TSC_RDTSC_LFENCE, %esi diff --git a/usr/src/lib/commpage/common/cp_main.c b/usr/src/lib/commpage/common/cp_main.c index 13a9aea3d7..42cc37d6b8 100644 --- a/usr/src/lib/commpage/common/cp_main.c +++ b/usr/src/lib/commpage/common/cp_main.c @@ -25,7 +25,6 @@ __cp_can_gettime(comm_page_t *cp) { switch (cp->cp_tsc_type) { case TSC_TSCP: - case TSC_RDTSC_MFENCE: case TSC_RDTSC_LFENCE: case TSC_RDTSC_CPUID: return (1); diff --git a/usr/src/lib/commpage/i386/cp_subr.s b/usr/src/lib/commpage/i386/cp_subr.s index d1e07008c4..83b7dcff56 100644 --- a/usr/src/lib/commpage/i386/cp_subr.s +++ b/usr/src/lib/commpage/i386/cp_subr.s @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #include <sys/asm_linkage.h> @@ -88,11 +89,11 @@ movl CP_TSC_TYPE(%edi), %eax 4: - cmpl $TSC_RDTSC_MFENCE, %eax - jne 5f - mfence - rdtsc - jmp 8f + /* + * TSC_RDTSC_MFENCE was used in the past for AMD chips, but has been + * supplanted by TSC_RDTSC_LFENCE, which works on Intel and AMD (when + * lfence can be confirmed as serializing). + */ 5: cmpl $TSC_RDTSC_LFENCE, %eax |