Re: [PATCH 25/26] KVM: PPC: Book3S PR: Support TAR handling for PR KVM HTM.
From: Paul Mackerras <hidden>
Date: 2018-01-24 09:46:19
Also in:
kvm
On Thu, Jan 11, 2018 at 06:11:38PM +0800, wei.guo.simon@gmail.com wrote:
From: Simon Guo <redacted> Currently guest kernel doesn't handle TAR fac unavailable and it always runs with TAR bit on. PR KVM will lazily enable TAR. TAR is not a frequent-use reg and it is not included in SVCPU struct. To make it work for transaction memory at PR KVM: 1). Flush/giveup TAR at kvmppc_save_tm_pr(). 2) If we are receiving a TAR fac unavail exception inside a transaction, the checkpointed TAR might be a TAR value from another process. So we need treclaim the transaction, then load the desired TAR value into reg, and perform trecheckpoint. 3) Load TAR facility at kvmppc_restore_tm_pr() when TM active. The reason we always loads TAR when restoring TM is that: If we don't do this way, when there is a TAR fac unavailable exception during TM active: case 1: it is the 1st TAR fac unavail exception after tbegin. vcpu->arch.tar should be reloaded as checkpoint tar val. case 2: it is the 2nd or later TAR fac unavail exception after tbegin. vcpu->arch.tar_tm should be reloaded as checkpoint tar val. There will be unnecessary difficulty to handle the above 2 cases. at the end of emulating treclaim., the correct TAR val need to be loaded into reg if FSCR_TAR bit is on. at the beginning of emulating trechkpt., TAR needs to be flushed so that the right tar val can be copy into tar_tm.
Would it be simpler always to load up TAR when guest_MSR[TM] is 1? Paul.