xref: /openbmc/linux/Documentation/powerpc/vcpudispatch_stats.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*599448d8SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2*599448d8SMauro Carvalho Chehab
3*599448d8SMauro Carvalho Chehab========================
4*599448d8SMauro Carvalho ChehabVCPU Dispatch Statistics
5*599448d8SMauro Carvalho Chehab========================
6*599448d8SMauro Carvalho Chehab
7*599448d8SMauro Carvalho ChehabFor Shared Processor LPARs, the POWER Hypervisor maintains a relatively
8*599448d8SMauro Carvalho Chehabstatic mapping of the LPAR processors (vcpus) to physical processor
9*599448d8SMauro Carvalho Chehabchips (representing the "home" node) and tries to always dispatch vcpus
10*599448d8SMauro Carvalho Chehabon their associated physical processor chip. However, under certain
11*599448d8SMauro Carvalho Chehabscenarios, vcpus may be dispatched on a different processor chip (away
12*599448d8SMauro Carvalho Chehabfrom its home node).
13*599448d8SMauro Carvalho Chehab
14*599448d8SMauro Carvalho Chehab/proc/powerpc/vcpudispatch_stats can be used to obtain statistics
15*599448d8SMauro Carvalho Chehabrelated to the vcpu dispatch behavior. Writing '1' to this file enables
16*599448d8SMauro Carvalho Chehabcollecting the statistics, while writing '0' disables the statistics.
17*599448d8SMauro Carvalho ChehabBy default, the DTLB log for each vcpu is processed 50 times a second so
18*599448d8SMauro Carvalho Chehabas not to miss any entries. This processing frequency can be changed
19*599448d8SMauro Carvalho Chehabthrough /proc/powerpc/vcpudispatch_stats_freq.
20*599448d8SMauro Carvalho Chehab
21*599448d8SMauro Carvalho ChehabThe statistics themselves are available by reading the procfs file
22*599448d8SMauro Carvalho Chehab/proc/powerpc/vcpudispatch_stats. Each line in the output corresponds to
23*599448d8SMauro Carvalho Chehaba vcpu as represented by the first field, followed by 8 numbers.
24*599448d8SMauro Carvalho Chehab
25*599448d8SMauro Carvalho ChehabThe first number corresponds to:
26*599448d8SMauro Carvalho Chehab
27*599448d8SMauro Carvalho Chehab1. total vcpu dispatches since the beginning of statistics collection
28*599448d8SMauro Carvalho Chehab
29*599448d8SMauro Carvalho ChehabThe next 4 numbers represent vcpu dispatch dispersions:
30*599448d8SMauro Carvalho Chehab
31*599448d8SMauro Carvalho Chehab2. number of times this vcpu was dispatched on the same processor as last
32*599448d8SMauro Carvalho Chehab   time
33*599448d8SMauro Carvalho Chehab3. number of times this vcpu was dispatched on a different processor core
34*599448d8SMauro Carvalho Chehab   as last time, but within the same chip
35*599448d8SMauro Carvalho Chehab4. number of times this vcpu was dispatched on a different chip
36*599448d8SMauro Carvalho Chehab5. number of times this vcpu was dispatches on a different socket/drawer
37*599448d8SMauro Carvalho Chehab   (next numa boundary)
38*599448d8SMauro Carvalho Chehab
39*599448d8SMauro Carvalho ChehabThe final 3 numbers represent statistics in relation to the home node of
40*599448d8SMauro Carvalho Chehabthe vcpu:
41*599448d8SMauro Carvalho Chehab
42*599448d8SMauro Carvalho Chehab6. number of times this vcpu was dispatched in its home node (chip)
43*599448d8SMauro Carvalho Chehab7. number of times this vcpu was dispatched in a different node
44*599448d8SMauro Carvalho Chehab8. number of times this vcpu was dispatched in a node further away (numa
45*599448d8SMauro Carvalho Chehab   distance)
46*599448d8SMauro Carvalho Chehab
47*599448d8SMauro Carvalho ChehabAn example output::
48*599448d8SMauro Carvalho Chehab
49*599448d8SMauro Carvalho Chehab    $ sudo cat /proc/powerpc/vcpudispatch_stats
50*599448d8SMauro Carvalho Chehab    cpu0 6839 4126 2683 30 0 6821 18 0
51*599448d8SMauro Carvalho Chehab    cpu1 2515 1274 1229 12 0 2509 6 0
52*599448d8SMauro Carvalho Chehab    cpu2 2317 1198 1109 10 0 2312 5 0
53*599448d8SMauro Carvalho Chehab    cpu3 2259 1165 1088 6 0 2256 3 0
54*599448d8SMauro Carvalho Chehab    cpu4 2205 1143 1056 6 0 2202 3 0
55*599448d8SMauro Carvalho Chehab    cpu5 2165 1121 1038 6 0 2162 3 0
56*599448d8SMauro Carvalho Chehab    cpu6 2183 1127 1050 6 0 2180 3 0
57*599448d8SMauro Carvalho Chehab    cpu7 2193 1133 1052 8 0 2187 6 0
58*599448d8SMauro Carvalho Chehab    cpu8 2165 1115 1032 18 0 2156 9 0
59*599448d8SMauro Carvalho Chehab    cpu9 2301 1252 1033 16 0 2293 8 0
60*599448d8SMauro Carvalho Chehab    cpu10 2197 1138 1041 18 0 2187 10 0
61*599448d8SMauro Carvalho Chehab    cpu11 2273 1185 1062 26 0 2260 13 0
62*599448d8SMauro Carvalho Chehab    cpu12 2186 1125 1043 18 0 2177 9 0
63*599448d8SMauro Carvalho Chehab    cpu13 2161 1115 1030 16 0 2153 8 0
64*599448d8SMauro Carvalho Chehab    cpu14 2206 1153 1033 20 0 2196 10 0
65*599448d8SMauro Carvalho Chehab    cpu15 2163 1115 1032 16 0 2155 8 0
66*599448d8SMauro Carvalho Chehab
67*599448d8SMauro Carvalho ChehabIn the output above, for vcpu0, there have been 6839 dispatches since
68*599448d8SMauro Carvalho Chehabstatistics were enabled. 4126 of those dispatches were on the same
69*599448d8SMauro Carvalho Chehabphysical cpu as the last time. 2683 were on a different core, but within
70*599448d8SMauro Carvalho Chehabthe same chip, while 30 dispatches were on a different chip compared to
71*599448d8SMauro Carvalho Chehabits last dispatch.
72*599448d8SMauro Carvalho Chehab
73*599448d8SMauro Carvalho ChehabAlso, out of the total of 6839 dispatches, we see that there have been
74*599448d8SMauro Carvalho Chehab6821 dispatches on the vcpu's home node, while 18 dispatches were
75*599448d8SMauro Carvalho Chehaboutside its home node, on a neighbouring chip.
76