]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: do not blindly clobber registers in guest asm
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 20 May 2019 11:31:02 +0000 (13:31 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 May 2019 19:27:10 +0000 (21:27 +0200)
commit83e3c949f996d3ea42d092e7db3c99c279d166ab
treecd9516683048d89eaba676657df4ac615b86c52c
parent3abbd6c5af00df52d743a0a4659756711f85a14c
KVM: selftests: do not blindly clobber registers in guest asm

The guest_code of sync_regs_test is assuming that the compiler will not
touch %r11 outside the asm that increments it, which is a bit brittle.
Instead, we can increment a variable and use a dummy asm to ensure the
increment is not optimized away.  However, we also need to use a
callee-save register or the compiler will insert a save/restore around
the vmexit, breaking the whole idea behind the test.

(Yes, "if it ain't broken...", but I would like the test to be clean
before it is copied into the upcoming s390 selftests).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/x86_64/sync_regs_test.c