From: Greg Subject: Re: Question about KVM virtio network latency improvement Date: Sat, 15 Oct 2016 22:20:06 +0200 Message-ID: References: <5bf114ba3c056c710a3f05e67acfee30@reolight.net> <967a9b2a-a36b-f151-72e1-12420c2810e4@gmail.com> <47236c6a0e121e5226bf73f9914aed5f@reolight.net> <7e391fc4-3ec8-29aa-d0f0-e8c3c3041732@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable To: kvm@vger.kernel.org Return-path: Received: from cerebellum.reolight.net ([62.210.116.147]:52554 "EHLO mail.reolight.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753442AbcJOUUG (ORCPT ); Sat, 15 Oct 2016 16:20:06 -0400 Received: from localhost ([127.0.0.1] helo=mail.reolight.net) by mail.reolight.net with esmtp (Exim 4.87) (envelope-from ) id 1bvVR8-0008BK-4s for kvm@vger.kernel.org; Sat, 15 Oct 2016 22:20:06 +0200 In-Reply-To: <7e391fc4-3ec8-29aa-d0f0-e8c3c3041732@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Le 2016-10-13 09:00, Paolo Bonzini a =C3=A9crit : > On 12/10/2016 17:27, Greg wrote: >=20 >> Yes, you're partially right. >> I've done some tests on how reduce interrupt latency. Using idle=3Dpoll= =20 >> or >> use stress tests in guest permit to reduce half the latency (but is a >> real hog on host :/). >> Using "intel_idle.max_cstate=3D0 processor.max_cstate=3D0 idle=3Dpoll" o= n=20 >> host >> permits to get the same result (without cpu hog) >>=20 >> In conclusion, I get with theses results : ~120=C2=B5s between guest (fr= om >> 180=C2=B5s previously). >>=20 >> Running iperf with these new modifications still get better results=20 >> with >> ~60=C2=B5s (a third from the initial value, half from idle=3Dpoll value)= =2E >>=20 >> Is there something else I can eventually tune ? >=20 > With a real workload, you might be able to get the same performance as > idle=3Dpoll thanks to KVM's automatic polling for interrupts. As long as > packets are delivered within 400 microseconds, and only if there is no > other active process on the host's CPU, KVM will poll for guest > interrupts instead of putting the guest's CPU to sleep. >=20 > This of course doesn't trigger for ping, which only wakes up the guest > once per second. >=20 > Paolo I agree with this, but don't seems to be reality : polling in enable on=20 host and guest : On host : root@srv-kvm1:~# dmesg |grep "process: using polling idle" [ 0.000000] process: using polling idle threads On both guest : root@Test1:~# dmesg |grep "process: using polling idle" [ 0.000000] process: using polling idle threads root@Test2:~# dmesg |grep "process: using polling idle" [ 0.000000] process: using polling idle threads Ping from Test1 to Test2 : --- 192.168.0.22 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 8997ms rtt min/avg/max/mdev =3D 0.117/0.133/0.144/0.010 ms Ping from Test1 to Test2 with (iperf from Test2 to Test1 : iperf -c=20 192.168.0.21 -b 100M -t 60) : --- 192.168.0.22 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 8998ms rtt min/avg/max/mdev =3D 0.057/0.062/0.082/0.009 ms Ping is almost twice as fast with an iperf running ! With iperf at 50kb/s : no change on ping, still ~130=C2=B5s Iperf at 100kb/s : the ping will vary with better and worst : 64 bytes from 192.168.0.22: icmp_seq=3D1 ttl=3D64 time=3D0.084 ms 64 bytes from 192.168.0.22: icmp_seq=3D2 ttl=3D64 time=3D0.124 ms 64 bytes from 192.168.0.22: icmp_seq=3D3 ttl=3D64 time=3D0.085 ms 64 bytes from 192.168.0.22: icmp_seq=3D4 ttl=3D64 time=3D0.116 ms ~ 110=C2=B5s At 200kb/s, ping improve to median at 77=C2=B5s. At 500kb/s, ~70=C2=B5s, 1M= :=20 ~68=C2=B5s, 5M : ~65=C2=B5s, 10Mb : ~60=C2=B5s : 100Mb : 55=C2=B5s (seems t= o be the best=20 ping I can reach with my server) Can you check on your server if you get the same behavior ? Also could you give me a ping you've between two linux guest on the same=20 host ? (I am far away from reality). Also, I remarks that booting a=20 Windows 2012R2 on the same host slown down the ping of Linux guest.=20 (loadavg 0,13, most of time idle is at 99%) Best regards, Gr=C3=A9gory