From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] KVM: SVM: Use host_vmcb_pa for vmload and vmsave
Date: Thu, 14 Jul 2011 16:20:03 +0300 [thread overview]
Message-ID: <4E1EED03.3050202@redhat.com> (raw)
In-Reply-To: <20110714131036.GC24072@8bytes.org>
On 07/14/2011 04:10 PM, Joerg Roedel wrote:
> On Thu, Jul 14, 2011 at 02:29:36PM +0300, Avi Kivity wrote:
> > On 07/13/2011 06:32 PM, Joerg Roedel wrote:
> >> This saves copying over the vmload/vmsave switched part from
> >> the host to the guest vmcb later.
> >>
> >> Signed-off-by: Joerg Roedel<joerg.roedel@amd.com>
> >> ---
> >> arch/x86/kvm/svm.c | 7 ++++++-
> >> 1 files changed, 6 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> >> index 3d5990f..dc703ac 100644
> >> --- a/arch/x86/kvm/svm.c
> >> +++ b/arch/x86/kvm/svm.c
> >> @@ -3704,9 +3704,13 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
> >>
> >> /* Enter guest mode */
> >> "push %%"R"ax \n\t"
> >> - "mov %c[vmcb](%[svm]), %%"R"ax \n\t"
> >> + "mov %c[host_vmcb](%[svm]), %%"R"ax \n\t"
> >> __ex(SVM_VMLOAD) "\n\t"
> >> + "mov (%%"R"sp), %%"R"ax\n\t"
> >> + "mov %c[vmcb](%[svm]), %%"R"ax \n\t"
> >> __ex(SVM_VMRUN) "\n\t"
> >> + "mov (%%"R"sp), %%"R"ax\n\t"
> >> + "mov %c[host_vmcb](%[svm]), %%"R"ax \n\t"
> >> __ex(SVM_VMSAVE) "\n\t"
> >> "pop %%"R"ax \n\t"
> >>
> >
> > Okay, so the plan is to split L2 state between ->vmcb and ->host_vmcb?
>
> Yes, otherwise we need to copy the vmload/vmsave switched state back and
> forth between both VMCBs which is a waste of cycles.
Just to be sure I understand this: the root cause is because VMRUN
doesn't actually switch this state. So we have to copy the state. Okay.
What about an L2 guest executing VMLOAD or VMSAVE which isn't
intercepted? Don't we have to redirect it's reads and writes to host_vmcb?
> > In that case my suggestion for patch 1 doesn't apply. But the name
> > still is confusing. If we don't find a better one, I want a fat comment
> > explaining how state is split.
>
> Hmm, how about naming them l1_vmcb and l2_vmcb? The comment explaining
> why vmload/vmsave always happens on l1_vmcb is needed anyway then.
In a later patch you introduce n_vmcb. I think it makes sense to name
that vmcb02?
> > (would be good to have documentation for the overall strategy of nsvm,
> > like we have for nvmx and nmmu).
>
> There is not much to document about future plans for nested-svm. At the
> moment I try to add emulation code for new SVM features when there is
> some time left. Live migration support is also on the list.
>
Even the exising code would be good to document. So when a reader sees
some bit, they can compare it to the document and see why it's that way.
> The long-term plan is certainly to merge code with nested-vmx where
> possible and move logic into generic KVM code. The first item that comes
> to mind here is to create a single place where a vmexit is emulated and
> let all other place which do that today just signal that it is required.
I'm not very concerned about reuse with nvmx except for architectural
code like interrupts. Of course, if it turns out simple I'm all for it,
but if it's hard or uglifies the code, let it be.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-07-14 13:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-13 15:32 [PATCH 0/7] Implement Shadow VMCB for Nested SVM Joerg Roedel
2011-07-13 15:32 ` [PATCH 1/7] KVM: SVM: Keep seperate pointer to host-vmcb Joerg Roedel
2011-07-14 10:13 ` Avi Kivity
2011-07-13 15:32 ` [PATCH 2/7] KVM: SVM: Use host_vmcb_pa for vmload and vmsave Joerg Roedel
2011-07-14 11:29 ` Avi Kivity
2011-07-14 13:10 ` Joerg Roedel
2011-07-14 13:20 ` Avi Kivity [this message]
2011-07-14 13:52 ` Joerg Roedel
2011-07-14 14:01 ` Avi Kivity
2011-07-13 15:32 ` [PATCH 3/7] KVM: SVM: Reorder nested_svm_vmrun Joerg Roedel
2011-07-13 15:32 ` [PATCH 4/7] KVM: SVM: Use seperate VMCB for L2 guests Joerg Roedel
2011-07-14 11:38 ` Avi Kivity
2011-07-14 13:12 ` Joerg Roedel
2011-07-14 13:26 ` Avi Kivity
2011-07-14 13:40 ` Joerg Roedel
2011-07-14 13:43 ` Avi Kivity
2011-07-13 15:32 ` [PATCH 5/7] KVM: SVM: Remove nested.hsave state Joerg Roedel
2011-07-13 15:32 ` [PATCH 6/7] KVM: SVM: Rework hflags handling Joerg Roedel
2011-07-13 15:32 ` [PATCH 7/7] KVM: SVM: Don't change host intercepts in vmrun emulation Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E1EED03.3050202@redhat.com \
--to=avi@redhat.com \
--cc=joerg.roedel@amd.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox