Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756623AbbHDNrp (ORCPT ); Tue, 4 Aug 2015 09:47:45 -0400 Received: from enficsets1.metaswitch.com ([192.91.191.38]:17772 "EHLO ENFICSETS1.metaswitch.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756278AbbHDNrn convert rfc822-to-8bit (ORCPT ); Tue, 4 Aug 2015 09:47:43 -0400 X-Greylist: delayed 310 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Aug 2015 09:47:43 EDT From: Shaun Crampton To: "linux-kernel@vger.kernel.org" Subject: veths often slow to come up Thread-Topic: veths often slow to come up Thread-Index: AQHQzrtl+sO5zecqtUKAvBW2mpIStg== Date: Tue, 4 Aug 2015 13:42:24 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.8.150116 x-originating-ip: [172.18.209.34] Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1794 Lines: 73 Please CC me on any responses, thanks. Setting both ends of a veth to be oper UP completes very quickly but I find that pings only start flowing over the veth after about a second. This seems to correlate with the NO-CARRIER flag being set or the interface being in "state UNKNOWN" or "state DOWN? for about a second (demo script below). If I run the script repeatedly then sometimes it completes very quickly on subsequent runs as if there?s a hot cache somewhere. Could this be a bug or is there a configuration to speed this up? Seems odd that it?s almost exactly 1s on the first run. Seen on these kernels: * 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux * 4.0.9-coreos #2 SMP Thu Jul 30 01:07:55 UTC 2015 x86_64 Intel(R) Xeon(R) CPU @ 2.50GHz GenuineIntel GNU/Linux Regards, -Shaun Running my test script below (Assumes veth0/1 do not already exist): $ sudo ./veth-test.sh Time to create veth: real 0m0.019s user 0m0.002s sys 0m0.010s Time to wait for carrier: real 0m1.005s user 0m0.007s sys 0m0.123s # veth-test.sh #!/bin/bash function create_veth { ip link add type veth ip link set veth0 up ip link set veth1 up } function wait_for_carrier { while ! ip link show | grep -qE 'veth[01]'; do sleep 0.05 done while ip link show | grep -E 'veth[01]? | \ grep -Eq 'NO-CARRIER|state DOWN|state UNKNOWN'; do sleep 0.05 done } echo "Time to create veth:" time create_veth echo echo "Time to wait for carrier:" time wait_for_carrier ip link del veth0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/