History

KVM: selftests: fix rdtsc() for vmx_tsc_adjust_test

vmx_tsc_adjust_test fails with: IA32_TSC_ADJUST is -4294969448 (-1 * TSC_ADJUST_VALUE + -2152). IA32_TSC_ADJUST is -4294969448 (-1 * TSC_ADJUST_VALUE + -2152). IA32_TSC_ADJUST is 281470681738540 (65534 * TSC_ADJUST_VALUE + 4294962476). ==== Test Assertion Failure ==== x86_64/vmx_tsc_adjust_test.c:153: false pid=19738 tid=19738 - Interrupted system call 1 0x0000000000401192: main at vmx_tsc_adjust_test.c:153 2 0x00007fe1ef8583d4: ?? ??:0 3 0x0000000000401201: _start at ??:? Failed guest assert: (adjust <= max) The problem is that is 'tsc_val' should be u64, not u32 or the reading gets truncated.

Vitaly Kuznetsov committed 6 years ago

Commit 13ffbd81 parent f0a5ec11 file · +1 −1Browse files

Unified · Split

tools/testing/selftests/kvm/include/x86_64/processor.h+1−1
@@ -79,7 +79,7 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc) · 78 unmodified lines
79static inline uint64_t rdtsc(void)79static inline uint64_t rdtsc(void)
80{80{
81 uint32_t eax, edx;81 uint32_t eax, edx;
82 uint32_t tsc_val;82 uint64_t tsc_val;
83 /*83 /*
84 * The lfence is to wait (on Intel CPUs) until all previous84 * The lfence is to wait (on Intel CPUs) until all previous
85 * instructions have been executed. If software requires RDTSC to be85 * instructions have been executed. If software requires RDTSC to be

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t