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_babc...@epam.com>
---
 xen/arch/arm/traps.c | 7 +++++++
 1 file changed, 7 insertions(+)

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)
-- 
2.29.2

Reply via email to