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