RE: [PATCH] x86/kvm: refine condition for checking vCPU preempted

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

 




> -----Original Message-----
> From: Sean Christopherson <seanjc@xxxxxxxxxx>
> Sent: Wednesday, March 15, 2023 8:16 AM
> To: Li,Rongqing <lirongqing@xxxxxxxxx>
> Cc: kvm@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx; Paolo Bonzini
> <pbonzini@xxxxxxxxxx>; Wanpeng Li <wanpengli@xxxxxxxxxxx>; Vitaly
> Kuznetsov <vkuznets@xxxxxxxxxx>
> Subject: Re: [PATCH] x86/kvm: refine condition for checking vCPU preempted
> 
> +Paolo, Wanpeng, and Vitaly
> 
> In the future, use get_maintainers.pl to build To: and Cc: so that the right folks
> see the patch.  Not everyone habitually scours the KVM list. :-)
> 
Ok

> On Wed, Feb 15, 2023, lirongqing@xxxxxxxxx wrote:
> > From: Li RongQing <lirongqing@xxxxxxxxx>
> >
> > Check whether vcpu is preempted or not when HLT is trapped or there is
> > not realtime hint.
> 
> Please explain _why_ there's no need to check for preemption in this setup.
> What may be obvious to you isn't necessarily obvious to reviewers or readers.
> 

I will rewrite the changelog

> > In other words, it is unnecessary to check preemption if HLT is not
> > intercepted and guest has realtime hint
> >
> > Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> > ---
> >  arch/x86/kernel/kvm.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index
> > 1cceac5..1a2744d 100644
> > --- a/arch/x86/kernel/kvm.c
> > +++ b/arch/x86/kernel/kvm.c
> > @@ -820,8 +820,10 @@ static void __init kvm_guest_init(void)
> >  		has_steal_clock = 1;
> >  		static_call_update(pv_steal_clock, kvm_steal_clock);
> >
> > -		pv_ops.lock.vcpu_is_preempted =
> > -			PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
> > +		if (kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) ||
> 
> Rather than have the guest rely on host KVM behavior clearing PV_UNHALT
> when HLT is passed through), would it make sense to add something like
> KVM_HINTS_HLT_PASSTHROUGH to more explicitly tell the guest that HLT isn't
> intercepted?

KVM_HINTS_HLT_PASSTHROUGH is more obvious, but it need both kvm and guest support

Thanks

-Li

> 
> > +		     !kvm_para_has_hint(KVM_HINTS_REALTIME))
> 
> Misaligned indentation (one too many spaces).
> 
> > +			pv_ops.lock.vcpu_is_preempted =
> > +				PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
> >  	}
> >
> >  	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
> > --
> > 2.9.4
> >



[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