lkml.org 
[lkml]   [2023]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [RFC PATCH v6 2/6] KVM: x86: Move *_in_guest power management flags to vCPU scope
Date
Hi Zhi,

> -----Original Message-----
> From: Zhi Wang <zhi.wang.linux@gmail.com>
> Sent: Thursday, February 2, 2023 6:57 AM
> To: Kechen Lu <kechenl@nvidia.com>
> Cc: kvm@vger.kernel.org; seanjc@google.com; pbonzini@redhat.com;
> chao.gao@intel.com; shaoqin.huang@intel.com; vkuznets@redhat.com;
> linux-kernel@vger.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@nvidia.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@nvidia.com>
> > Suggested-by: Sean Christopherson <seanjc@google.com>
> > Reviewed-by: Sean Christopherson <seanjc@google.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

\
 
 \ /
  Last update: 2023-03-27 00:08    [W:0.083 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site