提交 0ec6c5c5 编写于 作者: J Joao Martins 提交者: Paolo Bonzini

KVM: x86/xen: handle PV IPI vcpu yield

Cooperative Linux guests after an IPI-many may yield vcpu if
any of the IPI'd vcpus were preempted (i.e. runstate is 'runnable'.)
Support SCHEDOP_yield for handling yield.
Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
Signed-off-by: NDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220303154127.202856-11-dwmw2@infradead.org>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 2fd6df2f
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <xen/interface/xen.h> #include <xen/interface/xen.h>
#include <xen/interface/vcpu.h> #include <xen/interface/vcpu.h>
#include <xen/interface/event_channel.h> #include <xen/interface/event_channel.h>
#include <xen/interface/sched.h>
#include "trace.h" #include "trace.h"
...@@ -798,6 +799,20 @@ static int kvm_xen_hypercall_complete_userspace(struct kvm_vcpu *vcpu) ...@@ -798,6 +799,20 @@ static int kvm_xen_hypercall_complete_userspace(struct kvm_vcpu *vcpu)
return kvm_xen_hypercall_set_result(vcpu, run->xen.u.hcall.result); return kvm_xen_hypercall_set_result(vcpu, run->xen.u.hcall.result);
} }
static bool kvm_xen_hcall_sched_op(struct kvm_vcpu *vcpu, int cmd, u64 param, u64 *r)
{
switch (cmd) {
case SCHEDOP_yield:
kvm_vcpu_on_spin(vcpu, true);
*r = 0;
return true;
default:
break;
}
return false;
}
int kvm_xen_hypercall(struct kvm_vcpu *vcpu) int kvm_xen_hypercall(struct kvm_vcpu *vcpu)
{ {
bool longmode; bool longmode;
...@@ -838,7 +853,9 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu) ...@@ -838,7 +853,9 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu)
if (params[0] == EVTCHNOP_send) if (params[0] == EVTCHNOP_send)
handled = kvm_xen_hcall_evtchn_send(vcpu, params[1], &r); handled = kvm_xen_hcall_evtchn_send(vcpu, params[1], &r);
break; break;
case __HYPERVISOR_sched_op:
handled = kvm_xen_hcall_sched_op(vcpu, params[0], params[1], &r);
break;
default: default:
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册