From: Marcelo Tosatti <marcelo@kvack.org>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [patch 3/5] KVM: hypercall batching
Date: Mon, 18 Feb 2008 13:47:55 -0300 [thread overview]
Message-ID: <20080218164755.GA11923@dmt> (raw)
In-Reply-To: <47B7F318.7020704@qumranet.com>
On Sun, Feb 17, 2008 at 10:40:56AM +0200, Avi Kivity wrote:
> Marcelo Tosatti wrote:
> >Batch pte updates and tlb flushes in lazy MMU mode.
> >
> >
>
> I am slightly uneasy about generic hypercall batching. An alternative
> way to do it would be to define a kvm_mmu_op structure (with an embedded
> opcode) and have a single hypercall execute a number of these (and not
> have any hypercall for executing just one).
>
> >+static int kvm_hypercall_multicall(struct kvm_vcpu *vcpu, gpa_t addr, u32
> >nents)
> >+{
> >+ int i, result = 0;
> >+
> >+ ++vcpu->stat.multicall;
> >+ vcpu->stat.multicall_nr += nents;
> >+
> >+ for (i = 0; i < nents; i++) {
> >+ struct kvm_multicall_entry mc;
> >+ int ret;
> >+
> >+ down_read(&vcpu->kvm->slots_lock);
> >+ ret = kvm_read_guest(vcpu->kvm, addr, &mc, sizeof(mc));
> >+ up_read(&vcpu->kvm->slots_lock);
> >+ if (ret)
> >+ return -KVM_EFAULT;
> >+
> >+ ret = dispatch_hypercall(vcpu, mc.nr, mc.a0, mc.a1, mc.a2,
> >+ mc.a3);
> >+ if (ret)
> >+ result = ret;
> >+ addr += sizeof(mc);
> >+ }
> >+ if (result < 0)
> >+ return -KVM_EINVAL;
> >+ return result;
> >+}
> >+
>
> The return code of the hypercalls (if positive) is lost. In the case
> that one hypercall failed, which one exactly is also lost.
>
> For mmu ops, it doesn't matter (since if any fails, the guest is
> toast). For a generic framework, it may matter. If we keep it generic,
> I suggest adding a field for the return code of each hypercall, and have
> the multicall return the number of executed hypercalls.
We need a "generic" mechanism which allows different operations in the
same multicall. For example mixed bit pte updates and normal whole pte
updates.
I've added an error code to each multicall entry and changed the
hypercall itself to return the number of processed entries as you
suggested.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-02-18 16:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080216220924.733723618@redhat.com>
2008-02-16 22:09 ` [patch 1/5] KVM: add basic paravirt support Marcelo Tosatti
2008-02-16 22:09 ` [patch 2/5] KVM: hypercall based pte updates and TLB flushes Marcelo Tosatti
2008-02-16 22:09 ` [patch 3/5] KVM: hypercall batching Marcelo Tosatti
2008-02-16 22:09 ` [patch 4/5] KVM: ignore zapped root pagetables Marcelo Tosatti
2008-02-16 22:09 ` [patch 5/5] KVM: VMX cr3 cache support Marcelo Tosatti
2008-02-16 23:37 ` [patch 0/5] KVM paravirt MMU updates and cr3 caching Anthony Liguori
2008-02-17 2:24 ` Marcelo Tosatti
[not found] ` <20080216221220.843135254@redhat.com>
2008-02-17 8:28 ` [patch 2/5] KVM: hypercall based pte updates and TLB flushes Avi Kivity
2008-02-17 13:13 ` Avi Kivity
2008-02-17 14:51 ` Marcelo Tosatti
2008-02-17 14:57 ` Avi Kivity
2008-02-18 5:00 ` Marcelo Tosatti
2008-02-17 8:32 ` Avi Kivity
[not found] ` <20080216221221.002948712@redhat.com>
2008-02-17 8:52 ` [patch 4/5] KVM: ignore zapped root pagetables Avi Kivity
[not found] ` <20080216221220.924823582@redhat.com>
2008-02-17 8:40 ` [patch 3/5] KVM: hypercall batching Avi Kivity
2008-02-18 16:47 ` Marcelo Tosatti [this message]
2008-02-17 18:40 ` Hollis Blanchard
2008-02-18 8:06 ` Avi Kivity
2008-02-18 8:43 ` Christian Borntraeger
2008-02-18 8:47 ` Avi Kivity
[not found] ` <1203361276.3428.6.camel@basalt>
2008-02-19 8:30 ` Avi Kivity
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=20080218164755.GA11923@dmt \
--to=marcelo@kvack.org \
--cc=avi@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
/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