With XEN preemption enabled, scheduler functions can be called with
IRQs disabled (for example, at end of IRQ handler), so we should
save and restore IRQ state in schedulers code.

Signed-off-by: Volodymyr Babchuk <volodymyr_babc...@epam.com>
---
 xen/common/sched/credit2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index eb5e5a78c5..b3a9786425 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -2297,7 +2297,8 @@ static void
 csched2_context_saved(const struct scheduler *ops, struct sched_unit *unit)
 {
     struct csched2_unit * const svc = csched2_unit(unit);
-    spinlock_t *lock = unit_schedule_lock_irq(unit);
+    unsigned long flags;
+    spinlock_t *lock = unit_schedule_lock_irqsave(unit, &flags);
     s_time_t now = NOW();
     LIST_HEAD(were_parked);
 
@@ -2329,7 +2330,7 @@ csched2_context_saved(const struct scheduler *ops, struct 
sched_unit *unit)
     else if ( !is_idle_unit(unit) )
         update_load(ops, svc->rqd, svc, -1, now);
 
-    unit_schedule_unlock_irq(lock, unit);
+    unit_schedule_unlock_irqrestore(lock, flags, unit);
 
     unpark_parked_units(ops, &were_parked);
 }
-- 
2.29.2

Reply via email to