[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 02/10] sched: rt: save IRQ state during locking


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 23 Feb 2021 02:34:56 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QJTEpv4AaTo8JBp7LsUk0AWc8Ja4nv4Eo3TfeWXSlUU=; b=T5AYYPqAqrpYKj8JVdeZoHb3cgrDqP0j6dtnaxW0pM6j81cpXvL9vKEM531IeaQoQVQaPGFG83wunAZKoDbQEI0mAR/2xOkr1FIiK3BrmS+v0NtvUsvl1RwMRUMr6HNd/kSGwwmRgShpAHx7U3Cbib84liEb51d7qhe6nfgdktyT2XwQVkDwfut5qClAgtFl3IVVGzB71FFQX4QKO+Nx6kkFNoDqk2hT5UmAAvJmiXLaT/PORgHwWQVjvxMUMHGSyiaWNa4nVwhq9m04Jopnu4vADva4Lts2oomT8QaEpFjup238DNMwvMKFVNtGzpeDxD71YEYfkXSsC+DIAgoAMg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CvtP5KMBplTBWpgA6/CvU5jOwv9Af/k5Xbh57TfCHRdCgHI8E0UbUmr9CrnxaK3Vm5zPJUhSzf1WsRdp5+x+Q/8M56T5KO1hUVjrHzYbFSdruSevpde4Z8SbZEQhFh4NE7xA4UDKfVIQvaC84rfpzRDdEUJE++lJ3MP5Sm7L7HfNvz2H5b3npX7v/yXz58XloyfWeQsWiGHQzkjSBnmJINcWo8S8g4m6uBjKrjpV7yaSpReKYWRZ1uvkgmcJlMQY3YPRVGdc9dNpRjMhxDUPr80sKDWnbHfiDtfwvokcRAvakJILu+lx5PKt00tNNGu+okwqHbOE9/EQ5DW5QGfJ9w==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=epam.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Meng Xu <mengxu@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Tue, 23 Feb 2021 02:35:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXCYx4gKfh+6izfkCEXHj4/bqk4w==
  • Thread-topic: [RFC PATCH 02/10] sched: rt: save IRQ state during locking

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@xxxxxxxx>
---
 xen/common/sched/rt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index c24cd2ac32..e1711a8edc 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -1318,7 +1318,8 @@ static void
 rt_context_saved(const struct scheduler *ops, struct sched_unit *unit)
 {
     struct rt_unit *svc = rt_unit(unit);
-    spinlock_t *lock = unit_schedule_lock_irq(unit);
+    unsigned long flags;
+    spinlock_t *lock = unit_schedule_lock_irqsave(unit, &flags);
 
     __clear_bit(__RTDS_scheduled, &svc->flags);
     /* not insert idle unit to runq */
@@ -1335,7 +1336,7 @@ rt_context_saved(const struct scheduler *ops, struct 
sched_unit *unit)
         replq_remove(ops, svc);
 
 out:
-    unit_schedule_unlock_irq(lock, unit);
+    unit_schedule_unlock_irqrestore(lock, flags, unit);
 }
 
 /*
@@ -1460,9 +1461,10 @@ static void repl_timer_handler(void *data){
     struct list_head *runq = rt_runq(ops);
     struct list_head *iter, *tmp;
     struct rt_unit *svc;
+    unsigned long flags;
     LIST_HEAD(tmp_replq);
 
-    spin_lock_irq(&prv->lock);
+    spin_lock_irqsave(&prv->lock, flags);
 
     now = NOW();
 
@@ -1525,7 +1527,7 @@ static void repl_timer_handler(void *data){
     if ( !list_empty(replq) )
         set_timer(&prv->repl_timer, replq_elem(replq->next)->cur_deadline);
 
-    spin_unlock_irq(&prv->lock);
+    spin_unlock_irqrestore(&prv->lock, flags);
 }
 
 static const struct scheduler sched_rtds_def = {
-- 
2.29.2



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.