[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 0/2] Restricted VPMU filter flags



This patch series fixes a minor bug with cpuid register usage for fixed PMC
counts, and implements two VPMU filter flags.

The VPMU feature of Xen is incredibly useful for performance analysis, however,
it is currently all counters or nothing. In secure environments, there can be
hesitation to enable access to all PMCs. This series introduces two new flags
(in addition to the existing "bts"):

vpmu=ipc: As the most restricted minimum set. This enables cycles, reference
cycles, and instructions only. This is enough to calculate instructions per
cycle (IPC).

vpm=arch: This enables the 7 pre-defined architectural events as listed in
cpuid, and in Table 18-1 of the Intel software developer's manual, vol 3B.

There can be additional flags added later on, to allow access to other groups
of PMCs.

As an example of these flags, here is Linux perf running in a PVHVM guest with
the new vpmu=ipc mode:

root@vm0hvm:~# perf stat -d ./noploop

 Performance counter stats for './noploop':

       1511.326375 task-clock (msec)         #    0.999 CPUs utilized          
                24 context-switches          #    0.016 K/sec                  
                 0 cpu-migrations            #    0.000 K/sec                  
               113 page-faults               #    0.075 K/sec                  
     5,028,638,883 cycles                    #    3.327 GHz                    
                 0 stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0 stalled-cycles-backend    #    0.00% backend  cycles idle   
    20,043,427,933 instructions              #    3.99  insns per cycle        
                 0 branches                  #    0.000 K/sec                  
                 0 branch-misses             #    0.00% of all branches        
                 0 L1-dcache-loads           #    0.000 K/sec                  
                 0 L1-dcache-load-misses     #    0.00% of all L1-dcache hits  
                 0 LLC-loads                 #    0.000 K/sec                  
   <not supported> LLC-load-misses:HG    

Note that IPC is shown ("insns per cycle"), but other counters are not.

Changes in v2:
* feature flags can now be combined (eg, "vpmu=ipc,bts")
* addressing review comments from Boris:
* restrict DS_AREA and PEBS_ENABLE access when filters are in use
* better variable types
* include MSR_IA32_CMT_EVTSEL_UE_MASK flag

Brendan Gregg (2):
  x86/VPMU: return correct fixed PMC count
  x86/VPMU: implement ipc and arch filter flags

 docs/misc/xen-command-line.markdown | 14 +++++++++-
 xen/arch/x86/cpu/vpmu.c             | 51 ++++++++++++++++++++++++++++-------
 xen/arch/x86/cpu/vpmu_intel.c       | 54 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr-index.h     |  1 +
 xen/include/public/pmu.h            | 14 ++++++++--
 5 files changed, 118 insertions(+), 16 deletions(-)

-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.