* [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test
@ 2023-03-07 0:55 David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max David Matlack
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: David Matlack @ 2023-03-07 0:55 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, David Matlack
Fix 2 small issues with the rdpid test that is a part of x86/tsc.c.
Notably, the test is not currently running since qemu is not configured
to advertise RDPID support and fixing that uncovers a bug in the test
when compiling with Clang.
David Matlack (2):
x86: Run the tsc test with -cpu max
x86: Mark RDPID asm volatile to avoid dropping instructions
x86/tsc.c | 2 +-
x86/unittests.cfg | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
base-commit: e3c5c3ef2524c58023073c0fadde2e8ae3c04ec6
--
2.40.0.rc0.216.gc4246ad0f0-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max
2023-03-07 0:55 [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test David Matlack
@ 2023-03-07 0:55 ` David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions David Matlack
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: David Matlack @ 2023-03-07 0:55 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, David Matlack
Run the tsc test with -cpu max to enable RDPID testing. The current
configuration (-cpu kvm64,+rdtscp) does not include RDPID even if the
host supports. In effect, test_rdpid() never runs.
Use max instead of adding +rdpid to the existing configuration to avoid
this biting someone in the future if they add a test for a new feature.
Fixes: 10631a5bebd8 ("x86: tsc: add rdpid test")
Signed-off-by: David Matlack <dmatlack@google.com>
---
x86/unittests.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index f324e32d60ef..c4eaa8ef9bab 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -247,7 +247,7 @@ extra_params = -cpu Opteron_G1,vendor=AuthenticAMD
[tsc]
file = tsc.flat
-extra_params = -cpu kvm64,+rdtscp
+extra_params = -cpu max
[tsc_adjust]
file = tsc_adjust.flat
--
2.40.0.rc0.216.gc4246ad0f0-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions
2023-03-07 0:55 [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max David Matlack
@ 2023-03-07 0:55 ` David Matlack
2023-03-07 1:04 ` Jim Mattson
2023-03-13 14:55 ` [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test Paolo Bonzini
2023-04-05 23:00 ` Sean Christopherson
3 siblings, 1 reply; 6+ messages in thread
From: David Matlack @ 2023-03-07 0:55 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, David Matlack, Greg Thelen
Mark the asm statement that generates the RDPID instruction volatile.
The compiler within its rights to drop subsequent RDPID asm statements
(after the first) since the inputs never change.
This fixes the tsc test on hardware that supports rdpid when built with
the latest Clang compiler.
Fixes: 10631a5bebd8 ("x86: tsc: add rdpid test")
Reported-by: Greg Thelen <gthelen@google.com>
Suggested-by: Greg Thelen <gthelen@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
---
x86/tsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86/tsc.c b/x86/tsc.c
index bc403fc78461..b3bb120291ec 100644
--- a/x86/tsc.c
+++ b/x86/tsc.c
@@ -24,7 +24,7 @@ static void test_rdpid(u64 aux)
u32 eax;
wrmsr(MSR_TSC_AUX, aux);
- asm (".byte 0xf3, 0x0f, 0xc7, 0xf8" : "=a" (eax));
+ asm volatile (".byte 0xf3, 0x0f, 0xc7, 0xf8" : "=a" (eax));
report(eax == aux, "Test rdpid %%eax %" PRId64, aux);
}
--
2.40.0.rc0.216.gc4246ad0f0-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions
2023-03-07 0:55 ` [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions David Matlack
@ 2023-03-07 1:04 ` Jim Mattson
0 siblings, 0 replies; 6+ messages in thread
From: Jim Mattson @ 2023-03-07 1:04 UTC (permalink / raw)
To: David Matlack; +Cc: Paolo Bonzini, kvm, Greg Thelen
On Mon, Mar 6, 2023 at 4:56 PM David Matlack <dmatlack@google.com> wrote:
>
> Mark the asm statement that generates the RDPID instruction volatile.
> The compiler within its rights to drop subsequent RDPID asm statements
> (after the first) since the inputs never change.
>
> This fixes the tsc test on hardware that supports rdpid when built with
> the latest Clang compiler.
>
> Fixes: 10631a5bebd8 ("x86: tsc: add rdpid test")
> Reported-by: Greg Thelen <gthelen@google.com>
> Suggested-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: David Matlack <dmatlack@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test
2023-03-07 0:55 [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions David Matlack
@ 2023-03-13 14:55 ` Paolo Bonzini
2023-04-05 23:00 ` Sean Christopherson
3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-03-13 14:55 UTC (permalink / raw)
To: David Matlack; +Cc: kvm
On 3/7/23 01:55, David Matlack wrote:
> Fix 2 small issues with the rdpid test that is a part of x86/tsc.c.
> Notably, the test is not currently running since qemu is not configured
> to advertise RDPID support and fixing that uncovers a bug in the test
> when compiling with Clang.
>
> David Matlack (2):
> x86: Run the tsc test with -cpu max
> x86: Mark RDPID asm volatile to avoid dropping instructions
>
> x86/tsc.c | 2 +-
> x86/unittests.cfg | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
>
> base-commit: e3c5c3ef2524c58023073c0fadde2e8ae3c04ec6
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test
2023-03-07 0:55 [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test David Matlack
` (2 preceding siblings ...)
2023-03-13 14:55 ` [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test Paolo Bonzini
@ 2023-04-05 23:00 ` Sean Christopherson
3 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2023-04-05 23:00 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini, David Matlack; +Cc: kvm
On Mon, 06 Mar 2023 16:55:45 -0800, David Matlack wrote:
> Fix 2 small issues with the rdpid test that is a part of x86/tsc.c.
> Notably, the test is not currently running since qemu is not configured
> to advertise RDPID support and fixing that uncovers a bug in the test
> when compiling with Clang.
>
> David Matlack (2):
> x86: Run the tsc test with -cpu max
> x86: Mark RDPID asm volatile to avoid dropping instructions
>
> [...]
Applied to kvm-x86 next, thanks! Paolo's "Queued, thanks" showed up, but I
don't see these in upstream.
[1/2] x86: Run the tsc test with -cpu max
https://github.com/kvm-x86/kvm-unit-tests/commit/572fb7097fa7
[2/2] x86: Mark RDPID asm volatile to avoid dropping instructions
https://github.com/kvm-x86/kvm-unit-tests/commit/a467f7679c7f
--
https://github.com/kvm-x86/kvm-unit-tests/tree/next
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-04-05 23:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 0:55 [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max David Matlack
2023-03-07 0:55 ` [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions David Matlack
2023-03-07 1:04 ` Jim Mattson
2023-03-13 14:55 ` [kvm-unit-tests PATCH 0/2] x86: Fixes for rdpid test Paolo Bonzini
2023-04-05 23:00 ` Sean Christopherson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.