Re: [PATCH][v2] x86/kvm: Don't check vCPU preempted if vCPU has dedicated pCPU and non-trap HLT

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

 



On Thu, Apr 06, 2023 at 03:33:13PM +0800, lirongqing@xxxxxxxxx wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
> 
> Check whether vCPU is preempted or not only when HLT is trapped or
> there is not realtime hint. In other words, it is unnecessary to check
> preemption when vCPU has realtime hint (which means vCPU has dedicated
> pCP) and has not PV_UNHALT (which means unintercepted HLT), because
> vCPU should not to be marked as preempted in this setup.

To what benefit?

> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> ---
> diff with v1: rewrite changelog and indentation
> 
>  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..25398d2 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) ||
> +			!kvm_para_has_hint(KVM_HINTS_REALTIME))

This is atrocious coding style, please align on the (.

> +			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