Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754756Ab2BPTe7 (ORCPT ); Thu, 16 Feb 2012 14:34:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754174Ab2BPTe5 (ORCPT ); Thu, 16 Feb 2012 14:34:57 -0500 Message-ID: <4F3D5A59.20803@redhat.com> Date: Thu, 16 Feb 2012 21:34:49 +0200 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Anthony Liguori CC: Gleb Natapov , KVM list , linux-kernel , Rusty Russell , qemu-devel Subject: Re: [Qemu-devel] [RFC] Next gen kvm api References: <4F2AB552.2070909@redhat.com> <20120205093723.GQ23536@redhat.com> <4F2E4F8B.8090504@redhat.com> <20120205095153.GA29265@redhat.com> <4F2EAFF6.7030006@codemonkey.ws> <4F2F9E89.7090607@redhat.com> <87vcnih5qt.fsf@rustcorp.com.au> <4F3BB59D.2020505@redhat.com> <4F3C2AC5.80400@codemonkey.ws> <20120216085741.GB19771@redhat.com> <4F3D16BB.5060804@codemonkey.ws> In-Reply-To: <4F3D16BB.5060804@codemonkey.ws> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1790 Lines: 46 On 02/16/2012 04:46 PM, Anthony Liguori wrote: >> What will it buy us? Surely not speed. Entering a guest is not much >> (if at all) faster than exiting to userspace and any non trivial >> operation will require exit to userspace anyway, > > > You can emulate the PIT/RTC entirely within the guest using kvmclock > which doesn't require an additional exit to get the current time base. > > So instead of: > > 1) guest -> host kernel > 2) host kernel -> userspace > 3) implement logic using rdtscp via VDSO > 4) userspace -> host kernel > 5) host kernel -> guest > > You go: > > 1) guest -> host kernel > 2) host kernel -> guest (with special CR3) > 3) implement logic using rdtscp + kvmclock page > 4) change CR3 within guest and RETI to VMEXIT source RIP > > Same basic concept as PS/2 emulation with SMM. Interesting, but unimplementable in practice. SMM requires a VMEXIT for RSM, and anything non-SMM wants a virtual address mapping (and some RAM) which you can't get without guest cooperation. There are other complications like an NMI interrupting hypervisor-provided code and finding unexpected addresses on its stack (SMM at least blocks NMIs). Tangentially related, Intel introduced a VMFUNC that allows you to change the guest's physical memory map to a pre-set alternative provided by the host, without a VMEXIT. Seems similar to SMM but requires guest cooperation. I guess it's for unintrusive virus scanners and the like. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/