Re: [PATCH 03/11] KVM: SVM: adjust register allocation for __svm_vcpu_run

From: Paolo Bonzini
Date: Wed Nov 09 2022 - 11:05:58 EST


On 11/9/22 16:20, Sean Christopherson wrote:
keep the pointer to the struct vcpu_svm in %rdi. This way
it is possible to load svm->vmcb01.pa in %rax without
clobbering the pointer to svm itself.

If you feel like doing fixup before pushing, add a note to call out that avoiding
RAX will also be "necessary" to play nice with loading/storing MSR_SPEC_CTRL?
When fiddling with this code, I found the RDMSR/WRMSR clobbers to be far more
problematic than the VMCB pointers.

I tried to avoid the "in the future" phrasing which some people dislike. I'll rephrase anyway. Even without taking RDMSR/WRMSR/VMLOAD/VMRUN/VMSAVE into account, avoiding the potential clash with 32-bit register arguments is a decent reason for the patch anyway.

Paolo