Re: [PATCH] [RFC] kvm: x86: emulate APERF/MPERF registers

From: Jim Mattson
Date: Mon Apr 27 2020 - 13:30:36 EST


On Sat, Apr 25, 2020 at 8:24 PM Li,Rongqing <lirongqing@xxxxxxxxx> wrote:
>
>
>
> > -----éäåä-----
> > åää: Paolo Bonzini [mailto:pbonzini@xxxxxxxxxx]
> > åéæé: 2020å4æ25æ 0:30
> > æää: Jim Mattson <jmattson@xxxxxxxxxx>; Sean Christopherson
> > <sean.j.christopherson@xxxxxxxxx>
> > æé: Peter Zijlstra <peterz@xxxxxxxxxxxxx>; Li,Rongqing
> > <lirongqing@xxxxxxxxx>; LKML <linux-kernel@xxxxxxxxxxxxxxx>; kvm list
> > <kvm@xxxxxxxxxxxxxxx>; the arch/x86 maintainers <x86@xxxxxxxxxx>; H .
> > Peter Anvin <hpa@xxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>; Ingo Molnar
> > <mingo@xxxxxxxxxx>; Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Joerg Roedel
> > <joro@xxxxxxxxxx>; Wanpeng Li <wanpengli@xxxxxxxxxxx>; Vitaly Kuznetsov
> > <vkuznets@xxxxxxxxxx>
> > äé: Re: [PATCH] [RFC] kvm: x86: emulate APERF/MPERF registers
> >
> > On 24/04/20 18:25, Jim Mattson wrote:
> > >> Assuming we're going forward with this, at an absolute minimum the
> > >> RDMSRs need to be wrapped with checks on host _and_ guest support for
> > >> the emulated behavior. Given the significant overhead, this might
> > >> even be something that should require an extra opt-in from userspace to
> > enable.
> > >
> > > I would like to see performance data before enabling this unconditionally.
> >
> > I wouldn't want this to be enabled unconditionally anyway, because you need to
> > take into account live migration to and from processors that do not have
> > APERF/MPERF support.
> >
> > Paolo
>
> I will add a kvm parameter to consider whether enable MPERF/APERF emulations, and make default value to false

Wouldn't it be better to add a per-VM capability to enable this feature?