Skip to contentSkip to conversation

credit2: Add more debugging

PATCH In review George Dunlap 3 participants 3 messages Mar 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 credit2: Add more debugging

xen/common/sched_credit2.c +27 -0
diff -r f71212f712fd -r a3dd5d721c41 xen/common/sched_credit2.c
@@ -808,6 +808,7 @@
 __runq_deassign(struct csched_vcpu *svc)
 {
     BUG_ON(__vcpu_on_runq(svc));
+    BUG_ON(test_bit(__CSFLAG_scheduled, &svc->flags));
 
     list_del_init(&svc->rqd_elem);
     update_max_weight(svc->rqd, 0, svc->weight);
@@ -1603,6 +1604,32 @@
 
     /* Protected by runqueue lock */        
 
+    /* DEBUG */
+    if ( !is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd)
+    {
+        int other_rqi=-1, this_rqi;
+
+        this_rqi=c2r(ops, cpu);
+
+        if ( scurr->rqd )
+        {
+            int rq;
+            other_rqi=-2;
+            for_each_cpu_mask(rq, CSCHED_PRIV(ops)->active_queues)
+            {
+                if ( scurr->rqd == &CSCHED_PRIV(ops)->rqd[rq] )
+                {
+                    other_rqi = rq;
+                    break;
+                }
+            }
+        }
+        printk("%s: pcpu %d rq %d, but scurr d%dv%d assigned to pcpu %d rq %d!\n",
+               __func__,
+               cpu, this_rqi,
+               scurr->vcpu->domain->domain_id, scurr->vcpu->vcpu_id,
+               scurr->vcpu->processor, other_rqi);
+    }
     BUG_ON(!is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd);
 
     /* Clear "tickled" bit now that we've been scheduled */
#1 lore raw

George Dunlap writes ("[Xen-devel] [PATCH] credit2: Add more debugging"):

Quoted 1 line

...

Quoted 1 line

+ /* DEBUG */

Shouldn't this be in an #ifdef or something rather than just marked with a comment ?

Quoted 16 lines
xen/common/sched_credit2.c +16 -0
+    if ( !is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd)
+    {
+        int other_rqi=-1, this_rqi;
+
+        this_rqi=c2r(ops, cpu);
+
+        if ( scurr->rqd )
+        {
+            int rq;
+            other_rqi=-2;
+            for_each_cpu_mask(rq, CSCHED_PRIV(ops)->active_queues)
+            {
+                if ( scurr->rqd == &CSCHED_PRIV(ops)->rqd[rq] )
+                {
+                    other_rqi = rq;
+                    break;

xen/common/sched_credit2.c line 1633

Quoted 10 lines
xen/common/sched_credit2.c +9 -0
+                }
+            }
+        }
+        printk("%s: pcpu %d rq %d, but scurr d%dv%d assigned to pcpu %d rq %d!\n",
+               __func__,
+               cpu, this_rqi,
+               scurr->vcpu->domain->domain_id, scurr->vcpu->vcpu_id,
+               scurr->vcpu->processor, other_rqi);
+    }
     BUG_ON(!is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd);

And in general this seems like a somewhat odd construct.

Ian.

#2 lore raw

The purpose of this was to catch more information next time you see this bug in the automated testing; do you run it with debug=y?

If so, I'll change it to #ifndef NDEBUG ... #else BUG_ON() ... #endif

-George

Quoted 38 lines · Ian Jackson

George Dunlap writes ("[Xen-devel] [PATCH] credit2: Add more debugging"):

Quoted 1 line

...

Quoted 1 line

+ /* DEBUG */

Shouldn't this be in an #ifdef or something rather than just marked with a comment ?

Quoted 16 lines
xen/common/sched_credit2.c +16 -0
+    if ( !is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd)
+    {
+        int other_rqi=-1, this_rqi;
+
+        this_rqi=c2r(ops, cpu);
+
+        if ( scurr->rqd )
+        {
+            int rq;
+            other_rqi=-2;
+            for_each_cpu_mask(rq, CSCHED_PRIV(ops)->active_queues)
+            {
+                if ( scurr->rqd == &CSCHED_PRIV(ops)->rqd[rq] )
+                {
+                    other_rqi = rq;
+                    break;

xen/common/sched_credit2.c line 1633

Quoted 10 lines
xen/common/sched_credit2.c +9 -0
+                }
+            }
+        }
+        printk("%s: pcpu %d rq %d, but scurr d%dv%d assigned to pcpu %d rq %d!\n",
+               __func__,
+               cpu, this_rqi,
+               scurr->vcpu->domain->domain_id, scurr->vcpu->vcpu_id,
+               scurr->vcpu->processor, other_rqi);
+    }
     BUG_ON(!is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd);

And in general this seems like a somewhat odd construct.

Ian.