]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 16 Sep 2022 08:53:52 +0000 (10:53 +0200)
commit3808ac944450500ffb08cac16f852a9122d42c0c
treeb41f48480f63c79b093940a46b2098c9be0575c4
parent248d4bbe5a57c8ceb3a78f6495a17668658970a4
selftests: KVM: Handle compiler optimizations in ucall

BugLink: https://bugs.launchpad.net/bugs/1989221
[ Upstream commit 9e2f6498efbbc880d7caa7935839e682b64fe5a6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tools/testing/selftests/kvm/lib/aarch64/ucall.c