WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] sched_credit: Hold lock while dump schedu

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] sched_credit: Hold lock while dump scheduler info
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sun, 06 Mar 2011 07:00:09 +0000
Delivery-date: Sat, 05 Mar 2011 23:00:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1299324981 0
# Node ID a1108fe570869a8c05c547497cb9e18c8445f6e8
# Parent  d3d29df8f082d77c5fa8c790b4c97064943aef2d
sched_credit: Hold lock while dump scheduler info

Dump runq with debug key 'r' may cause dead loop like below:

(XEN) active vcpus:
(XEN)     1: [1.0] pri=0 flags=0 cpu=0 credit=263 [w=256]
(XEN)     2: [0.2] pri=0 flags=0 cpu=5 credit=284 [w=256]
(XEN)     3: [0.2] pri=0 flags=0 cpu=5 credit=282 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=2 credit=54 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=3 credit=-48 [w=256]
...

This means the active vcpu 0.2 became non-active with the active list
element empty just after it was accessed in the loop '2:'.

We should always hold a lock before access scheduler related list,
even in the debug purpose dump code.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---


diff -r d3d29df8f082 -r a1108fe57086 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Sat Mar 05 11:34:41 2011 +0000
+++ b/xen/common/sched_credit.c Sat Mar 05 11:36:21 2011 +0000
@@ -1452,6 +1452,10 @@
     struct list_head *iter_sdom, *iter_svc;
     struct csched_private *prv = CSCHED_PRIV(ops);
     int loop;
+    unsigned long flags;
+
+    spin_lock_irqsave(&(prv->lock), flags);
+
 #define idlers_buf keyhandler_scratch
 
     printk("info:\n"
@@ -1500,6 +1504,8 @@
         }
     }
 #undef idlers_buf
+
+    spin_unlock_irqrestore(&(prv->lock), flags);
 }
 
 static int

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] sched_credit: Hold lock while dump scheduler info, Xen patchbot-unstable <=