History

kvm/x86 : add coalesced pio support

Coalesced pio is based on coalesced mmio and can be used for some port like rtc port, pci-host config port and so on. Specially in case of rtc as coalesced pio, some versions of windows guest access rtc frequently because of rtc as system tick. guest access rtc like this: write register index to 0x70, then write or read data from 0x71. writing 0x70 port is just as index and do nothing else. So we can use coalesced pio to handle this scene to reduce VM-EXIT time. When starting and closing a virtual machine, it will access pci-host config port frequently. So setting these port as coalesced pio can reduce startup and shutdown time. without my patch, get the vm-exit time of accessing rtc 0x70 and piix 0xcf8 using perf tools: (guest OS : windows 7 64bit) IO Port Access Samples Samples% Time% Min Time Max Time Avg time 0x70:POUT 86 30.99% 74.59% 9us 29us 10.75us (+- 3.41%) 0xcf8:POUT 1119 2.60% 2.12% 2.79us 56.83us 3.41us (+- 2.23%) with my patch IO Port Access Samples Samples% Time% Min Time Max Time Avg time 0x70:POUT 106 32.02% 29.47% 0us 10us 1.57us (+- 7.38%) 0xcf8:POUT 1065 1.67% 0.28% 0.41us 65.44us 0.66us (+- 10.55%)

Peng Hao committed 8 years ago

Commit 0804c841 parent 99434504 files · +30 −11Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/kvm.h+9−2
@@ -420,13 +420,19 @@ struct kvm_run { · 419 unmodified lines
420struct kvm_coalesced_mmio_zone {420struct kvm_coalesced_mmio_zone {
421 __u64 addr;421 __u64 addr;
422 __u32 size;422 __u32 size;
423 __u32 pad;423 union {
424 __u32 pad;
425 __u32 pio;
426 };
424};427};
425 428
426struct kvm_coalesced_mmio {429struct kvm_coalesced_mmio {
427 __u64 phys_addr;430 __u64 phys_addr;
428 __u32 len;431 __u32 len;
429 __u32 pad;432 union {
433 __u32 pad;
434 __u32 pio;
435 };
430 __u8 data[8];436 __u8 data[8];
431};437};
432 438
@@ -956,6 +962,7 @@ struct kvm_ppc_resize_hpt { · 523 unmodified lines
956#define KVM_CAP_MSR_PLATFORM_INFO 159962#define KVM_CAP_MSR_PLATFORM_INFO 159
957#define KVM_CAP_PPC_NESTED_HV 160963#define KVM_CAP_PPC_NESTED_HV 160
958#define KVM_CAP_HYPERV_SEND_IPI 161964#define KVM_CAP_HYPERV_SEND_IPI 161
965#define KVM_CAP_COALESCED_PIO 162
959 966
960#ifdef KVM_CAP_IRQ_ROUTING967#ifdef KVM_CAP_IRQ_ROUTING
961 968