			Xenoprof/IA64 HOWTO

                          Written by Isaku Yamahata <yamahata at valinux co jp>
                                                                 15th Jan, 2008


Introduction
------------
This documents describes how to use xenoprof/ia64.
See oprofile site for the details of oprofile itself.


Reference
---------
oprofile
http://oprofile.sourceforge.net/news/

xenoprof
http://xenoprof.sourceforge.net/


Requirement
-----------
- xen VMM
  xen-ia64-devel.hg c/s 16632:2900e4dacaa7 or later
  Probably xen 3.2 or later would be OK.

- dom0/domU Linux
  linux kernel tree corresponding to xen VMM.

- Oprofile
  oprofile 0.9.3 or later
  get the patch for oprofile 0.9.3 from http://xenoprof.sourceforge.net/
  oprofile-0.9.3-xen-r2.patch or later
  NOTE:The xenoprof/IA64 specific part is already included in the development
       cvs tree.

- Documentation
  You can find the documentation from http://xenoprof.sourceforge.net/.
  It doesn't cover IA64 specific part, but it almost applies.


Options to opcontrol
--------------------
You have to tell the oprofile daemon that the session is xenoprof one
by "--xen" option.
--xen=<xen_image_file>
  Specify the xen image.
--active-domains<list>
  Specify active domains
--passive-domains=<list>
  Specify passive domains


Examples
--------
- dom0 active, dom1 passive case example
  on dom0
  # opctonrol --start-daemon --xen=<path to xen-syms> \
    --vmlinux=<path to vmlinux> \
    --active-domains=0 --passive-domains=1
  # opcontrol --start

  <make activity you want>

  # opcontrol --stop (or opcontrol --shutdown)
  # opreport -l or something to get the result


- both dom0 and dom1 active example
  on dom0
  # opctonrol --start-daemon --xen=<path to xen-syms> \
    --vmlinux=<path to vmlinux> \
    --active-domains=0,1

  on dom1
  # opctonrol --start-daemon --xen=<path to xen-syms> \
    --vmlinux=<path to vmlinux>
  domain1 isn't primary domain so that --active-domains/--passive-domains
  shouldn't be specified.

  on dom0
  # opcontrol --start
  on dom1
  # opcontrol --start

  <make activity you want>

  on dom1
  # opcontrol --stop (or opcontrol --shutdown)
  on dom0
  # opcontrol --stop (or opcontrol --shutdown)

  on dom0
  # opreport -l or something to get the result of dom0
  on dom1
  # opreport -l or something to get the result of dom1


Result example
--------------
The app name of non-dom0 domain would be domain<N>-{xen, kernel, modules, app}
where N is the domain id.
You may want to create domain<N>-xen domain<N>-kernel to get the symbol names.

# opreport
CPU: Itanium 2, speed 1595 MHz (estimated)
Counted L2DTLB_MISSES events (L2DTLB Misses) with a unit mask of 0x00 (No unit mask) count 5000
L2DTLB_MISSES:...|
  samples|      %|
------------------
      242 40.2662 domain1-kernel
      176 29.2845 domain1-xen
      128 21.2978 domain1-apps
       55  9.1514 xen-syms

# opreport -l
CPU: Itanium 2, speed 1595 MHz (estimated)
Counted L2DTLB_MISSES events (L2DTLB Misses) with a unit mask of 0x00 (No unit mask) count 5000
warning: /boot/domain1-xen could not be found.
warning: /domain1-apps could not be found.
warning: /domain1-kernel could not be found.
samples  %        app name                 symbol name
242      40.2662  domain1-kernel           (no symbols)
176      29.2845  domain1-xen              (no symbols)
128      21.2978  domain1-apps             (no symbols)
16        2.6622  xen-syms                 context_switch
16        2.6622  xen-syms                 lookup_domain_mpa
7         1.1647  xen-syms                 vcpu_get_domain_bundle
3         0.4992  xen-syms                 do_dom0vp_op
3         0.4992  xen-syms                 lookup_noalloc_domain_pte
3         0.4992  xen-syms                 xencomm_get_page
2         0.3328  xen-syms                 __copy_user
2         0.3328  xen-syms                 vcpu_translate
1         0.1664  xen-syms                 ia64_frametable_probe
1         0.1664  xen-syms                 vcpu_wake
1         0.1664  xen-syms                 xencomm_ctxt_init


Limitations
-----------
- Don't create/destroy/save/restore/live migration during xenoprof session.
  Otherwise something would go wrong. (including xen VMM hang)
  This isn't ia64 specific.
  If you want to profile early boot phase, "xm create -p/unpause" is your
  friend.

- Currently only the generic PMC/PMD is supported.
  The CPU implementation specific PMC/PMD isn't supported.

- calling graph isn't supported yet.

- The active domain for HVM domain isn't supported
  Xen/IA64 VMM itself supports it, however the driver doesn't exist.
