Re: [PATCH V2 02/10] KVM: X86: Synchronize the shadow pagetable before link it

Paolo Bonzini
2021-09-23T14:36:37Z

On 18/09/21 02:56, Lai Jiangshan wrote:
> + * It also makes KVM_REQ_MMU_SYNC request if the @sp
> + * is linked on a different addr to expedite it.
> + */
> + if (sp->unsync_children &&
> + mmu_sync_children(vcpu, sp, false)) {
> + kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
> + return RET_PF_RETRY;
> + }
> }

I think we can put the sync in mmu_sync_children:

- if (!can_yield)
+ if (!can_yield) {
+ /*
+ * Some progress has been made so the caller
+ * can simply retry, but we can expedite the
+ * process by forcing a sync to happen.
+ */
+ kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
return -EINTR;
+ }

Paolo