]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: fix ucall on x86
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 25 Sep 2019 13:12:42 +0000 (15:12 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 25 Sep 2019 13:15:03 +0000 (15:15 +0200)
commit50b39de411efb42d663804f237b36721787778f5
tree26a98b940d442f4f98e942e503427f6daa067a49
parente62af999b6d5e2f199bb6aa03a9c68cdfde372fa
KVM: selftests: fix ucall on x86

After commit e8bb4755eea2("KVM: selftests: Split ucall.c into architecture
specific files") selftests which use ucall on x86 started segfaulting and
apparently it's gcc to blame: it "optimizes" ucall() function throwing away
va_start/va_end part because it thinks the structure is not being used.
Previously, it couldn't do that because the there was also MMIO version and
the decision which particular implementation to use was done at runtime.

With older gccs it's possible to solve the problem by adding 'volatile'
to 'struct ucall' but at least with gcc-8.3 this trick doesn't work.

'memory' clobber seems to do the job.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/x86_64/ucall.c