18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci======================== 48c2ecf20Sopenharmony_ciVCPU Dispatch Statistics 58c2ecf20Sopenharmony_ci======================== 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciFor Shared Processor LPARs, the POWER Hypervisor maintains a relatively 88c2ecf20Sopenharmony_cistatic mapping of the LPAR processors (vcpus) to physical processor 98c2ecf20Sopenharmony_cichips (representing the "home" node) and tries to always dispatch vcpus 108c2ecf20Sopenharmony_cion their associated physical processor chip. However, under certain 118c2ecf20Sopenharmony_ciscenarios, vcpus may be dispatched on a different processor chip (away 128c2ecf20Sopenharmony_cifrom its home node). 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/proc/powerpc/vcpudispatch_stats can be used to obtain statistics 158c2ecf20Sopenharmony_cirelated to the vcpu dispatch behavior. Writing '1' to this file enables 168c2ecf20Sopenharmony_cicollecting the statistics, while writing '0' disables the statistics. 178c2ecf20Sopenharmony_ciBy default, the DTLB log for each vcpu is processed 50 times a second so 188c2ecf20Sopenharmony_cias not to miss any entries. This processing frequency can be changed 198c2ecf20Sopenharmony_cithrough /proc/powerpc/vcpudispatch_stats_freq. 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciThe statistics themselves are available by reading the procfs file 228c2ecf20Sopenharmony_ci/proc/powerpc/vcpudispatch_stats. Each line in the output corresponds to 238c2ecf20Sopenharmony_cia vcpu as represented by the first field, followed by 8 numbers. 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciThe first number corresponds to: 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci1. total vcpu dispatches since the beginning of statistics collection 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciThe next 4 numbers represent vcpu dispatch dispersions: 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci2. number of times this vcpu was dispatched on the same processor as last 328c2ecf20Sopenharmony_ci time 338c2ecf20Sopenharmony_ci3. number of times this vcpu was dispatched on a different processor core 348c2ecf20Sopenharmony_ci as last time, but within the same chip 358c2ecf20Sopenharmony_ci4. number of times this vcpu was dispatched on a different chip 368c2ecf20Sopenharmony_ci5. number of times this vcpu was dispatches on a different socket/drawer 378c2ecf20Sopenharmony_ci (next numa boundary) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciThe final 3 numbers represent statistics in relation to the home node of 408c2ecf20Sopenharmony_cithe vcpu: 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci6. number of times this vcpu was dispatched in its home node (chip) 438c2ecf20Sopenharmony_ci7. number of times this vcpu was dispatched in a different node 448c2ecf20Sopenharmony_ci8. number of times this vcpu was dispatched in a node further away (numa 458c2ecf20Sopenharmony_ci distance) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciAn example output:: 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci $ sudo cat /proc/powerpc/vcpudispatch_stats 508c2ecf20Sopenharmony_ci cpu0 6839 4126 2683 30 0 6821 18 0 518c2ecf20Sopenharmony_ci cpu1 2515 1274 1229 12 0 2509 6 0 528c2ecf20Sopenharmony_ci cpu2 2317 1198 1109 10 0 2312 5 0 538c2ecf20Sopenharmony_ci cpu3 2259 1165 1088 6 0 2256 3 0 548c2ecf20Sopenharmony_ci cpu4 2205 1143 1056 6 0 2202 3 0 558c2ecf20Sopenharmony_ci cpu5 2165 1121 1038 6 0 2162 3 0 568c2ecf20Sopenharmony_ci cpu6 2183 1127 1050 6 0 2180 3 0 578c2ecf20Sopenharmony_ci cpu7 2193 1133 1052 8 0 2187 6 0 588c2ecf20Sopenharmony_ci cpu8 2165 1115 1032 18 0 2156 9 0 598c2ecf20Sopenharmony_ci cpu9 2301 1252 1033 16 0 2293 8 0 608c2ecf20Sopenharmony_ci cpu10 2197 1138 1041 18 0 2187 10 0 618c2ecf20Sopenharmony_ci cpu11 2273 1185 1062 26 0 2260 13 0 628c2ecf20Sopenharmony_ci cpu12 2186 1125 1043 18 0 2177 9 0 638c2ecf20Sopenharmony_ci cpu13 2161 1115 1030 16 0 2153 8 0 648c2ecf20Sopenharmony_ci cpu14 2206 1153 1033 20 0 2196 10 0 658c2ecf20Sopenharmony_ci cpu15 2163 1115 1032 16 0 2155 8 0 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciIn the output above, for vcpu0, there have been 6839 dispatches since 688c2ecf20Sopenharmony_cistatistics were enabled. 4126 of those dispatches were on the same 698c2ecf20Sopenharmony_ciphysical cpu as the last time. 2683 were on a different core, but within 708c2ecf20Sopenharmony_cithe same chip, while 30 dispatches were on a different chip compared to 718c2ecf20Sopenharmony_ciits last dispatch. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciAlso, out of the total of 6839 dispatches, we see that there have been 748c2ecf20Sopenharmony_ci6821 dispatches on the vcpu's home node, while 18 dispatches were 758c2ecf20Sopenharmony_cioutside its home node, on a neighbouring chip. 76