[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7004ff96-91a8-83f8-8d2d-2bfb1c6ba418@redhat.com>
Date: Mon, 14 Aug 2017 09:12:16 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peng Hao <peng.hao2@....com.cn>, rkrcmar@...hat.com, corbet@....net
Cc: kvm@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH V2] kvm: x86: reduce rtc 0x70 access vm-exit time
On 13/08/2017 21:51, Peng Hao wrote:
> 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 mmio to
> handle this scene to reduce VM-EXIT time.
> without my patch, get the vm-exit time of accessing rtc 0x70 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%)
>
> 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%)
>
> the patch is a part of optimizing rtc 0x70 port access. Another is in
> qemu.
>
> Signed-off-by: Peng Hao <peng.hao2@....com.cn>
Very nice, thanks.
The new documentation file can be used later as a base for documentation
of coalesced MMIO ioctls. Here is an edited version:
----
Coalesced MMIO and coalesced PIO can be used to optimize writes to
simple device registers. Writes to a coalesced-I/O region are not
reported to userspace until the next non-coalesced I/O is issued, in a
similar fashion to write combining hardware. In KVM, coalesced writes
are handled in the kernel without exits to userspace, and are thus
several times faster.
Examples of devices that can benefit from coalesced I/O include:
- devices whose memory is accessed with many consecutive writes, for
example the EGA/VGA video RAM.
- windowed I/O, such as the real-time clock. The address register (port
0x70 in the RTC case) can use coalesced I/O, cutting the number of
userspace exits by half when reading or writing the RTC.
----
Paolo
Powered by blists - more mailing lists