All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Restricted VPMU filter flags
@ 2015-11-24 23:53 Brendan Gregg
  2015-11-24 23:53 ` [PATCH v2 1/2] x86/VPMU: return correct fixed PMC count Brendan Gregg
  2015-11-24 23:53 ` [PATCH v2 2/2] x86/VPMU: implement ipc and arch filter flags Brendan Gregg
  0 siblings, 2 replies; 13+ messages in thread
From: Brendan Gregg @ 2015-11-24 23:53 UTC (permalink / raw)
  To: xen-devel; +Cc: boris.ostrovsky, Brendan Gregg, dietmar.hahn

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-12-01  0:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24 23:53 [PATCH v2 0/2] Restricted VPMU filter flags Brendan Gregg
2015-11-24 23:53 ` [PATCH v2 1/2] x86/VPMU: return correct fixed PMC count Brendan Gregg
2015-11-25  9:13   ` Dietmar Hahn
2015-11-25  9:55   ` Jan Beulich
2015-11-25 14:26     ` Boris Ostrovsky
2015-11-25 15:31       ` Jan Beulich
2015-11-25 19:32         ` Boris Ostrovsky
2015-11-26  7:44           ` Jan Beulich
2015-11-24 23:53 ` [PATCH v2 2/2] x86/VPMU: implement ipc and arch filter flags Brendan Gregg
2015-11-25 15:13   ` Boris Ostrovsky
2015-11-25 23:35     ` Brendan Gregg
2015-11-26  8:11   ` Dietmar Hahn
2015-12-01  0:32     ` Brendan Gregg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.