[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2023 19:42:19 +0000
From: Kechen Lu <kechenl@...dia.com>
To: Zhi Wang <zhi.wang.linux@...il.com>,
"seanjc@...gle.com" <seanjc@...gle.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"chao.gao@...el.com" <chao.gao@...el.com>,
"shaoqin.huang@...el.com" <shaoqin.huang@...el.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH v6 2/6] KVM: x86: Move *_in_guest power management
flags to vCPU scope
Hi Zhi,
> -----Original Message-----
> From: Zhi Wang <zhi.wang.linux@...il.com>
> Sent: Thursday, February 2, 2023 6:57 AM
> To: Kechen Lu <kechenl@...dia.com>
> Cc: kvm@...r.kernel.org; seanjc@...gle.com; pbonzini@...hat.com;
> chao.gao@...el.com; shaoqin.huang@...el.com; vkuznets@...hat.com;
> linux-kernel@...r.kernel.org
> Subject: Re: [RFC PATCH v6 2/6] KVM: x86: Move *_in_guest power
> management flags to vCPU scope
>
> External email: Use caution opening links or attachments
>
>
> On Sat, 21 Jan 2023 02:07:34 +0000
> Kechen Lu <kechenl@...dia.com> wrote:
>
> > Make the runtime disabled mwait/hlt/pause/cstate exits flags vCPU
> > scope to allow finer-grained, per-vCPU control. The VM-scoped control
> > is only allowed before vCPUs are created, thus preserving the existing
> > behavior is a simple matter of snapshotting the flags at vCPU creation.
> >
> > Signed-off-by: Kechen Lu <kechenl@...dia.com>
> > Suggested-by: Sean Christopherson <seanjc@...gle.com>
> > Reviewed-by: Sean Christopherson <seanjc@...gle.com>
> > ---
> > arch/x86/include/asm/kvm_host.h | 5 +++++
> > arch/x86/kvm/cpuid.c | 4 ++--
> > arch/x86/kvm/lapic.c | 7 +++----
> > arch/x86/kvm/svm/nested.c | 4 ++--
> > arch/x86/kvm/svm/svm.c | 12 ++++++------
> > arch/x86/kvm/vmx/vmx.c | 16 ++++++++--------
> > arch/x86/kvm/x86.c | 6 +++++-
> > arch/x86/kvm/x86.h | 16 ++++++++--------
> > 8 files changed, 39 insertions(+), 31 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/kvm_host.h
> > b/arch/x86/include/asm/kvm_host.h index 6aaae18f1854..41b998234a04
> > 100644
> > --- a/arch/x86/include/asm/kvm_host.h
> > +++ b/arch/x86/include/asm/kvm_host.h
> > @@ -1009,6 +1009,11 @@ struct kvm_vcpu_arch { #if
> > IS_ENABLED(CONFIG_HYPERV)
> > hpa_t hv_root_tdp;
> > #endif
> > +
> > + bool mwait_in_guest;
> > + bool hlt_in_guest;
> > + bool pause_in_guest;
> > + bool cstate_in_guest;
>
> Better add some comments here. When xxx_in_guest stays together with
> XXX_DISABLE_EXIT_XXX, it can be quite confusing. Or maybe align the
> naming like bool disable_exit_mwait <-> XXX_DISABLE_EXIT_XXX.
>
This *_in_guest naming aligns with what current kvm_arch has, and exists for long time, not sure if there are still needs to add comments here. Would like to see Sean's options on this.
BR,
Kechen
Powered by blists - more mailing lists