direct-io.hg

changeset 7801:e580f8051888

Extra tracing in Xen to support XenMon.
Signed-off-by: Rob Gardner <rob.gardner@hp.com>

I also appied some fixes and simplifications to the tracing.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Nov 15 14:59:59 2005 +0100 (2005-11-15)
parents 6e3e98e1c182
children 394390f6ff85
files xen/common/grant_table.c xen/common/schedule.c xen/include/public/trace.h
line diff
     1.1 --- a/xen/common/grant_table.c	Tue Nov 15 11:36:44 2005 +0100
     1.2 +++ b/xen/common/grant_table.c	Tue Nov 15 14:59:59 2005 +0100
     1.3 @@ -29,6 +29,7 @@
     1.4  #include <xen/shadow.h>
     1.5  #include <xen/mm.h>
     1.6  #include <acm/acm_hooks.h>
     1.7 +#include <xen/trace.h>
     1.8  
     1.9  #if defined(CONFIG_X86_64)
    1.10  #define GRANT_PTE_FLAGS (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
    1.11 @@ -379,6 +380,8 @@ static int
    1.12          }
    1.13      }
    1.14  
    1.15 +    TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, dom);
    1.16 +
    1.17      ld->grant_table->maptrack[handle].domid         = dom;
    1.18      ld->grant_table->maptrack[handle].ref_and_flags =
    1.19          (ref << MAPTRACK_REF_SHIFT) |
    1.20 @@ -463,6 +466,8 @@ static int
    1.21          return GNTST_bad_domain;
    1.22      }
    1.23  
    1.24 +    TRACE_1D(TRC_MEM_PAGE_GRANT_UNMAP, dom);
    1.25 +
    1.26      act = &rd->grant_table->active[ref];
    1.27      sha = &rd->grant_table->shared[ref];
    1.28  
    1.29 @@ -802,6 +807,8 @@ gnttab_transfer(
    1.30          page_set_owner(page, e);
    1.31          
    1.32          spin_unlock(&e->page_alloc_lock);
    1.33 +
    1.34 +        TRACE_1D(TRC_MEM_PAGE_GRANT_TRANSFER, e->domain_id);
    1.35          
    1.36          /* Tell the guest about its new page frame. */
    1.37          sha = &e->grant_table->shared[gop->ref];
     2.1 --- a/xen/common/schedule.c	Tue Nov 15 11:36:44 2005 +0100
     2.2 +++ b/xen/common/schedule.c	Tue Nov 15 14:59:59 2005 +0100
     2.3 @@ -13,15 +13,6 @@
     2.4   *
     2.5   */
     2.6  
     2.7 -/*#define WAKE_HISTO*/
     2.8 -/*#define BLOCKTIME_HISTO*/
     2.9 -
    2.10 -#if defined(WAKE_HISTO)
    2.11 -#define BUCKETS 31
    2.12 -#elif defined(BLOCKTIME_HISTO)
    2.13 -#define BUCKETS 200
    2.14 -#endif
    2.15 -
    2.16  #include <xen/config.h>
    2.17  #include <xen/init.h>
    2.18  #include <xen/lib.h>
    2.19 @@ -45,6 +36,8 @@ extern void arch_getdomaininfo_ctxt(stru
    2.20  static char opt_sched[10] = "sedf";
    2.21  string_param("sched", opt_sched);
    2.22  
    2.23 +/*#define WAKE_HISTO*/
    2.24 +/*#define BLOCKTIME_HISTO*/
    2.25  #if defined(WAKE_HISTO)
    2.26  #define BUCKETS 31
    2.27  #elif defined(BLOCKTIME_HISTO)
    2.28 @@ -205,9 +198,7 @@ void vcpu_wake(struct vcpu *v)
    2.29      if ( likely(domain_runnable(v)) )
    2.30      {
    2.31          SCHED_OP(wake, v);
    2.32 -#ifdef WAKE_HISTO
    2.33          v->wokenup = NOW();
    2.34 -#endif
    2.35      }
    2.36      clear_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
    2.37      spin_unlock_irqrestore(&schedule_data[v->processor].schedule_lock, flags);
    2.38 @@ -416,11 +407,26 @@ static void __enter_scheduler(void)
    2.39          return continue_running(prev);
    2.40      }
    2.41  
    2.42 +    TRACE_2D(TRC_SCHED_SWITCH_INFPREV,
    2.43 +             prev->domain->domain_id, now - prev->lastschd);
    2.44 +    TRACE_3D(TRC_SCHED_SWITCH_INFNEXT,
    2.45 +             next->domain->domain_id, now - next->wokenup, r_time);
    2.46 +
    2.47      clear_bit(_VCPUF_running, &prev->vcpu_flags);
    2.48      set_bit(_VCPUF_running, &next->vcpu_flags);
    2.49  
    2.50      perfc_incrc(sched_ctx);
    2.51  
    2.52 +    /*
    2.53 +     * Logic of wokenup field in domain struct:
    2.54 +     * Used to calculate "waiting time", which is the time that a domain
    2.55 +     * spends being "runnable", but not actually running. wokenup is set
    2.56 +     * set whenever a domain wakes from sleeping. However, if wokenup is not
    2.57 +     * also set here then a preempted runnable domain will get a screwed up
    2.58 +     * "waiting time" value next time it is scheduled.
    2.59 +     */
    2.60 +    prev->wokenup = NOW();
    2.61 +
    2.62  #if defined(WAKE_HISTO)
    2.63      if ( !is_idle_task(next->domain) && next->wokenup )
    2.64      {
     3.1 --- a/xen/include/public/trace.h	Tue Nov 15 11:36:44 2005 +0100
     3.2 +++ b/xen/include/public/trace.h	Tue Nov 15 14:59:59 2005 +0100
     3.3 @@ -14,6 +14,7 @@
     3.4  #define TRC_SCHED   0x0002f000    /* Xen Scheduler trace      */
     3.5  #define TRC_DOM0OP  0x0004f000    /* Xen DOM0 operation trace */
     3.6  #define TRC_VMX     0x0008f000    /* Xen VMX trace            */
     3.7 +#define TRC_MEM     0x000af000    /* Xen memory trace         */
     3.8  #define TRC_ALL     0xfffff000
     3.9  
    3.10  /* Trace subclasses */
    3.11 @@ -40,6 +41,12 @@
    3.12  #define TRC_SCHED_S_TIMER_FN    (TRC_SCHED + 11)
    3.13  #define TRC_SCHED_T_TIMER_FN    (TRC_SCHED + 12)
    3.14  #define TRC_SCHED_DOM_TIMER_FN  (TRC_SCHED + 13)
    3.15 +#define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED + 14)
    3.16 +#define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED + 15)
    3.17 +
    3.18 +#define TRC_MEM_PAGE_GRANT_MAP      (TRC_MEM + 1)
    3.19 +#define TRC_MEM_PAGE_GRANT_UNMAP    (TRC_MEM + 2)
    3.20 +#define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3)
    3.21  
    3.22  /* trace events per subclass */
    3.23  #define TRC_VMX_VMEXIT          (TRC_VMXEXIT + 1)