ia64/xen-unstable

changeset 1365:76c4a76ab5d1

bitkeeper revision 1.900 (40a1ea95C9xhe9YOF_J5uno7phAXWg)

Merge
author iap10@labyrinth.cl.cam.ac.uk
date Wed May 12 09:12:53 2004 +0000 (2004-05-12)
parents 5d4e9fe26885 2168eda5e9fe
children 6cf25fb7eebd
files .rootkeys docs/interface.tex tools/xentrace/formats tools/xentrace/xentrace_format tools/xentrace/xentrace_format.1 xen/arch/i386/setup.c xen/common/kernel.c xen/common/trace.c
line diff
     1.1 --- a/.rootkeys	Wed May 12 09:11:22 2004 +0000
     1.2 +++ b/.rootkeys	Wed May 12 09:12:53 2004 +0000
     1.3 @@ -112,6 +112,7 @@ 40431ac8wrUEj-XM7B8smFtx_HA7lQ tools/xen
     1.4  4054a2fdkdATEnRw-U7AUlgu-6JiUA tools/xend/setup.py
     1.5  4056cd26Qyp09iNoOjrvzg8KYzSqOw tools/xend/xend
     1.6  403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
     1.7 +40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats
     1.8  4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
     1.9  403a3edbVpV2E_wq1zeEkJ_n4Uu2eg tools/xentrace/xentrace.c
    1.10  403a3edb0lzD0Fojc-NYNoXr3SYrnA tools/xentrace/xentrace_cpusplit
     2.1 --- a/docs/interface.tex	Wed May 12 09:11:22 2004 +0000
     2.2 +++ b/docs/interface.tex	Wed May 12 09:12:53 2004 +0000
     2.3 @@ -705,12 +705,16 @@ value of the CPU cycle-counter.  For bui
     2.4  the macros expand to no-ops and thus can be left in place without incurring
     2.5  overheads.
     2.6  
     2.7 -\subsection{Enabling tracing}
     2.8 +\subsection{Trace-enabled builds}
     2.9  
    2.10  By default, the trace buffer is enabled only in debug builds (i.e. {\tt NDEBUG}
    2.11  is not defined).  It can be enabled separately by defining {\tt TRACE\_BUFFER},
    2.12  either in {\tt <xen/config.h>} or on the gcc command line.
    2.13  
    2.14 +The size (in pages) of the per-CPU trace buffers can be specified using the
    2.15 +{\tt tbuf_size=n } boot parameter to Xen.  If the size is set to 0, the trace
    2.16 +buffers will be disabled.
    2.17 +
    2.18  \subsection{Dumping trace data}
    2.19  
    2.20  When running a trace buffer build of Xen, trace data are written continuously
    2.21 @@ -725,10 +729,11 @@ in overall chronological order.
    2.22  
    2.23  The output from {\tt xentrace} can be post-processed using {\tt
    2.24  xentrace\_cpusplit} (used to split trace data out into per-cpu log files) and
    2.25 -{\tt xentrace\_format} (used to pretty-print trace data).
    2.26 +{\tt xentrace\_format} (used to pretty-print trace data).  For the predefined
    2.27 +trace points, there is an example format file in {\tt tools/xentrace/formats }.
    2.28  
    2.29 -For more information, see the manual pages for {\tt xentrace},
    2.30 -{\tt xentrace\_format} and {\tt xentrace\_cpusplit}.
    2.31 +For more information, see the manual pages for {\tt xentrace}, {\tt
    2.32 +xentrace\_format} and {\tt xentrace\_cpusplit}.
    2.33  
    2.34  
    2.35  \chapter{Hypervisor calls}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/xentrace/formats	Wed May 12 09:12:53 2004 +0000
     3.3 @@ -0,0 +1,14 @@
     3.4 +0x00010000	CPU%(cpu)d 0x%(tsc)x sched_add_domain(0x%(3)08x)            [ dom id = 0x%(1)08x%(2)08x   ]
     3.5 +0x00010001	CPU%(cpu)d 0x%(tsc)x sched_rem_domain(0x%08(3)x)            [ dom id = 0x%(1)08x%(2)08x   ]
     3.6 +0x00010002	CPU%(cpu)d 0x%(tsc)x __wake_up(0x%(3)08x)                   [ dom id = 0x%(1)08x%(2)08x   ]
     3.7 +0x00010003	CPU%(cpu)d 0x%(tsc)x do_block()                             [ current = 0x%(2)08x         ]
     3.8 +0x00010004	CPU%(cpu)d 0x%(tsc)x do_yield()		                    [ current = %(2)08x         ]
     3.9 +0x00010005	CPU%(cpu)d 0x%(tsc)x do_set_timer_op(0x%(4)08x, 0x%(5)08x)  [ current = 0x%(3)08x ]
    3.10 +0x00010006	CPU%(cpu)d 0x%(tsc)x sched_ctl(0x%(1)08x)
    3.11 +0x00010007	CPU%(cpu)d 0x%(tsc)x sched_adjdom(params)                   [ dom id = 0x%(1)08x%(2)08x   ]
    3.12 +0x00010008	CPU%(cpu)d 0x%(tsc)x __reschedule(0x%(3)08x)                [ dom id = 0x%(1)08x%(2)08x   ]
    3.13 +0x00010009	CPU%(cpu)d 0x%(tsc)x switching to task_struct 0x%(1)08x     [ dom id = 0x%(1)08x     ]
    3.14 +0x0001000A	CPU%(cpu)d 0x%(tsc)x s_timer_fn(unused)
    3.15 +0x0001000B	CPU%(cpu)d 0x%(tsc)x t_timer_fn(unused)
    3.16 +0x0001000C	CPU%(cpu)d 0x%(tsc)x dom_timer_fn(data)
    3.17 +0x0001000D	CPU%(cpu)d 0x%(tsc)x fallback_timer_fn(unused)
     4.1 --- a/tools/xentrace/xentrace_format	Wed May 12 09:11:22 2004 +0000
     4.2 +++ b/tools/xentrace/xentrace_format	Wed May 12 09:12:53 2004 +0000
     4.3 @@ -15,8 +15,10 @@ def usage():
     4.4  
     4.5            {event_id}{whitespace}{text format string}
     4.6  
     4.7 -          The textual format string may include the format specifiers:
     4.8 -            %(cpu)s, %(tsc), %(event)s, %(1)s, %(2)s, %(3)s, %(4)s, %(5)s
     4.9 +          The textual format string may include format specifiers, such as:
    4.10 +            %(cpu)d, %(tsc)d, %(event)d, %(1)d, %(2)d, %(3)d, %(4)d, %(5)d
    4.11 +          [ the 'd' format specifier outputs in decimal, alternatively 'x'
    4.12 +            will output in hexadecimal and 'o' will output in octal ]
    4.13  
    4.14            Which correspond to the CPU number, event ID, timestamp counter and
    4.15            the 5 data fields from the trace record.  There should be one such
    4.16 @@ -34,7 +36,7 @@ def read_defs(defs_file):
    4.17      
    4.18      fd = open(defs_file)
    4.19  
    4.20 -    reg = re.compile('(\d+)\s+(\S.*)')
    4.21 +    reg = re.compile('(\S+)\s+(\S.*)')
    4.22  
    4.23      while True:
    4.24          line = fd.readline()
    4.25 @@ -45,7 +47,7 @@ def read_defs(defs_file):
    4.26  
    4.27          if not m: print >> sys.stderr, "Bad format file" ; sys.exit(1)
    4.28          
    4.29 -        defs[m.group(1)] = m.group(2)
    4.30 +        defs[str(eval(m.group(1)))] = m.group(2)
    4.31  
    4.32      return defs
    4.33  
    4.34 @@ -73,20 +75,20 @@ while not interrupted:
    4.35          line = sys.stdin.readline()
    4.36          if not line:
    4.37              break
    4.38 -
    4.39 +        
    4.40          m = reg.match(line)
    4.41  
    4.42          if not m: print >> sys.stderr, "Invalid input line."
    4.43  
    4.44          s = string.split(m.group(4))
    4.45  
    4.46 -        args = {'cpu'   : m.group(1),
    4.47 -                'tsc'   : m.group(2),
    4.48 -                'event' : m.group(3) }
    4.49 +        args = {'cpu'   : eval(m.group(1)),
    4.50 +                'tsc'   : eval(m.group(2)),
    4.51 +                'event' : eval(m.group(3)) }
    4.52  
    4.53 -        i = 0
    4.54 +        i = 1
    4.55          for item in s:
    4.56 -            args[str(i)] = item
    4.57 +            args[str(i)] = eval(item)
    4.58              i += 1
    4.59  
    4.60          if defs.has_key(m.group(3)): print defs[m.group(3)] % args
     5.1 --- a/tools/xentrace/xentrace_format.1	Wed May 12 09:11:22 2004 +0000
     5.2 +++ b/tools/xentrace/xentrace_format.1	Wed May 12 09:12:53 2004 +0000
     5.3 @@ -1,4 +1,4 @@
     5.4 -.TH XENTRACE_FORMAT 1 "11 March 2004" "Xen domain 0 utils"
     5.5 +.TH XENTRACE_FORMAT 1 "11 May 2004" "Xen domain 0 utils"
     5.6  .SH NAME
     5.7  xentrace_format \- pretty-print Xen trace data
     5.8  .SH SYNOPSIS
     5.9 @@ -18,14 +18,20 @@ The rules in \fIDEFS-FILE\fP should have
    5.10  
    5.11  Each rule should start on a new line.
    5.12  
    5.13 -The format string may include the following format specifiers:
    5.14 -%(cpu)s, %(tsc), %(event)s, %(1)s, %(2)s, %(3)s, %(4)s, %(5)s
    5.15 +The format string may include format specifiers, such as:
    5.16 +%(cpu)d, %(tsc)d, %(event)d, %(1)d, %(2)d, %(3)d, %(4)d, %(5)d
    5.17 +
    5.18 +[ the `d' format specifier output in decimal, alternatively `x'
    5.19 +  will output in hexadecimal and `o' will output in octal ]
    5.20  
    5.21  These correspond to the CPU number, event ID, timestamp counter and
    5.22  the 5 data fields from the trace record.  There should be one such
    5.23  rule for each type of event to be pretty-printed (events which do not
    5.24  have formatting rules are ignored).
    5.25 -          
    5.26 +
    5.27 +A sample format file for Xen's predefined trace events is available
    5.28 +in the file tools/xentrace/formats in the Xen source tree.
    5.29 +
    5.30  Depending on your system and the rate at which trace data is produced,
    5.31  this script may not be able to keep up with the output of
    5.32  \fBxentrace\fP if it is piped directly.  In these circumstances you
     6.1 --- a/xen/arch/i386/setup.c	Wed May 12 09:11:22 2004 +0000
     6.2 +++ b/xen/arch/i386/setup.c	Wed May 12 09:12:53 2004 +0000
     6.3 @@ -15,7 +15,6 @@
     6.4  #include <asm/desc.h>
     6.5  #include <asm/domain_page.h>
     6.6  #include <asm/pdb.h>
     6.7 -#include <xen/trace.h>
     6.8  
     6.9  char ignore_irq13;		/* set if exception 16 works */
    6.10  struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
    6.11 @@ -451,6 +450,4 @@ void __init start_of_day(void)
    6.12  #endif
    6.13  
    6.14      watchdog_on = 1;
    6.15 -
    6.16 -    init_trace_bufs();
    6.17  }
     7.1 --- a/xen/common/kernel.c	Wed May 12 09:11:22 2004 +0000
     7.2 +++ b/xen/common/kernel.c	Wed May 12 09:12:53 2004 +0000
     7.3 @@ -32,6 +32,7 @@
     7.4  #include <xen/net_headers.h>
     7.5  #include <xen/serial.h>
     7.6  #include <xen/shadow.h>
     7.7 +#include <xen/trace.h>
     7.8  
     7.9  kmem_cache_t *task_struct_cachep;
    7.10  
    7.11 @@ -291,6 +292,8 @@ void cmain(unsigned long magic, multiboo
    7.12      add_to_domain_alloc_list(__pa(frame_table) + frame_table_size,
    7.13                               dom0_memory_start);
    7.14  
    7.15 +    init_trace_bufs();
    7.16 +
    7.17      wake_up(new_dom);
    7.18  
    7.19      startup_cpu_idle_loop();
     8.1 --- a/xen/common/trace.c	Wed May 12 09:11:22 2004 +0000
     8.2 +++ b/xen/common/trace.c	Wed May 12 09:12:53 2004 +0000
     8.3 @@ -53,6 +53,7 @@ void init_trace_bufs(void)
     8.4      unsigned long nr_pages;
     8.5      char         *rawbuf;
     8.6      struct t_buf *buf;
     8.7 +    struct task_struct *dom0;
     8.8      
     8.9      if ( opt_tbuf_size == 0 )
    8.10      {
    8.11 @@ -69,10 +70,15 @@ void init_trace_bufs(void)
    8.12          return;
    8.13      }
    8.14  
    8.15 -    /* share pages so that xentrace can map them */
    8.16 +    /* Share pages so that xentrace can map them. */
    8.17 +
    8.18 +    dom0 = find_domain_by_id(0);
    8.19 +
    8.20      for( i = 0; i < nr_pages; i++)
    8.21 -        SHARE_PFN_WITH_DOMAIN(virt_to_page(rawbuf+(i*PAGE_SIZE)), 0);
    8.22 +        SHARE_PFN_WITH_DOMAIN(virt_to_page(rawbuf+(i*PAGE_SIZE)), dom0);
    8.23      
    8.24 +    put_task_struct(dom0);
    8.25 +
    8.26      for ( i = 0; i < smp_num_cpus; i++ )
    8.27      {
    8.28          buf = t_bufs[i] = (struct t_buf *)&rawbuf[i*opt_tbuf_size*PAGE_SIZE];