Re: [PATCH v2 0/4] implement vcpu preempted check

From
Peter Zijlstra <peterz@infradead.org>
Date
2016-07-07 11:21:32
Also in
kvm, linux-s390, linuxppc-dev, lkml
Reply to
Peter Zijlstra, 2016-07-07
On Thu, Jul 07, 2016 at 11:42:15AM +0200, Peter Zijlstra wrote:
quoted hunk ↗ jump to hunk
+static void update_steal_time_preempt(struct kvm_vcpu *vcpu)
+{
+	struct kvm_steal_time *st;
+
+	if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
+		return;
+
+	if (unlikely(kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.st.stime,
+		&vcpu->arch.st.steal, sizeof(struct kvm_steal_time))))
+		return;
+
+	st = &vcpu->arch.st.steal;
+
+	st->pad[KVM_ST_PAD_PREEMPT] = 1; /* we've stopped running */
So maybe have this be:

	... = kvm_vcpu_running();

That avoids marking the vcpu preempted when we do hlt and such.
quoted hunk ↗ jump to hunk
+	kvm_write_guest_cached(vcpu->kvm, &vcpu->arch.st.stime,
+		st, sizeof(struct kvm_steal_time));
+}
Thread (30 messages) 30 messages, 9 authors, last reply 2016-07-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help