[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v15 12/60] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield
From: |
David Woodhouse |
Subject: |
[PATCH v15 12/60] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield |
Date: |
Wed, 1 Mar 2023 13:51:35 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
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 <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
target/i386/kvm/xen-emu.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 4ed833656f..ebea27caf6 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;
}
--
2.39.0
- [PATCH v15 00/60] Xen HVM support under KVM, David Woodhouse, 2023/03/01
- [PATCH v15 59/60] i386/xen: Document Xen HVM emulation, David Woodhouse, 2023/03/01
- [PATCH v15 10/60] i386/xen: implement HYPERVISOR_xen_version, David Woodhouse, 2023/03/01
- [PATCH v15 21/60] i386/xen: handle VCPUOP_register_vcpu_info, David Woodhouse, 2023/03/01
- [PATCH v15 37/60] hw/xen: Implement EVTCHNOP_bind_vcpu, David Woodhouse, 2023/03/01
- [PATCH v15 48/60] i386/xen: Reserve Xen special pages for console, xenstore rings, David Woodhouse, 2023/03/01
- [PATCH v15 13/60] hw/xen: Add xen_overlay device for emulating shared xenheap pages, David Woodhouse, 2023/03/01
- [PATCH v15 12/60] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield,
David Woodhouse <=
- [PATCH v15 55/60] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/03/01
- [PATCH v15 30/60] hw/xen: Implement EVTCHNOP_close, David Woodhouse, 2023/03/01
- [PATCH v15 09/60] i386/xen: handle guest hypercalls, David Woodhouse, 2023/03/01
- [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/03/01
- Re: [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, Xiaoyao Li, 2023/03/09
- Re: [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/03/10
- Re: [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, Paolo Bonzini, 2023/03/10
- Re: [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/03/10
- [PATCH] hw/xen: Simplify emulated Xen platform init, David Woodhouse, 2023/03/10
- Re: [PATCH] hw/xen: Simplify emulated Xen platform init, Paul Durrant, 2023/03/24