[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7c65e0e-0c8f-106b-6249-ac706e702259@redhat.com>
Date: Thu, 9 Jul 2020 19:59:54 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Junaid Shahid <junaids@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 7/9] KVM: nSVM: implement nested_svm_load_cr3() and use
it for host->guest switch
On 09/07/20 19:57, Paolo Bonzini wrote:
> On 09/07/20 16:53, Vitaly Kuznetsov wrote:
>> + if (nested_npt_enabled(svm))
>> + nested_svm_init_mmu_context(&svm->vcpu);
>> +
>> ret = nested_svm_load_cr3(&svm->vcpu, nested_vmcb->save.cr3,
>> nested_npt_enabled(svm));
>
> This needs to be done in svm_set_nested_state, so my suggestion is that
> the previous patch includes a call to nested_svm_load_cr3 in
> svm_set_nested_state, and this one adds the "if" inside
> nested_svm_load_cr3 itself.
Actually no, that doesn't work after the next patch. So the best option
is probably to extract nested_svm_init_mmu as a separate step in
enter_svm_guest_mode. This also leaves nested_prepare_vmcb_save as a
void function.
Paolo
>
> Paolo
>
>> @@ -364,13 +388,6 @@ static int nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *nested_vm
>> static void nested_prepare_vmcb_control(struct vcpu_svm *svm)
>> {
>> const u32 mask = V_INTR_MASKING_MASK | V_GIF_ENABLE_MASK | V_GIF_MASK;
>> - if (nested_npt_enabled(svm))
>> - nested_svm_init_mmu_context(&svm->vcpu);
>> -
>> - /* Guest paging mode is active - reset mmu */
>> - kvm_mmu_reset_context(&svm->vcpu);
>> -
>> - svm_flush_tlb(&svm->vcpu);
>>
>
Powered by blists - more mailing lists