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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to