From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peng Hao Subject: [PATCH V4 0/4] introduce coalesced pio support Date: Sat, 25 Aug 2018 20:19:46 +0800 Message-ID: <1535199590-68475-1-git-send-email-peng.hao2@zte.com.cn> Cc: Peng Hao , zhong.weidong@zte.com.cn, qemu-devel@nongnu.org, kvm@vger.kernel.org To: pbonzini@redhat.com, mst@redhat.com, ehabkost@redhat.com, rkrcmar@redhat.com Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org Coalesced pio is base on coalesced mmio and can be used for some port like rtc port, pci-host config port, virtio-pci 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 it starts and closes the virtual machine, it will access pci-host config port or virtio-pci config port frequently. So setting these port as coalesced pio can reduce startup and shutdown time. In qemu I just realize piixfx's pci-host, it is convenient for other pci-host type implementations. 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%) These are just qemu's patches, another patches are for kernel. I think there is a need for further consideration in changing coalesecd_mmio's naming in kernel and qemu together.So maybe another patch does it. Peng Hao (4): target-i386: introduce coalesced_pio kvm header update target-i386:add coalesced_pio API target-i386: add rtc 0x70 port as coalesced_pio target-i386: add i440fx 0xcf8 port as coalesced_pio accel/kvm/kvm-all.c | 61 ++++++++++++++++++++++++++++++++++++++++++----- hw/pci-host/piix.c | 4 ++++ hw/timer/mc146818rtc.c | 8 +++++++ include/exec/memory.h | 4 ++-- linux-headers/linux/kvm.h | 5 ++-- memory.c | 4 ++-- 6 files changed, 74 insertions(+), 12 deletions(-) -- 1.8.3.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftPpi-00016l-JG for qemu-devel@nongnu.org; Sat, 25 Aug 2018 00:05:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ftPpf-0007nW-9p for qemu-devel@nongnu.org; Sat, 25 Aug 2018 00:05:54 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:38188 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ftPpe-0007l1-T2 for qemu-devel@nongnu.org; Sat, 25 Aug 2018 00:05:51 -0400 From: Peng Hao Date: Sat, 25 Aug 2018 20:19:46 +0800 Message-Id: <1535199590-68475-1-git-send-email-peng.hao2@zte.com.cn> Subject: [Qemu-devel] [PATCH V4 0/4] introduce coalesced pio support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com, mst@redhat.com, ehabkost@redhat.com, rkrcmar@redhat.com Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, zhong.weidong@zte.com.cn, Peng Hao Coalesced pio is base on coalesced mmio and can be used for some port like rtc port, pci-host config port, virtio-pci 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 it starts and closes the virtual machine, it will access pci-host config port or virtio-pci config port frequently. So setting these port as coalesced pio can reduce startup and shutdown time. In qemu I just realize piixfx's pci-host, it is convenient for other pci-host type implementations. 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%) These are just qemu's patches, another patches are for kernel. I think there is a need for further consideration in changing coalesecd_mmio's naming in kernel and qemu together.So maybe another patch does it. Peng Hao (4): target-i386: introduce coalesced_pio kvm header update target-i386:add coalesced_pio API target-i386: add rtc 0x70 port as coalesced_pio target-i386: add i440fx 0xcf8 port as coalesced_pio accel/kvm/kvm-all.c | 61 ++++++++++++++++++++++++++++++++++++++++++----- hw/pci-host/piix.c | 4 ++++ hw/timer/mc146818rtc.c | 8 +++++++ include/exec/memory.h | 4 ++-- linux-headers/linux/kvm.h | 5 ++-- memory.c | 4 ++-- 6 files changed, 74 insertions(+), 12 deletions(-) -- 1.8.3.1