From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751591AbcFVKdU (ORCPT ); Wed, 22 Jun 2016 06:33:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:37851 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbcFVKdS (ORCPT ); Wed, 22 Jun 2016 06:33:18 -0400 Date: Wed, 22 Jun 2016 12:28:59 +0200 From: Cyril Hrubis To: Thomas Gleixner Cc: Mike Galbraith , Rik van Riel , Len Brown , Peter Zijlstra , Frederic Weisbecker , LKML , George Spelvin , Chris Mason , Eric Dumazet , rt@linutronix.de, "Paul E. McKenney" , Linus Torvalds , Ingo Molnar , ltp@lists.linux.it, Arjan van de Ven Subject: Re: [LTP] [patch V2 00/20] timer: Refactor the timer wheel Message-ID: <20160622102858.GA13962@rei.lan> References: <20160617121134.417319325@linutronix.de> <1466581044.3188.34.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > rtbox:~ # /usr/local/ltp/conformance/interfaces/sigtimedwait/sigtimedwait_1-1.run-test > > Test FAILED: sigtimedwait() did not return in the required time > > time_elapsed: 1.197057 > > ...come on, you can do it... > > rtbox:~ # /usr/local/ltp/conformance/interfaces/sigtimedwait/sigtimedwait_1-1.run-test > > Test PASSED > > > > #define ERRORMARGIN 0.1 > > ... > > if ((time_elapsed > SIGTIMEDWAITSEC + ERRORMARGIN) > > || (time_elapsed < SIGTIMEDWAITSEC - ERRORMARGIN)) { > > printf("Test FAILED: sigtimedwait() did not return in " > > "the required time\n"); > > printf("time_elapsed: %lf\n", time_elapsed); > > return PTS_FAIL; > > } > > > > Looks hohum to me, but gripe did arrive with patch set, so you get a note. > > hohum is a euphemism. That's completely bogus. > > The only guarantee a syscall with timers has is: timer does not fire early. While this is true, checking with reasonable error margin works just fine 99% of the time. You cannot really test that timer expires, without setting arbitrary margin. Looking into POSIX sigtimedwait() timer should run on CLOCK_MONOTONIC so we can call clock_getres(CLOCK_MONOTOINC, ...) double or tripple the value and use it for error margin. And also fix the test to use the CLOCK_MONOTONIC timer. And of course the error margin must not be used when we check that the elapsed time wasn't shorter than we expected. Does that sound reasonable? -- Cyril Hrubis chrubis@suse.cz