From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6kUJ-0007O9-Cb for qemu-devel@nongnu.org; Wed, 29 Aug 2012 11:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6kUH-0001ZB-Rq for qemu-devel@nongnu.org; Wed, 29 Aug 2012 11:47:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6kUH-0001Yh-JN for qemu-devel@nongnu.org; Wed, 29 Aug 2012 11:47:25 -0400 Date: Wed, 29 Aug 2012 12:46:53 -0300 From: Marcelo Tosatti Message-ID: <20120829154653.GD25284@amt.cnet> References: <20120829144157.GH6223@otherpad.lan.raisama.net> <1346252665-9373-1-git-send-email-ehabkost@redhat.com> <20120829151004.GB7407@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120829151004.GB7407@redhat.com> Subject: Re: [Qemu-devel] [QEMU 1.2 PATCH] i386: kvm: have a predefined set of default KVM feature bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Gleb Natapov , kvm@vger.kernel.org, qemu-devel@nongnu.org, Blue Swirl , Jan Kiszka , avi@redhat.com, Anthony Liguori , Eduardo Habkost On Wed, Aug 29, 2012 at 06:10:04PM +0300, Michael S. Tsirkin wrote: > On Wed, Aug 29, 2012 at 12:04:25PM -0300, Eduardo Habkost wrote: > > We can't simply expose the GET_SUPPORTED_CPUID results directly to the > > guest, or the resulting guest-visible CPUID bits may change under the > > guest's feet when we live-migrate. > > > > We still have to implement proper per-machine-type migration > > compatibility bits, but this at least is a workaround for cases where PV > > EOI would be silently enabled after a host kernel upgrade. > > > > We also have to implement proper check/warnings about unsupported bits > > when using "-cpu check" or "-cpu enforce", because the default bits may > > be silently disabled if the host kernel doesn't support them. > > > > Signed-off-by: Eduardo Habkost > > --- > > target-i386/cpu.c | 18 +++++++++++++++++- > > target-i386/cpu.h | 10 ++++++++++ > > 2 files changed, 27 insertions(+), 1 deletion(-) > > > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index 120a2e3..52042f0 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -283,6 +283,21 @@ typedef struct x86_def_t { > > CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A) > > #define TCG_SVM_FEATURES 0 > > > > + > > +/* List of KVM features we (try to) enable by default > > + * > > + * CPUID_KVM_PV_EOI is not enabled until we have proper per-machine-type > > + * migration compatibility support > > + * > > + * CPUID_KVM_MMU is not enabled because it is deprecated. > > + */ > > +#define DEFAULT_KVM_FEATURES (CPUID_KVM_CLOCKSOURCE | \ > > + CPUID_KVM_KVM_NOP_IO_DELAY | \ > > + CPUID_KVM_CLOCKSOURCE2 | \ > > + CPUID_KVM_KVM_ASYNC_PF | \ > > + CPUID_KVM_STEAL_TIME | \ > > + CPUID_KVM_CLOCKSOURCE_STABLE_BIT) > > + > > /* maintains list of cpu model definitions > > */ > > static x86_def_t *x86_defs = {NULL}; > > @@ -887,7 +902,8 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) > > memcpy(x86_cpu_def, def, sizeof(*def)); > > } > > > > - plus_kvm_features = ~0; /* not supported bits will be filtered out later */ > > + /* not supported bits will be filtered out later */ > > + plus_kvm_features = DEFAULT_KVM_FEATURES; > > > > add_flagname_to_bitmaps("hypervisor", &plus_features, > > &plus_ext_features, &plus_ext2_features, &plus_ext3_features, > > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > > index 60f9e97..5ce4baf 100644 > > --- a/target-i386/cpu.h > > +++ b/target-i386/cpu.h > > @@ -440,6 +440,16 @@ > > #define CPUID_SVM_PAUSEFILTER (1 << 10) > > #define CPUID_SVM_PFTHRESHOLD (1 << 12) > > > > +/* CPUID[4000_0001h].EAX bits: */ > > +#define CPUID_KVM_CLOCKSOURCE (1 << 0) > > +#define CPUID_KVM_KVM_NOP_IO_DELAY (1 << 1) > > +#define CPUID_KVM_MMU (1 << 2) > > +#define CPUID_KVM_CLOCKSOURCE2 (1 << 3) > > +#define CPUID_KVM_KVM_ASYNC_PF (1 << 4) > > +#define CPUID_KVM_STEAL_TIME (1 << 5) > > +#define CPUID_KVM_KVM_PV_EOI (1 << 6) > > +#define CPUID_KVM_CLOCKSOURCE_STABLE_BIT (1 << 24) > > + > > #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ > > #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ > > #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */ > > Why duplicate macros that kvm linux header already has? Yes. This is better... hopefully we can include this and pveoi msr migration support code in QEMU 1.2 time.