]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: KVM: Handle compiler optimizations in ucall
authorRaghavendra Rao Ananta <rananta@google.com>
Wed, 15 Jun 2022 18:57:06 +0000 (18:57 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Jun 2022 14:26:41 +0000 (10:26 -0400)
commit0b80b26fba73c1dc4fc44bfaffedfddd149cedf7
treea552aa7ce63bd9b0997b9ef61b43b2ef35eeda14
parent950d6b1924284a87ab5d5542b70dc2affbe3e3a0
selftests: KVM: Handle compiler optimizations in ucall

The selftests, when built with newer versions of clang, is found
to have over optimized guests' ucall() function, and eliminating
the stores for uc.cmd (perhaps due to no immediate readers). This
resulted in the userspace side always reading a value of '0', and
causing multiple test failures.

As a result, prevent the compiler from optimizing the stores in
ucall() with WRITE_ONCE().

Suggested-by: Ricardo Koller <ricarkol@google.com>
Suggested-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Message-Id: <20220615185706.1099208-1-rananta@google.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/aarch64/ucall.c