[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 12/58] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield
From: |
David Woodhouse |
Subject: |
[PATCH v8 12/58] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield |
Date: |
Fri, 20 Jan 2023 13:12:57 +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 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;
}
--
2.39.0
- [PATCH v8 31/58] hw/xen: Implement EVTCHNOP_bind_virq, (continued)
- [PATCH v8 31/58] hw/xen: Implement EVTCHNOP_bind_virq, David Woodhouse, 2023/01/20
- [PATCH v8 49/58] hw/xen: Add backend implementation of interdomain event channel support, David Woodhouse, 2023/01/20
- [PATCH v8 35/58] hw/xen: Implement EVTCHNOP_bind_interdomain, David Woodhouse, 2023/01/20
- [PATCH v8 52/58] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests, David Woodhouse, 2023/01/20
- [PATCH v8 01/58] include: import Xen public headers to include/standard-headers/, David Woodhouse, 2023/01/20
- [PATCH v8 15/58] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/01/20
- [PATCH v8 29/58] hw/xen: Implement EVTCHNOP_close, David Woodhouse, 2023/01/20
- [PATCH v8 18/58] i386/xen: implement HYPERVISOR_hvm_op, David Woodhouse, 2023/01/20
- [PATCH v8 28/58] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/01/20
- [PATCH v8 12/58] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield,
David Woodhouse <=
- [PATCH v8 14/58] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/01/20
- [PATCH v8 57/58] hw/xen: Support MSI mapping to PIRQ, David Woodhouse, 2023/01/20
- [PATCH v8 06/58] i386/hvm: Set Xen vCPU ID in KVM, David Woodhouse, 2023/01/20
- [PATCH v8 33/58] hw/xen: Implement EVTCHNOP_send, David Woodhouse, 2023/01/20
- [PATCH v8 19/58] i386/xen: implement HYPERVISOR_vcpu_op, David Woodhouse, 2023/01/20
- [PATCH v8 03/58] xen: Add XEN_DISABLED mode and make it default, David Woodhouse, 2023/01/20
- [PATCH v8 37/58] hw/xen: Implement EVTCHNOP_reset, David Woodhouse, 2023/01/20
- [PATCH v8 47/58] i386/xen: Reserve Xen special pages for console, xenstore rings, David Woodhouse, 2023/01/20
- [PATCH v8 32/58] hw/xen: Implement EVTCHNOP_bind_ipi, David Woodhouse, 2023/01/20
- [PATCH v8 43/58] hw/xen: Support mapping grant frames, David Woodhouse, 2023/01/20