mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 13:11:07 +01:00
Add rmb() to tsc_read_##x to enforce serialization of rdtsc captures.
Intel Architecture Manual specifies that rdtsc instruction is not serialized, so without this change, TSC synchronization test would periodically fail, resulting in use of HPET timecounter instead of TSC-low. This caused severe performance degradation (40-50%) when running high IO/s workloads due to HPET MMIO reads and GEOM stat collection. Tests on Xeon E5-2600 (Sandy Bridge) 8C systems were seeing TSC synchronization fail approximately 20% of the time. Sponsored by: Intel Reviewed by: kib MFC after: 3 days
This commit is contained in:
parent
b18b53bad0
commit
3f6e7b9b11
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238755
@ -328,6 +328,7 @@ init_TSC(void)
|
||||
|
||||
#ifdef SMP
|
||||
|
||||
/* rmb is required here because rdtsc is not a serializing instruction. */
|
||||
#define TSC_READ(x) \
|
||||
static void \
|
||||
tsc_read_##x(void *arg) \
|
||||
@ -335,6 +336,7 @@ tsc_read_##x(void *arg) \
|
||||
uint32_t *tsc = arg; \
|
||||
u_int cpu = PCPU_GET(cpuid); \
|
||||
\
|
||||
rmb(); \
|
||||
tsc[cpu * 3 + x] = rdtsc32(); \
|
||||
}
|
||||
TSC_READ(0)
|
||||
|
Loading…
Reference in New Issue
Block a user