From: David Woodhouse Date: Wed, 14 Dec 2022 21:50:41 +0000 (+0000) Subject: i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=de98d26a688fda361c913188fc6174b1173c8c44;p=people%2Fpauldu%2Fqemu.git i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield They both do the same thing and just call sched_yield. This is enough to stop the Linux guest panicking when running on a host kernel which doesn't intercept SCHEDOP_poll and lets it reach userspace. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index d2c70ea180..5579e012ed 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -234,6 +234,19 @@ static bool kvm_xen_hcall_sched_op(struct kvm_xen_exit *exit, X86CPU *cpu, err = schedop_shutdown(cs, arg); break; + case SCHEDOP_poll: + /* + * Linux will panic if this doesn't work. Just yield; it's not + * worth overthinking it because with event channel handling + * in KVM, the kernel will intercept this and it will never + * reach QEMU anyway. The semantics of the hypercall explicltly + * permit spurious wakeups. + */ + case SCHEDOP_yield: + sched_yield(); + err = 0; + break; + default: return false; }