Re: [QEMU 1.2 PATCH] i386: kvm: have a predefined set of default KVM feature bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ehabkost@xxxxxxxxxx>
> > ---
> >  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.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux