From nobody Mon Oct 11 07:42:56 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C0E0917E7102 for ; Mon, 11 Oct 2021 07:43:05 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HSW494gdHz3CRd; Mon, 11 Oct 2021 07:43:05 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from sslproxy02.your-server.de ([78.47.166.47]) by dedi548.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mZpxZ-000AOp-Jb; Mon, 11 Oct 2021 09:42:57 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mZpxZ-000HJ0-GE; Mon, 11 Oct 2021 09:42:57 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 1D57D48005F; Mon, 11 Oct 2021 09:42:57 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Q2yx82h-CnkK; Mon, 11 Oct 2021 09:42:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id BDCA048008B; Mon, 11 Oct 2021 09:42:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6FhR3Vj-9_Mn; Mon, 11 Oct 2021 09:42:56 +0200 (CEST) Received: from [10.10.171.10] (unknown [10.10.171.10]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 882F948005F; Mon, 11 Oct 2021 09:42:56 +0200 (CEST) Subject: Re: Why was the timehands_count sysctl added? To: Ian Lepore , Konstantin Belousov Cc: Warner Losh , FreeBSD Hackers References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> <1e7b3766007ed6e35ff9f75f680b2e786b4355f9.camel@freebsd.org> From: Sebastian Huber Message-ID: Date: Mon, 11 Oct 2021 09:42:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 In-Reply-To: <1e7b3766007ed6e35ff9f75f680b2e786b4355f9.camel@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26318/Sun Oct 10 10:18:47 2021) X-Rspamd-Queue-Id: 4HSW494gdHz3CRd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On 10/10/2021 19:44, Ian Lepore wrote: > On Sun, 2021-10-10 at 20:39 +0300, Konstantin Belousov wrote: >> On Sun, Oct 10, 2021 at 11:15:39AM -0600, Ian Lepore wrote: >>> On Sat, 2021-10-09 at 14:54 -0600, Warner Losh wrote: >>>> On Sat, Oct 9, 2021, 1:56 PM Konstantin Belousov >>>> >>>> wrote: >>>> >>>>> On Sat, Oct 09, 2021 at 09:41:28PM +0200, Sebastian Huber >>>>> wrote: >>>>>> Hello, >>>>>> >>>>>> I synchronize currently the port of the FreeBSD timecounters >>>>>> to >>>>>> RTEMS and >>>>>> came across a change in 2019 which I do not understand. Some >>>>>> time >>>>>> ago the >>>>>> timehands were reduced from 10 to two: >>>>>> >>>>>> https://reviews.freebsd.org/D7302 >>>>>> >>>>>> In 2019 this changed again to be up to 16: >>>>>> >>>>>> https://reviews.freebsd.org/D21563 >>>>> This review did not changed it back to 16, the default value is >>>>> still 2. >>>>> It allows to bump the number of used timehands, but normally >>>>> systems run >>>>> with only 2. >>>>> >>>>>> The corresponding sysctl is not documented: >>>>>> >>>>>> https://www.freebsd.org/cgi/man.cgi?query=3Dtimecounters&sektion=3D= 4 >>>>>> >>>>>> Does someone know why this sysctl to select the count of >>>>>> timehands was >>>>>> added? Is this a performance optimization for some systems? >>>>> To allow for experimentation, and to satisfy some requests >>>>> where >>>>> people >>>>> wanted to have more that 2 timehands. >>>>> >>>> When would someone want that? What's the use case? >>>> >>>> Warner >>>> >>> One known usecase is a single-cpu (non-SMP) system that uses a PPS >>> signal.=C2=A0 With only two timehands, a pps pulse that arrives while >>> the >>> system is in an idle-sleep (wait-for-interrupt) state will switch >>> timehands too many times between the wakeup and the capture and >>> trying >>> to use the capture data, so that the th generation count never >>> matches, >>> and in effect you never capture a PPS pulse.=C2=A0 I found that on a >>> BeagleBone system.=C2=A0 It takes a minimum of 3 timehands for it to >>> work >>> right. >> So should this system automatically adjust the number of timehands? >> There were no similar complaints on UP i386, at least I did not see >> them. >> > I think a required part of the failure scenario was a PPS driver that > used the hardware-capture feature (the hardware latches a counter on > the pps pulse and timecounter->tc_poll_pps() gets called to retrieve > the latched value). i386 hardware doesn't do that. The rareness of > the hardware that works that way (and the additional rareness of people > using that hardware that way) I think was part of why you made it > tunable rather than just increasing the timehands count for everyone, > back when I reported this scenario. Thanks for your insights. So in general the tunable timehands count is=20 an inexpensive knob which may fix issues under some very specific=20 conditions. --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/