]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Add more barriers in XIVE load/unload code
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 15 Oct 2017 21:37:54 +0000 (08:37 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sun, 15 Oct 2017 21:46:46 +0000 (08:46 +1100)
commit88304f1e0aada12c99d4b23e8fd1308ffd5c12b4
treef1acd782e055017a8f12afccd7de5a9de76b532d
parenta78676cc848375a7d9fdb51a5f639eda36748dee
KVM: PPC: Book3S HV: Add more barriers in XIVE load/unload code

On POWER9 systems, we push the VCPU context onto the XIVE (eXternal
Interrupt Virtualization Engine) hardware when entering a guest,
and pull the context off the XIVE when exiting the guest.  The push
is done with cache-inhibited stores, and the pull with cache-inhibited
loads.

Testing has revealed that it is possible (though very rare) for
the stores to get reordered with the loads so that we end up with the
guest VCPU context still loaded on the XIVE after we have exited the
guest.  When that happens, it is possible for the same VCPU context
to then get loaded on another CPU, which causes the machine to
checkstop.

To fix this, we add I/O barrier instructions (eieio) before and
after the push and pull operations.  As partial compensation for the
potential slowdown caused by the extra barriers, we remove the eieio
instructions between the two stores in the push operation, and between
the two loads in the pull operation.  (The architecture requires
loads to cache-inhibited, guarded storage to be kept in order, and
requires stores to cache-inhibited, guarded storage likewise to be
kept in order, but allows such loads and stores to be reordered with
respect to each other.)

Reported-by: Carol L Soto <clsoto@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv_rmhandlers.S