diff mbox series

[RFC,03/10] sched: credit2: save IRQ state during locking

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

Commit Message

Volodymyr Babchuk Feb. 23, 2021, 2:34 a.m. UTC
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_babchuk@epam.com>
---
 xen/common/sched/credit2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);
 }