[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <556d68697f5cd30e32307b1c56ae51b42f87cd4f.camel@redhat.com>
Date: Fri, 12 Nov 2021 09:43:47 +0200
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Emanuele Giuseppe Esposito <eesposit@...hat.com>,
kvm@...r.kernel.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/7] nSVM: introduce smv->nested.save to cache save
area fields
On Thu, 2021-11-11 at 14:52 +0100, Paolo Bonzini wrote:
> On 11/3/21 15:05, Emanuele Giuseppe Esposito wrote:
> > Note that in svm_set_nested_state() we want to cache the L2
> > save state only if we are in normal non guest mode, because
> > otherwise it is not touched.
>
> I think that call to nested_copy_vmcb_save_to_cache is not necessary at
> all, because svm->nested.save is not used afterwards and is not valid
> after VMRUN.
Yes, but since setting nested state is absolutely not performance critical,
having it do the same thing as normal VMRUN is always better.
Best regards,
Maxim Levitsky
>
> The relevant checks have already been done before:
>
> if (!(vcpu->arch.efer & EFER_SVME)) {
> /* GIF=1 and no guest mode are required if SVME=0. */
> if (kvm_state->flags != KVM_STATE_NESTED_GIF_SET)
> return -EINVAL;
> }
>
> ...
>
> /*
> * Processor state contains L2 state. Check that it is
> * valid for guest mode (see nested_vmcb_check_save).
> */
> cr0 = kvm_read_cr0(vcpu);
> if (((cr0 & X86_CR0_CD) == 0) && (cr0 & X86_CR0_NW))
> goto out_free;
>
> (and all other checks are done by KVM_SET_SREGS, KVM_SET_DEBUGREGS etc.)
>
> Paolo
>
Powered by blists - more mailing lists