mbox series

[V5,0/3] introduce coalesced pio support

Message ID 1539472197-111085-1-git-send-email-peng.hao2@zte.com.cn (mailing list archive)
Headers show
Series introduce coalesced pio support | expand

Message

Peng Hao Oct. 13, 2018, 11:09 p.m. UTC
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 (3):
  kvm/x86 : add coalesced pio support
  kvm/x86 : add document for coalesced mmio
  kvm/x86 : add document for coalesced pio

 Documentation/virtual/kvm/api.txt             | 28 +++++++++++++++++++++++++++
 include/uapi/linux/kvm.h                      | 11 +++++++++--
 virt/kvm/coalesced_mmio.c                     | 12 +++++++++---
 virt/kvm/kvm_main.c                           |  2 ++
 4 files changed, 48 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini Oct. 15, 2018, 5:22 p.m. UTC | #1
On 14/10/2018 01:09, Peng Hao wrote:
> 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 (3):
>   kvm/x86 : add coalesced pio support
>   kvm/x86 : add document for coalesced mmio
>   kvm/x86 : add document for coalesced pio
> 
>  Documentation/virtual/kvm/api.txt             | 28 +++++++++++++++++++++++++++
>  include/uapi/linux/kvm.h                      | 11 +++++++++--
>  virt/kvm/coalesced_mmio.c                     | 12 +++++++++---
>  virt/kvm/kvm_main.c                           |  2 ++
>  4 files changed, 48 insertions(+), 5 deletions(-)
> 

Queued, thanks (squashing 1 and 3 together).

Paolo
Stefan Hajnoczi Oct. 17, 2018, 10:08 a.m. UTC | #2
On Sun, Oct 14, 2018 at 07:09:54AM +0800, Peng Hao wrote:
> 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 (3):
>   kvm/x86 : add coalesced pio support
>   kvm/x86 : add document for coalesced mmio
>   kvm/x86 : add document for coalesced pio
> 
>  Documentation/virtual/kvm/api.txt             | 28 +++++++++++++++++++++++++++
>  include/uapi/linux/kvm.h                      | 11 +++++++++--
>  virt/kvm/coalesced_mmio.c                     | 12 +++++++++---
>  virt/kvm/kvm_main.c                           |  2 ++
>  4 files changed, 48 insertions(+), 5 deletions(-)

Nice, thanks for documenting the API!