Skip to contentSkip to conversation

add event channel information to domain dump

PATCH In review Jan Beulich 2 participants 2 messages Sep 19, 2008 – Sep 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add event channel information to domain dump

Given the existance of lsevtchn, perhaps this should be done only for Dom0, where the information may be necessary but unavailable (i.e. because the domain is hanging).

xen/common/event_channel.c +50 -0
Index: 2008-09-19/xen/common/event_channel.c
===================================================================
@@ -1079,6 +1079,56 @@ void evtchn_destroy(struct domain *d)
     spin_unlock(&d->evtchn_lock);
 }
 
+void dump_evtchn_info(struct domain *d)
+{
+    unsigned int port;
+
+    printk("Domain %d polling vCPUs: %08lx\n", d->domain_id, d->poll_mask[0]);
+
+    if ( !spin_trylock(&d->evtchn_lock) )
+        return;
+
+    printk("Event channel information for domain %d:\n",
+           d->domain_id);
+
+    for ( port = 1; port < MAX_EVTCHNS(d); ++port )
+    {
+        const struct evtchn *chn;
+
+        if ( !port_is_valid(d, port) )
+            continue;
+        chn = evtchn_from_port(d, port);
+        if ( chn->state == ECS_FREE )
+            continue;
+
+        printk("    %4u[%d/%d]: s=%d n=%d",
+               port,
+               test_bit(port, &shared_info(d, evtchn_pending)),
+               test_bit(port, &shared_info(d, evtchn_mask)),
+               chn->state, chn->notify_vcpu_id);
+        switch ( chn->state )
+        {
+        case ECS_UNBOUND:
+            printk(" d=%d", chn->u.unbound.remote_domid);
+            break;
+        case ECS_INTERDOMAIN:
+            printk(" d=%d p=%d",
+                   chn->u.interdomain.remote_dom->domain_id,
+                   chn->u.interdomain.remote_port);
+            break;
+        case ECS_PIRQ:
+            printk(" p=%d", chn->u.pirq);
+            break;
+        case ECS_VIRQ:
+            printk(" v=%d", chn->u.virq);
+            break;
+        }
+        printk(" x=%d\n", chn->consumer_is_xen);
+    }
+
+    spin_unlock(&d->evtchn_lock);
+}
+
 /*
  * Local variables:
  * mode: C
xen/common/keyhandler.c +4 -2
Index: 2008-09-19/xen/common/keyhandler.c
===================================================================
@@ -205,11 +205,11 @@ static void dump_domains(unsigned char k
         printk("VCPU information and callbacks for domain %u:\n",
                d->domain_id);
         for_each_vcpu ( d, v ) {
-            printk("    VCPU%d: CPU%d [has=%c] flags=%lx "
+            printk("    VCPU%d: CPU%d [has=%c] flags=%lx poll=%d "
                    "upcall_pend = %02x, upcall_mask = %02x ",
                    v->vcpu_id, v->processor,
                    v->is_running ? 'T':'F',
-                   v->pause_flags,
+                   v->pause_flags, v->poll_evtchn,
                    vcpu_info(v, evtchn_upcall_pending),
                    vcpu_info(v, evtchn_upcall_mask));
             cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);
@@ -230,6 +230,8 @@ static void dump_domains(unsigned char k
                             &vcpu_info(v, evtchn_pending_sel)));
             send_guest_vcpu_virq(v, VIRQ_DEBUG);
         }
+
+        dump_evtchn_info(d);
     }
 
     rcu_read_unlock(&domlist_read_lock);
xen/include/xen/event.h +2 -0
Index: 2008-09-19/xen/include/xen/event.h
===================================================================
@@ -79,4 +79,6 @@ void notify_via_xen_event_channel(int lp
         mb(); /* set blocked status /then/ caller does his work */      \
     } while ( 0 )
 
+void dump_evtchn_info(struct domain *);
+
 #endif /* __XEN_EVENT_H__ */
#1 lore raw
Quoted 5 lines · Jan Beulich

Given the existance of lsevtchn, perhaps this should be done only for Dom0, where the information may be necessary but unavailable (i.e. because the domain is hanging).

I think this can go on a new debug key, as it could be pretty lengthy. So I checked it in as debug key 'e'.

-- Keir