All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tianqiang Xu <skyele@sjtu.edu.cn>
Cc: x86@kernel.org, pbonzini@redhat.com, seanjc@google.com,
	vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com,
	joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, kvm@vger.kernel.org, hpa@zytor.com,
	jarkko@kernel.org, dave.hansen@linux.intel.com,
	linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org
Subject: Re: [PATCH 3/4] KVM host implementation
Date: Tue, 31 Aug 2021 09:16:09 +0200	[thread overview]
Message-ID: <YS3XOYJXcYw9vIda@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210831015919.13006-3-skyele@sjtu.edu.cn>

On Tue, Aug 31, 2021 at 09:59:18AM +0800, Tianqiang Xu wrote:
> @@ -4304,8 +4374,14 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
>  	idx = srcu_read_lock(&vcpu->kvm->srcu);
>  	if (kvm_xen_msr_enabled(vcpu->kvm))
>  		kvm_xen_runstate_set_preempted(vcpu);
> -	else
> +	else {
>  		kvm_steal_time_set_preempted(vcpu);
> +
> +		if (get_cpu_nr_running(smp_processor_id()) <= 1)
> +			kvm_steal_time_set_is_idle(vcpu);
> +		else
> +			kvm_steal_time_clear_is_idle(vcpu);
> +	}
>  	srcu_read_unlock(&vcpu->kvm->srcu, idx);


This cannot be right. The CPU could long since be running tasks again,
but as long as this vCPU crud doesn't run, the guest keeps thinking it's
physically idle.

  reply	other threads:[~2021-08-31  7:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  1:59 [PATCH 1/4] KVM: x86: Introduce .pcpu_is_idle() stub infrastructure Tianqiang Xu
2021-08-31  1:59 ` [PATCH 2/4] Scheduler changes Tianqiang Xu
2021-08-31  7:14   ` Peter Zijlstra
2021-08-31  1:59 ` [PATCH 3/4] KVM host implementation Tianqiang Xu
2021-08-31  7:16   ` Peter Zijlstra [this message]
2021-08-31  7:17     ` Peter Zijlstra
2021-08-31  1:59 ` [PATCH 4/4] KVM guest implementation Tianqiang Xu
2021-08-31  7:21   ` Peter Zijlstra
2021-09-01  4:39 ` [PATCH 1/4] KVM: x86: Introduce .pcpu_is_idle() stub infrastructure Jarkko Sakkinen
2021-12-17  9:39 ` Jinrong Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YS3XOYJXcYw9vIda@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=skyele@sjtu.edu.cn \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.