From owner-freebsd-arm@freebsd.org Mon Aug 19 14:32:28 2019 Return-Path: Delivered-To: freebsd-arm@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 5E5B5C8411 for ; Mon, 19 Aug 2019 14:32:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BxGM5KxRz3Pmj for ; Mon, 19 Aug 2019 14:32:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x829.google.com with SMTP id j15so2071270qtl.13 for ; Mon, 19 Aug 2019 07:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YJ5VLjHDvS5lMHvLDxXuoV6qN0OIhFuG04wYGF2nOf0=; b=Qy7YQEkF9+SfqzO+SNpQdwCd+/umaBobHdS8oPaFh+gfpyXuzGtOqb2JyGOaaK7W/Q 9urSGI1NzrMdxfH96BrNJl/6W0kFnWysQOoPWRgk3ChZbUrYJ5KHrT2bljHdqMJS58hS IIo5L6Srv9YDk2DXL9fCy5shoYALt+rj8HhsszTy5dX4CgFqY2tmW88Qt736tNCLlqh/ y2qej4UP9DJoZMGe5odAJ/1Updu9QA5KmG1nPQFFAkLPLtx1oa6i3HmzFVMTiDs0r1Eh jBXis3eJDYhOimam6RzJXer8yix1PepOd7dSM2aip6fM99XxKkUFinkcuoUWUKshf89E sXCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YJ5VLjHDvS5lMHvLDxXuoV6qN0OIhFuG04wYGF2nOf0=; b=eN9usxEskKPc47YNb0f58Zbp2Wo4D4nP3aWgZ5PzCbO0/36+ywNaCM0Fhvrn5uThBN 7v/8vzLYLxK4SzdUFvdOsPgqrqMt7Py+uZssBGrzAmhAKw2wexisfIX17LP+lqoTNcEL 5ivT1lZzvBQ8whe/5OOQrClqcSVJ3+TO1sanfVcHl1qGnFVqgsz1evVu2EcrCOgftbwy VPhOQS8l/RDzSJd4XjPaRaRJ7VK8ggVJ2HzncuWjkXtLTAPOHX0zit+feK9oUEbxdDOl wGBnMBA7vk/1tHLWorSKLcanowPzqvffdHk8s2oeQHIep9V3HhTEs/tvvCWu27HKrg1/ zt9w== X-Gm-Message-State: APjAAAVYiiWmzxofD907c5gmiyzjyc4zsHw+YrRdU75XqdjLmV85xaSu qHC09FdjdVwio61RJgW/9hSvIGuF7vujr/nfQ5B+WA== X-Google-Smtp-Source: APXvYqydrxtofOhGYdwUYtSXvQiF5mH3GSCf+S0/DKGl9aH4kyAK2iSDmH2xRX646FzhYDhWi6tW8tWmZdwWhsJNcz0= X-Received: by 2002:a0c:e5c6:: with SMTP id u6mr10984000qvm.102.1566225146359; Mon, 19 Aug 2019 07:32:26 -0700 (PDT) MIME-Version: 1.0 References: <61B1AAF3-40F6-47BC-8F05-7491C13BF288@dons.net.au> <9E142F1A-5E8C-4410-91F5-7C80B3D0A15B@dons.net.au> In-Reply-To: From: Warner Losh Date: Mon, 19 Aug 2019 08:32:15 -0600 Message-ID: Subject: Re: Is it a good idea to use a usb-serial adapter for PPS input? Yes, it is. To: Ian Lepore Cc: "O'Connor, Daniel" , "usb@freebsd.org" , "freebsd-arm@FreeBSD.org" X-Rspamd-Queue-Id: 46BxGM5KxRz3Pmj X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Qy7YQEkF; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::829) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.94 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[9.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.95)[ip: (-9.39), ipnet: 2607:f8b0::/32(-2.93), asn: 15169(-2.37), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; SUBJECT_HAS_QUESTION(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 14:32:28 -0000 On Mon, Aug 19, 2019 at 8:26 AM Ian Lepore wrote: > On Mon, 2019-08-19 at 17:09 +0930, O'Connor, Daniel wrote: > > > On 12 Aug 2019, at 09:09, O'Connor, Daniel > > > wrote: > > > > always get lost on single-core processors which are in cpu_idle() > > > > at > > > > the time the hardclock interrupt happens. (But that's fixable by > > > > just > > > > increasing the number of timehands, I think at least 4 are > > > > required.) > > > > > > OK, how do I increase the number of clock hands? > > > > I am going to try this diff but buildkernel is going to take a > > while... > > > > diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c > > index 2656fb4d2..00440b6a2 100644 > > --- a/sys/kern/kern_tc.c > > +++ b/sys/kern/kern_tc.c > > @@ -83,8 +83,48 @@ struct timehands { > > struct timehands *th_next; > > }; > > > > -static struct timehands th0; > > +static struct timehands th2; > > static struct timehands th1 = { > > + .th_next = &th2 > > +}; > > + > > +static struct timehands th3; > > +static struct timehands th2 = { > > + .th_next = &th3 > > +}; > > + > > +static struct timehands th4; > > +static struct timehands th3 = { > > + .th_next = &th4 > > +}; > > + > > +static struct timehands th5; > > +static struct timehands th4 = { > > + .th_next = &th5 > > +}; > > + > > +static struct timehands th6; > > +static struct timehands th5 = { > > + .th_next = &th6 > > +}; > > + > > +static struct timehands th7; > > +static struct timehands th6 = { > > + .th_next = &th7 > > +}; > > + > > +static struct timehands th8; > > +static struct timehands th7 = { > > + .th_next = &th8 > > +}; > > + > > +static struct timehands th9; > > +static struct timehands th8 = { > > + .th_next = &th9 > > +}; > > + > > +static struct timehands th0; > > +static struct timehands th9 = { > > .th_next = &th0 > > }; > > static struct timehands th0 = { > > > > Oh, I'm sorry, I forgot to respond about this. Yeah, that patch would > do it. I think a minimum of 4 sets of timehands are needed for pps > capture on a single-core system with a latching timecounter like > dmtpps. > Do we have a good (or even a bad) writeup of how to know that 4 is good, or when 5 or 6 might be needed? Warner