ia64/xen-unstable

changeset 18531:81483e49c74c

Add debug key 'e' for event channel information

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 22 15:50:59 2008 +0100 (2008-09-22)
parents ae29cd95ba7d
children 415c3da25b26
files xen/common/event_channel.c xen/common/keyhandler.c
line diff
     1.1 --- a/xen/common/event_channel.c	Mon Sep 22 15:33:42 2008 +0100
     1.2 +++ b/xen/common/event_channel.c	Mon Sep 22 15:50:59 2008 +0100
     1.3 @@ -25,6 +25,7 @@
     1.4  #include <xen/iocap.h>
     1.5  #include <xen/compat.h>
     1.6  #include <xen/guest_access.h>
     1.7 +#include <xen/keyhandler.h>
     1.8  #include <asm/current.h>
     1.9  
    1.10  #include <public/xen.h>
    1.11 @@ -1079,6 +1080,77 @@ void evtchn_destroy(struct domain *d)
    1.12      spin_unlock(&d->evtchn_lock);
    1.13  }
    1.14  
    1.15 +static void domain_dump_evtchn_info(struct domain *d)
    1.16 +{
    1.17 +    unsigned int port;
    1.18 +
    1.19 +    printk("Domain %d polling vCPUs: %08lx\n", d->domain_id, d->poll_mask[0]);
    1.20 +
    1.21 +    if ( !spin_trylock(&d->evtchn_lock) )
    1.22 +        return;
    1.23 +
    1.24 +    printk("Event channel information for domain %d:\n",
    1.25 +           d->domain_id);
    1.26 +
    1.27 +    for ( port = 1; port < MAX_EVTCHNS(d); ++port )
    1.28 +    {
    1.29 +        const struct evtchn *chn;
    1.30 +
    1.31 +        if ( !port_is_valid(d, port) )
    1.32 +            continue;
    1.33 +        chn = evtchn_from_port(d, port);
    1.34 +        if ( chn->state == ECS_FREE )
    1.35 +            continue;
    1.36 +
    1.37 +        printk("    %4u[%d/%d]: s=%d n=%d",
    1.38 +               port,
    1.39 +               test_bit(port, &shared_info(d, evtchn_pending)),
    1.40 +               test_bit(port, &shared_info(d, evtchn_mask)),
    1.41 +               chn->state, chn->notify_vcpu_id);
    1.42 +        switch ( chn->state )
    1.43 +        {
    1.44 +        case ECS_UNBOUND:
    1.45 +            printk(" d=%d", chn->u.unbound.remote_domid);
    1.46 +            break;
    1.47 +        case ECS_INTERDOMAIN:
    1.48 +            printk(" d=%d p=%d",
    1.49 +                   chn->u.interdomain.remote_dom->domain_id,
    1.50 +                   chn->u.interdomain.remote_port);
    1.51 +            break;
    1.52 +        case ECS_PIRQ:
    1.53 +            printk(" p=%d", chn->u.pirq);
    1.54 +            break;
    1.55 +        case ECS_VIRQ:
    1.56 +            printk(" v=%d", chn->u.virq);
    1.57 +            break;
    1.58 +        }
    1.59 +        printk(" x=%d\n", chn->consumer_is_xen);
    1.60 +    }
    1.61 +
    1.62 +    spin_unlock(&d->evtchn_lock);
    1.63 +}
    1.64 +
    1.65 +static void dump_evtchn_info(unsigned char key)
    1.66 +{
    1.67 +    struct domain *d;
    1.68 +
    1.69 +    printk("'%c' pressed -> dumping event-channel info\n", key);
    1.70 +
    1.71 +    rcu_read_lock(&domlist_read_lock);
    1.72 +
    1.73 +    for_each_domain ( d )
    1.74 +        domain_dump_evtchn_info(d);
    1.75 +
    1.76 +    rcu_read_unlock(&domlist_read_lock);
    1.77 +}
    1.78 +
    1.79 +static int __init dump_evtchn_info_key_init(void)
    1.80 +{
    1.81 +    register_keyhandler('e', dump_evtchn_info, "dump evtchn info");
    1.82 +    return 0;
    1.83 +}
    1.84 +__initcall(dump_evtchn_info_key_init);
    1.85 +
    1.86  /*
    1.87   * Local variables:
    1.88   * mode: C
     2.1 --- a/xen/common/keyhandler.c	Mon Sep 22 15:33:42 2008 +0100
     2.2 +++ b/xen/common/keyhandler.c	Mon Sep 22 15:50:59 2008 +0100
     2.3 @@ -204,11 +204,11 @@ static void dump_domains(unsigned char k
     2.4          printk("VCPU information and callbacks for domain %u:\n",
     2.5                 d->domain_id);
     2.6          for_each_vcpu ( d, v ) {
     2.7 -            printk("    VCPU%d: CPU%d [has=%c] flags=%lx "
     2.8 +            printk("    VCPU%d: CPU%d [has=%c] flags=%lx poll=%d "
     2.9                     "upcall_pend = %02x, upcall_mask = %02x ",
    2.10                     v->vcpu_id, v->processor,
    2.11                     v->is_running ? 'T':'F',
    2.12 -                   v->pause_flags,
    2.13 +                   v->pause_flags, v->poll_evtchn,
    2.14                     vcpu_info(v, evtchn_upcall_pending),
    2.15                     vcpu_info(v, evtchn_upcall_mask));
    2.16              cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);