diff mbox series

[RFC,09/10] arm: traps: try to preempt before leaving IRQ handler

Message ID 20210223023428.757694-10-volodymyr_babchuk@epam.com (mailing list archive)
State New
Headers show
Series Preemption in hypervisor (ARM only) | expand

Commit Message

Volodymyr Babchuk Feb. 23, 2021, 2:34 a.m. UTC
Now we can try to preempt code that is running in hypervisor code. To
do so we need to try to invoke scheduler by calling try_preempt(),
while not in nested IRQ handler.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/arch/arm/traps.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6fa135050b..98a4fb4904 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2260,7 +2260,14 @@  void do_trap_guest_serror(struct cpu_user_regs *regs)
 
 void do_trap_irq(struct cpu_user_regs *regs)
 {
+    static DEFINE_PER_CPU(unsigned int, irq_entry_cnt);
+
+    this_cpu(irq_entry_cnt)++;
     gic_interrupt(regs, 0);
+    this_cpu(irq_entry_cnt)--;
+
+    if (this_cpu(irq_entry_cnt) == 0)
+        try_preempt(true);
 }
 
 void do_trap_fiq(struct cpu_user_regs *regs)