Messages in this thread | | | From | Vitaly Kuznetsov <> | Subject | Re: [PATCH v3 7/9] KVM: nSVM: implement nested_svm_load_cr3() and use it for host->guest switch | Date | Fri, 10 Jul 2020 13:40:37 +0200 |
| |
Paolo Bonzini <pbonzini@redhat.com> writes:
> 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. >
Hm, it seems I missed svm_set_nested_state() path completely. Surprisingly, state_test didn't fail)
I'm struggling a bit to understand why we don't have kvm_set_cr3() on svm_set_nested_state() path: enter_svm_guest_mode() does it through nested_prepare_vmcb_save() but it is skipped in svm_set_nested_state(). Don't we need it at least for !npt_enabled case? We'll have to extract nested_cr3 from nested_vmcb then.
-- Vitaly
| |