diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-16 16:00:24 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-16 16:00:24 -0500 |
| commit | 974aa5630b318938273d7efe7a2cf031c7b927db (patch) | |
| tree | b79803c07b9c16d87058ce69f80ebe173cdfd838 /tools/kvm | |
| parent | 441692aafc1731087bbaf657a8b6059d95c2a6df (diff) | |
| parent | a6014f1ab7088dc02b58991cfb6b32a34afdbf12 (diff) | |
Merge tag 'kvm-4.15-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM updates from Radim Krčmář:
"First batch of KVM changes for 4.15
Common:
- Python 3 support in kvm_stat
- Accounting of slabs to kmemcg
ARM:
- Optimized arch timer handling for KVM/ARM
- Improvements to the VGIC ITS code and introduction of an ITS reset
ioctl
- Unification of the 32-bit fault injection logic
- More exact external abort matching logic
PPC:
- Support for running hashed page table (HPT) MMU mode on a host that
is using the radix MMU mode; single threaded mode on POWER 9 is
added as a pre-requisite
- Resolution of merge conflicts with the last second 4.14 HPT fixes
- Fixes and cleanups
s390:
- Some initial preparation patches for exitless interrupts and crypto
- New capability for AIS migration
- Fixes
x86:
- Improved emulation of LAPIC timer mode changes, MCi_STATUS MSRs,
and after-reset state
- Refined dependencies for VMX features
- Fixes for nested SMI injection
- A lot of cleanups"
* tag 'kvm-4.15-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (89 commits)
KVM: s390: provide a capability for AIS state migration
KVM: s390: clear_io_irq() requests are not expected for adapter interrupts
KVM: s390: abstract conversion between isc and enum irq_types
KVM: s390: vsie: use common code functions for pinning
KVM: s390: SIE considerations for AP Queue virtualization
KVM: s390: document memory ordering for kvm_s390_vcpu_wakeup
KVM: PPC: Book3S HV: Cosmetic post-merge cleanups
KVM: arm/arm64: fix the incompatible matching for external abort
KVM: arm/arm64: Unify 32bit fault injection
KVM: arm/arm64: vgic-its: Implement KVM_DEV_ARM_ITS_CTRL_RESET
KVM: arm/arm64: Document KVM_DEV_ARM_ITS_CTRL_RESET
KVM: arm/arm64: vgic-its: Free caches when GITS_BASER Valid bit is cleared
KVM: arm/arm64: vgic-its: New helper functions to free the caches
KVM: arm/arm64: vgic-its: Remove kvm_its_unmap_device
arm/arm64: KVM: Load the timer state when enabling the timer
KVM: arm/arm64: Rework kvm_timer_should_fire
KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate
KVM: arm/arm64: Avoid phys timer emulation in vcpu entry/exit
KVM: arm/arm64: Move phys_timer_emulate function
KVM: arm/arm64: Use kvm_arm_timer_set/get_reg for guest register traps
...
Diffstat (limited to 'tools/kvm')
| -rwxr-xr-x | tools/kvm/kvm_stat/kvm_stat | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index 32283d88701a..217cf6f95c36 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat | |||
| @@ -19,9 +19,11 @@ Three different ways of output formatting are available: | |||
| 19 | 19 | ||
| 20 | The data is sampled from the KVM's debugfs entries and its perf events. | 20 | The data is sampled from the KVM's debugfs entries and its perf events. |
| 21 | """ | 21 | """ |
| 22 | from __future__ import print_function | ||
| 22 | 23 | ||
| 23 | import curses | 24 | import curses |
| 24 | import sys | 25 | import sys |
| 26 | import locale | ||
| 25 | import os | 27 | import os |
| 26 | import time | 28 | import time |
| 27 | import optparse | 29 | import optparse |
| @@ -225,6 +227,8 @@ IOCTL_NUMBERS = { | |||
| 225 | 'RESET': 0x00002403, | 227 | 'RESET': 0x00002403, |
| 226 | } | 228 | } |
| 227 | 229 | ||
| 230 | ENCODING = locale.getpreferredencoding(False) | ||
| 231 | |||
| 228 | 232 | ||
| 229 | class Arch(object): | 233 | class Arch(object): |
| 230 | """Encapsulates global architecture specific data. | 234 | """Encapsulates global architecture specific data. |
| @@ -666,7 +670,7 @@ class TracepointProvider(Provider): | |||
| 666 | """Returns 'event name: current value' for all enabled events.""" | 670 | """Returns 'event name: current value' for all enabled events.""" |
| 667 | ret = defaultdict(int) | 671 | ret = defaultdict(int) |
| 668 | for group in self.group_leaders: | 672 | for group in self.group_leaders: |
| 669 | for name, val in group.read().iteritems(): | 673 | for name, val in group.read().items(): |
| 670 | if name in self._fields: | 674 | if name in self._fields: |
| 671 | ret[name] += val | 675 | ret[name] += val |
| 672 | return ret | 676 | return ret |
| @@ -955,7 +959,7 @@ class Tui(object): | |||
| 955 | except: | 959 | except: |
| 956 | raise Exception | 960 | raise Exception |
| 957 | for line in child.stdout: | 961 | for line in child.stdout: |
| 958 | line = line.lstrip().split(' ', 1) | 962 | line = line.decode(ENCODING).lstrip().split(' ', 1) |
| 959 | # perform a sanity check before calling the more expensive | 963 | # perform a sanity check before calling the more expensive |
| 960 | # function to possibly extract the guest name | 964 | # function to possibly extract the guest name |
| 961 | if ' -name ' in line[1]: | 965 | if ' -name ' in line[1]: |
| @@ -1005,7 +1009,7 @@ class Tui(object): | |||
| 1005 | name = '' | 1009 | name = '' |
| 1006 | try: | 1010 | try: |
| 1007 | line = open('/proc/{}/cmdline' | 1011 | line = open('/proc/{}/cmdline' |
| 1008 | .format(pid), 'rb').read().split('\0') | 1012 | .format(pid), 'r').read().split('\0') |
| 1009 | parms = line[line.index('-name') + 1].split(',') | 1013 | parms = line[line.index('-name') + 1].split(',') |
| 1010 | while '' in parms: | 1014 | while '' in parms: |
| 1011 | # commas are escaped (i.e. ',,'), hence e.g. 'foo,bar' results | 1015 | # commas are escaped (i.e. ',,'), hence e.g. 'foo,bar' results |
| @@ -1170,7 +1174,7 @@ class Tui(object): | |||
| 1170 | .format(self.stats.fields_filter)) | 1174 | .format(self.stats.fields_filter)) |
| 1171 | self.screen.addstr(3, 0, "New regex: ") | 1175 | self.screen.addstr(3, 0, "New regex: ") |
| 1172 | curses.echo() | 1176 | curses.echo() |
| 1173 | regex = self.screen.getstr() | 1177 | regex = self.screen.getstr().decode(ENCODING) |
| 1174 | curses.noecho() | 1178 | curses.noecho() |
| 1175 | if len(regex) == 0: | 1179 | if len(regex) == 0: |
| 1176 | self.stats.fields_filter = DEFAULT_REGEX | 1180 | self.stats.fields_filter = DEFAULT_REGEX |
| @@ -1204,7 +1208,7 @@ class Tui(object): | |||
| 1204 | 1208 | ||
| 1205 | curses.echo() | 1209 | curses.echo() |
| 1206 | self.screen.addstr(3, 0, "Pid [0 or pid]: ") | 1210 | self.screen.addstr(3, 0, "Pid [0 or pid]: ") |
| 1207 | pid = self.screen.getstr() | 1211 | pid = self.screen.getstr().decode(ENCODING) |
| 1208 | curses.noecho() | 1212 | curses.noecho() |
| 1209 | 1213 | ||
| 1210 | try: | 1214 | try: |
| @@ -1233,7 +1237,7 @@ class Tui(object): | |||
| 1233 | self.screen.addstr(2, 0, 'Change delay from %.1fs to ' % | 1237 | self.screen.addstr(2, 0, 'Change delay from %.1fs to ' % |
| 1234 | self._delay_regular) | 1238 | self._delay_regular) |
| 1235 | curses.echo() | 1239 | curses.echo() |
| 1236 | val = self.screen.getstr() | 1240 | val = self.screen.getstr().decode(ENCODING) |
| 1237 | curses.noecho() | 1241 | curses.noecho() |
| 1238 | 1242 | ||
| 1239 | try: | 1243 | try: |
| @@ -1273,7 +1277,7 @@ class Tui(object): | |||
| 1273 | self.print_all_gnames(7) | 1277 | self.print_all_gnames(7) |
| 1274 | curses.echo() | 1278 | curses.echo() |
| 1275 | self.screen.addstr(3, 0, "Guest [ENTER or guest]: ") | 1279 | self.screen.addstr(3, 0, "Guest [ENTER or guest]: ") |
| 1276 | gname = self.screen.getstr() | 1280 | gname = self.screen.getstr().decode(ENCODING) |
| 1277 | curses.noecho() | 1281 | curses.noecho() |
| 1278 | 1282 | ||
| 1279 | if not gname: | 1283 | if not gname: |
| @@ -1369,25 +1373,25 @@ def batch(stats): | |||
| 1369 | s = stats.get() | 1373 | s = stats.get() |
| 1370 | for key in sorted(s.keys()): | 1374 | for key in sorted(s.keys()): |
| 1371 | values = s[key] | 1375 | values = s[key] |
| 1372 | print '%-42s%10d%10d' % (key, values[0], values[1]) | 1376 | print('%-42s%10d%10d' % (key, values[0], values[1])) |
| 1373 | except KeyboardInterrupt: | 1377 | except KeyboardInterrupt: |
| 1374 | pass | 1378 | pass |
| 1375 | 1379 | ||
| 1376 | 1380 | ||
| 1377 | def log(stats): | 1381 | def log(stats): |
| 1378 | """Prints statistics as reiterating key block, multiple value blocks.""" | 1382 | """Prints statistics as reiterating key block, multiple value blocks.""" |
| 1379 | keys = sorted(stats.get().iterkeys()) | 1383 | keys = sorted(stats.get().keys()) |
| 1380 | 1384 | ||
| 1381 | def banner(): | 1385 | def banner(): |
| 1382 | for k in keys: | 1386 | for k in keys: |
| 1383 | print '%s' % k, | 1387 | print(k, end=' ') |
| 1384 | 1388 | print() | |
| 1385 | 1389 | ||
| 1386 | def statline(): | 1390 | def statline(): |
| 1387 | s = stats.get() | 1391 | s = stats.get() |
| 1388 | for k in keys: | 1392 | for k in keys: |
| 1389 | print ' %9d' % s[k][1], | 1393 | print(' %9d' % s[k][1], end=' ') |
| 1390 | 1394 | print() | |
| 1391 | line = 0 | 1395 | line = 0 |
| 1392 | banner_repeat = 20 | 1396 | banner_repeat = 20 |
| 1393 | while True: | 1397 | while True: |
