Re: [PATCH] KVM: X86: set vcpu preempted only if it is preempted

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

 



On Wed, Jan 12, 2022 at 08:02:01PM +0800, Li RongQing wrote:
> vcpu can schedule out when run halt instruction, and set itself
> to INTERRUPTIBLE and switch to idle thread, vcpu should not be
> set preempted for this condition

Uhhmm, why not? Who says the vcpu will run the moment it becomes
runnable again? Another task could be woken up meanwhile occupying the
real cpu.

> 
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> Signed-off-by: Wang GuangJu <wangguangju@xxxxxxxxx>
> ---
>  arch/x86/kvm/x86.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 9f5dbf7..10d76bf 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4407,6 +4407,9 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)
>  	if (vcpu->arch.st.preempted)
>  		return;
>  
> +	if (!vcpu->preempted)
> +		return;
> +
>  	/* This happens on process exit */
>  	if (unlikely(current->mm != vcpu->kvm->mm))
>  		return;
> -- 
> 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