From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] Refactor hypercall infrastructure (v2) Date: Sun, 16 Sep 2007 11:08:24 +0200 Message-ID: <46ECF288.9080709@qumranet.com> References: <11898788932902-git-send-email-aliguori@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Zachary Amsden , Jeremy Fitzhardinge , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Anthony Liguori Return-path: In-Reply-To: <11898788932902-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Anthony Liguori wrote: > This patch refactors the current hypercall infrastructure to better support live > migration and SMP. It eliminates the hypercall page by trapping the UD > exception that would occur if you used the wrong hypercall instruction for the > underlying architecture and replacing it with the right one lazily. > > It also introduces the infrastructure to probe for hypercall available via > CPUID leaves 0x40001000. CPUID leaf 0x40001001 should be filled out by > userspace. > > A fall-out of this patch is that the unhandled hypercalls no longer trap to > userspace. There is very little reason though to use a hypercall to communicate > with userspace as PIO or MMIO can be used. There is no code in tree that uses > userspace hypercalls. > > Since the last patchset, I've changed the CPUID leaves to better avoid Xen's > CPUID range and fixed a bug spotted by Muli in masking off hypercall arguments. > > Signed-off-by: Anthony Liguori > > @@ -1721,6 +1657,18 @@ void kvm_emulate_cpuid(struct kvm_vcpu *vcpu) > vcpu->regs[VCPU_REGS_RBX] = 0; > vcpu->regs[VCPU_REGS_RCX] = 0; > vcpu->regs[VCPU_REGS_RDX] = 0; > + > + if (function == KVM_CPUID_SIGNATURE) { > + u32 signature[3]; > + > + memcpy(signature, "LinuxPVLinux", 12); > + vcpu->regs[VCPU_REGS_RAX] = 0; > + vcpu->regs[VCPU_REGS_RBX] = signature[0]; > + vcpu->regs[VCPU_REGS_RCX] = signature[1]; > + vcpu->regs[VCPU_REGS_RDX] = signature[2]; > + goto out; > + } > + > This needs to be done from userspace, so that kvm can pretend not to have this leaf. (I have no objection to our userspace doing it unconditionally; but I don't want to force it on others) Also, the signature string is too generic. > diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c > index 18c2b2c..1362082 100644 > --- a/drivers/kvm/x86_emulate.c > +++ b/drivers/kvm/x86_emulate.c > Please split out the emulator changes. > - * > - * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention > - * order: RDI, RSI, RDX, RCX, R8, R9. > - * > - * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP. > - * (the first 3 are according to the gcc regparm calling convention) > Please document the new ABI. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/