From owner-svn-src-head@freebsd.org Fri Apr 17 02:33:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D9972CEE46 for ; Fri, 17 Apr 2020 02:33:56 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.ore.mailhop.org (outbound1a.ore.mailhop.org [54.213.22.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 493Ksc0fQMz4Qm2 for ; Fri, 17 Apr 2020 02:33:55 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1587090834; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=Aco3BIzQehJ7t+CNLioCzWNQREOdTK12XpPDE2D7RgG/uPlZgYWplYMu0wJwsVCpZ12VbR+k5c1XZ 6e+NF87+eALnPxKiPlhTlJ6w89wNW333rsTUN61qBSK5WMoFOVfvgiSEH5Bclz++nNjVboeorZECRz b3gDSKxSub3cZMeoSXx/wNfYKDvzEZ03WBo9HHg0pXF+I2pH2Ml8KKs2S3oUgItBrNM3RCwZLaF9RO yK7K7+uIZg+bWLG6axzYGHaFFxalWT2AyXF4uF1wG/iBHfIzT2eMagVuuSx29M9FMSgBW5QJlewWgM C8dsFPw+UtsnLmd8XBrQOYpaRQ9NhHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=D1dSm5ZA2ZhtwCfEL6lZINJnvY5GiNnTuMdP9vgYGaM=; b=WusaKAdJMdMLtkIIW8u9F3CRY/xjXW7t+qjPdAsPYhwtYK2bzonMYFftLgvOlQTQ/3699nFm4h/8k 3OUxlLmbFtlvVhTX7LZDQNPIyRu3fVZw4yaIbMbd5gbQL9gx6yFD4+fjXNHePZafch5xP3XuhDqdX+ NJ6yjBYe95vGBO9ZYc8vbfpBR85/KNWvOqI1wEDIGv4M9gVCvmAMakvZqhzrCe2Acc9qUieJ7RJL38 apqT+eNcVAm+Edi2K+02Su15vncnCuNOMYTi1XgoofX5vSE+Eyr9yieyew2/68VN7yScAaDAHKWUqT QfzJGrGRoWy0Vdv4hxY6vGODuVGxjJA== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=D1dSm5ZA2ZhtwCfEL6lZINJnvY5GiNnTuMdP9vgYGaM=; b=l1WMQsOsLFR0EGKKHsIK+pnwIryRbu1RBBPNXonPlkHVPJdRQ4jSpWfeQwKh6F4gLPFT4g9Aj08He PTvv9yHRAQgi6pYhSwLlde6y/b6NLa0omDN9FIFRpYq4ZJBqYgVuZDIT8ofWn92uS+nftkmOvtR+w7 UKC0Q+j5Z1PIZG8y1ZPxRCoII2DmCR9HJiqWWF7OCiBIID2FcaoTgtng9nL7xE5YNWxC6Cw05dUY+l /BPOdiHkvQSao5CZTRRsKIENkX1/xdCQf2tg++KzkvLAy6wHED5O+sbJZ+RDuBMh3AaUqWfl81864M 3I+hgOR/wvJFSu91fFyRAzBOOGGFxsw== X-MHO-RoutePath: aGlwcGll X-MHO-User: e01caf78-8053-11ea-b10c-b5956a7dd1a1 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id e01caf78-8053-11ea-b10c-b5956a7dd1a1; Fri, 17 Apr 2020 02:33:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 03H2XpW2077060; Thu, 16 Apr 2020 20:33:51 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <28f9262a36dc4b7d4437ef3860ac8e472f6df2ff.camel@freebsd.org> Subject: Re: svn commit: r360033 - head/tests/sys/kqueue/libkqueue From: Ian Lepore To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 16 Apr 2020 20:33:51 -0600 In-Reply-To: <202004170222.03H2MFso026451@repo.freebsd.org> References: <202004170222.03H2MFso026451@repo.freebsd.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 493Ksc0fQMz4Qm2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.96 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-0.99)[-0.987,0]; ASN(0.00)[asn:16509, ipnet:54.213.0.0/16, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2020 02:33:56 -0000 On Fri, 2020-04-17 at 02:22 +0000, Kyle Evans wrote: > Author: kevans > Date: Fri Apr 17 02:22:15 2020 > New Revision: 360033 > URL: https://svnweb.freebsd.org/changeset/base/360033 > > Log: > tests: kqueue: use a more precise timer for the NOTE_ABSTIME test > > Originally noticed while attempting to run the kqueue tests under > qemu-user-static, this apparently just happens sometimes when running in a > jail in general -- the timer will fire off "too early," but it's really just > the result of imprecise measurements (noted by cem). > > Kicking this over to NOTE_USECONDS still tests the correct thing while > allowing it to work more consistently; a basic sanity test reveals that we > often end up coming in just less than 200 microseconds after the timer > fired off. > > MFC after: 3 days > > Modified: > head/tests/sys/kqueue/libkqueue/timer.c > > Modified: head/tests/sys/kqueue/libkqueue/timer.c > ============================================================================== > --- head/tests/sys/kqueue/libkqueue/timer.c Fri Apr 17 02:21:46 2020 (r360032) > +++ head/tests/sys/kqueue/libkqueue/timer.c Fri Apr 17 02:22:15 2020 (r360033) > @@ -216,17 +216,17 @@ test_abstime(void) > { > const char *test_id = "kevent(EVFILT_TIMER, EV_ONESHOT, NOTE_ABSTIME)"; > struct kevent kev; > - time_t start; > - time_t stop; > - const int timeout = 3; > + long end, start, stop; > + const int timeout_sec = 3; > > test_begin(test_id); > > test_no_kevents(); > > - start = time(NULL); > + start = now(); > + end = start + SEC_TO_US(timeout_sec); > EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT, > - NOTE_ABSTIME | NOTE_SECONDS, start + timeout, NULL); > + NOTE_ABSTIME | NOTE_USECONDS, end, NULL); > if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) > err(1, "%s", test_id); > > @@ -235,10 +235,10 @@ test_abstime(void) > kev.data = 1; > kev.fflags = 0; > kevent_cmp(&kev, kevent_get(kqfd)); > - stop = time(NULL); > - if (stop < start + timeout) > - err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)(start + timeout)); > > + stop = now(); > + if (stop < end) > + err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)end); > /* Check if the event occurs again */ > sleep(3); > test_no_kevents(); Not caused by you, but this change made me notice: using 'long' to hold the number of microseconds since the unix epoch will only work on amd64 and arm64. Everything involved with that needs to use uint64_t to work on all arches. -- Ian