From owner-freebsd-net@freebsd.org Fri Nov 6 16:26:55 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAA84A28665; Fri, 6 Nov 2015 16:26:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B72D1ED0; Fri, 6 Nov 2015 16:26:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4989A1FE023; Fri, 6 Nov 2015 17:26:52 +0100 (CET) Subject: Re: Timing issue with Dummynet on high kernel timer interrupt To: Luigi Rizzo References: <6545444AE21C2749939E637E56594CEA3C0DCCC4@gsp-ex02.ds.swin.edu.au> <5638B7B5.3030802@selasky.org> <6545444AE21C2749939E637E56594CEA3C0DE7FF@gsp-ex02.ds.swin.edu.au> <563B2703.5080402@selasky.org> <6545444AE21C2749939E637E56594CEA3C0E0BD9@gsp-ex02.ds.swin.edu.au> <563C6864.2090907@selasky.org> <563C786C.1050305@selasky.org> <563CC186.9000807@selasky.org> Cc: Rasool Al-Saadi , "freebsd-net@freebsd.org" , FreeBSD Current , Alexander Motin From: Hans Petter Selasky Message-ID: <563CD533.2000909@selasky.org> Date: Fri, 6 Nov 2015 17:28:35 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <563CC186.9000807@selasky.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2015 16:26:55 -0000 Hi, I spent some time to write a test application to investigate this issue and I found some irregularities, that when kern.eventtimer.periodic=0, the timer appears to run very irregular. Test software: ============== fetch http://home.selasky.org:8192/privat/callout_test_dummynet.tar.gz tar -zxvf callout_test_dummynet.tar.gz cd callout_test_dummynet make -m /usr/src/share/mk SYSDIR=/usr/src/sys all install Test I: ======= The following settings are placed in /boot/loader.conf and computer rebooted. kern.hz=10000 kern.eventtimer.periodic=1 kldload callout_test ./test.sh debug.total: 32604 -> 0 debug.total: 10021 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10019 -> 0 debug.total: 10021 -> 0 debug.total: 10020 -> 0 debug.total: 10021 -> 0 debug.total: 10019 -> 0 debug.total: 10020 -> 0 debug.total: 10018 -> 0 debug.total: 10021 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 debug.total: 10020 -> 0 Test II: ======== The following settings are placed in /boot/loader.conf and computer rebooted. kern.hz=10000 kern.eventtimer.periodic=0 kldload callout_test ./test.sh debug.total: 20337 -> 0 debug.total: 10091 -> 0 debug.total: 10018 -> 1 debug.total: 10041 -> 0 debug.total: 10019 -> 0 debug.total: 10644 -> 0 debug.total: 10014 -> 1 debug.total: 10020 -> 0 debug.total: 10019 -> 0 debug.total: 10644 -> 0 debug.total: 10014 -> 0 debug.total: 10644 -> 0 debug.total: 10640 -> 0 debug.total: 10210 -> 0 debug.total: 10015 -> 0 debug.total: 10020 -> 1 debug.total: 10020 -> 0 debug.total: 10453 -> 0 debug.total: 10642 -> 0 If you load the computer, like a multi-CPU buildkernel, the value flattens out again. Test III: ========= The following settings are placed in /boot/loader.conf and computer rebooted. kern.hz=1000 kern.eventtimer.periodic=1 kldload callout_test ./test.sh debug.total: 5238 -> 0 debug.total: 1005 -> 0 debug.total: 1003 -> 0 debug.total: 1006 -> 0 debug.total: 1003 -> 0 debug.total: 1003 -> 0 debug.total: 1005 -> 0 debug.total: 1006 -> 0 debug.total: 1003 -> 0 debug.total: 1013 -> 0 debug.total: 1005 -> 0 debug.total: 1006 -> 0 debug.total: 1004 -> 0 debug.total: 1005 -> 0 debug.total: 1003 -> 0 debug.total: 1004 -> 0 debug.total: 1006 -> 0 debug.total: 1004 -> 0 debug.total: 1004 -> 0 debug.total: 1007 -> 0 debug.total: 1003 -> 0 debug.total: 1004 -> 0 The difference between 100021 and 10642 interrupts in a second for test II is quite big, close to 6.5% deviation. Does anyone have any clue if this is the expected behaviour when kern.eventtimer.periodic=1 or not? MAV ? --HPS