From nobody Wed Jun 01 11:03:19 2022 X-Original-To: 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 246421B6054A for ; Wed, 1 Jun 2022 11:03:25 +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 4LCmTm1g2Kz4Ts1 for ; Wed, 1 Jun 2022 11:03:24 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from sslproxy06.your-server.de ([78.46.172.3]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nwM8I-0008Ti-7e; Wed, 01 Jun 2022 13:03:22 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwM8I-000P6l-5F; Wed, 01 Jun 2022 13:03:22 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id D071448014F; Wed, 1 Jun 2022 13:03:21 +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 Ezn2eU_v6akE; Wed, 1 Jun 2022 13:03:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 671D74800F0; Wed, 1 Jun 2022 13:03:21 +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 2Xemg1JbI1At; Wed, 1 Jun 2022 13:03:21 +0200 (CEST) Received: from [10.10.171.14] (unknown [10.10.171.14]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 3A87F4800AA; Wed, 1 Jun 2022 13:03:21 +0200 (CEST) Message-ID: Date: Wed, 1 Jun 2022 13:03:19 +0200 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: pps_capture() and pps_fetch() Content-Language: en-US To: Poul-Henning Kamp Cc: hackers@freebsd.org References: <5b8310db-c94b-709f-8c57-bec2d413a80f@embedded-brains.de> <202206010725.2517PEfF036703@critter.freebsd.dk> From: Sebastian Huber In-Reply-To: <202206010725.2517PEfF036703@critter.freebsd.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.6/26559/Wed Jun 1 10:06:04 2022) X-Rspamd-Queue-Id: 4LCmTm1g2Kz4Ts1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of sebastian.huber@embedded-brains.de designates 85.10.215.148 as permitted sender) smtp.mailfrom=sebastian.huber@embedded-brains.de X-Spamd-Result: default: False [-2.71 / 15.00]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:85.10.215.148]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[embedded-brains.de]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.51)[-0.506]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-0.90)[-0.904]; MLMMJ_DEST(0.00)[hackers]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:85.10.192.0/18, country:DE]; RCVD_COUNT_SEVEN(0.00)[8]; HAS_X_AS(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Hello Poul-Henning, On 01/06/2022 09:25, Poul-Henning Kamp wrote: > Sebastian Huber writes: >=20 >> I try to understand how the PPS synchronization works in FreeBSD. It >> seems that pps_capture() starts a transaction and pps_event() complete= s >> the transaction if nothing interfered in the meantime. > The answer to most of your questions are in ./i386/i386/elan-mmcr.c >=20 > The PPS capture in the Soekris 4501 used two hardware counters, countin= g at the same rate. >=20 > The first of the two were the timecounter, the other was started by the= hardware signal. >=20 > Sometime later the hardware signals interrupt processing would happen. >=20 > By reading read both counters as close to instantaneously as possible, = and compensated for the interrupt latency by subtracting the event-starte= d counter from the timecounter. >=20 > (See also:http://phk.freebsd.dk/soekris/pps/) thanks for the background information. What I don't understand is why the th_generation is checked three times=20 (pps_capture(): 1, pps_event(): 2) and not only once in pps_event()=20 right before we use the captured time. --=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/