Re: [PATCH 2/2] KVM: PPC: Book3S HV: Add a per vcpu cache for recently page faulted MMIO entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2016/11/3 8:38, Paul Mackerras wrote:

On Wed, Nov 02, 2016 at 09:13:39PM +0800, Yongji Xie wrote:
This keeps a per vcpu cache for recently page faulted MMIO entries.
On a page fault, if the entry exists in the cache, we can avoid
locking the HPTE in real mode and virtual mode, then directly
call kvmppc_hv_emulate_mmio().

In current implenment, we limit the size of cache to four. We think
it's enough to cover the high-frequency MMIO HPTEs in most case.
For example, considering the case of using virtio device, for virtio
legacy devices, one HPTE could handle notifications from up to
1024 (64K page / 64 byte Port IO register) devices, so one cache entry
is enough; for virtio modern devices, we always need one HPTE to handle
notification for each device because modern device would use a 8M MMIO
register to notify host instead of Port IO register, typically the
system's configuration should not exceed four virtio devices per
vcpu, four cache entry is also enough in this case. Of course, if needed,
we could also modify the macro to a module parameter in the future.
Thanks, the patch looks nice.  I did notice one thing though, see below.

Do you have any performance results with and without the patch, to
show the improvement it gives?  Something like the throughput for a
1-byte ping-pong message test over virtio-net with vhost, perhaps?
Hi Paul,

Here is the performance result (About 1% ~ 2% improvement):

fio(iops)
===========================

    Before    After
1st 32095    32616
2nd 32032    32635
3rd 32057    32638
4th 32005    32598
5th 32069    32628

netperf(TCP_RR, Trans.Rate per sec)
===========================

    Before    After
1st 30734.66    31328.63
2nd 30749.26    31337.77
3rd 30825.99    31278.19
4th 30708.94    31350.81
5th 30832.35    31484.80

I will add this in cover-letter in next version.

diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 61ff8ee..1f048e7 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -389,6 +389,11 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
  #define LOCK_TOKEN	(*(u32 *)(&get_paca()->paca_index))
  #endif
+static inline int is_mmio_hpte(unsigned long v, unsigned long r)
+{
+	return ((v & HPTE_V_ABSENT) && (r & (HPTE_R_KEY_HI | HPTE_R_KEY_LO)));
Shouldn't this be testing (r & (HPTE_R_KEY_HI | HPTE_R_KEY_LO)) ==
(HPTE_R_KEY_HI | HPTE_R_KEY_LO), rather than just a non-zero key field?

Oh, yes. I will fix it.

Thanks,
Yongji

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux