From owner-svn-src-all@freebsd.org Mon Sep 9 19:14:33 2019 Return-Path: Delivered-To: svn-src-all@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 BCBC2DC7E7; Mon, 9 Sep 2019 19:14:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 46RyX86cxNz4R8q; Mon, 9 Sep 2019 19:14:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f46.google.com with SMTP id k5so6138625iol.5; Mon, 09 Sep 2019 12:14:32 -0700 (PDT) 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:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=hhI2X15jCro7PjYxaaelw82ZDtzGul8ubBpzdgkWasQ=; b=DpJV3PMX0Qq1BjM4CbaJjfQXpuDejjM5J3PeiTizaWt9j9Nn3V0H3mU+msHRQrBGJn RT5Zrv/crqRVixgtKEcRUVbucrCJ4FtBkw3cAduP8DL2dWWao3g5lu90lb2pvAtRSqKP O/NXclvKzhRDvmNNaPvHbL+JyEDpUiIZCfiLYfeUmagJjaAO7gRdvDPFZ4P9WHRmdaHo AJz0jDYpwMdqHOdxEBqL0S3JTyRz/Nywdq7HMjNZsvEppdDpmc+WOMMcEUMtdIm0T77z W+6jCCOPZFVcqK8zyVdymJ8gTT2MSal/qtl0iKmDjF2p6WYZnJfNd+eR1Iu+jLlFL7J8 PuLQ== X-Gm-Message-State: APjAAAX2LP/hLwkmcwmraoYBBK6V9sWVwmqtgSkTtQmmZhM0p71+4uzo AdcsA+V9b9rxyiLOIFE67h/6mOwq X-Google-Smtp-Source: APXvYqzNAjas1wDJ5fU5UmV+bHmFWJ6FKG+hO9NU1FWwAC+uQvSs+xeQ87e1VIW/WUfK1eJE5mw6Ow== X-Received: by 2002:a02:c94b:: with SMTP id u11mr23154011jao.35.1568056471276; Mon, 09 Sep 2019 12:14:31 -0700 (PDT) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com. [209.85.166.42]) by smtp.gmail.com with ESMTPSA id x5sm9129663ior.46.2019.09.09.12.14.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Sep 2019 12:14:30 -0700 (PDT) Received: by mail-io1-f42.google.com with SMTP id h144so31379447iof.7; Mon, 09 Sep 2019 12:14:30 -0700 (PDT) X-Received: by 2002:a02:cb51:: with SMTP id k17mr26435922jap.119.1568056470389; Mon, 09 Sep 2019 12:14:30 -0700 (PDT) MIME-Version: 1.0 References: <201909091129.x89BTxvw061871@repo.freebsd.org> <20190909184805.GV2559@kib.kiev.ua> In-Reply-To: <20190909184805.GV2559@kib.kiev.ua> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 9 Sep 2019 12:14:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352059 - head/sys/kern To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46RyX86cxNz4R8q X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-4.33 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[46.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.33)[ip: (-6.03), ipnet: 209.85.128.0/17(-3.32), asn: 15169(-2.26), country: US(-0.05)]; RWL_MAILSPIKE_POSSIBLE(0.00)[46.166.85.209.rep.mailspike.net : 127.0.0.17]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2019 19:14:33 -0000 Thanks! On Mon, Sep 9, 2019 at 11:48 AM Konstantin Belousov w= rote: > > On Mon, Sep 09, 2019 at 11:31:32AM -0700, Conrad Meyer wrote: > > What=E2=80=99s the motivation for using more timehands? > See the thread titled 'Is it a good idea to use a usb-serial adapter > for PPS input? Yes, it is.' on arm@ and usb@. In short, there are some > reports of timecounters misbehaving on single-core systems when only two > timehands are enabled. > > The change eases the experimentation and provides a workaround which does > not require modifying the sources to apply. > > > > > On Mon, Sep 9, 2019 at 04:30 Konstantin Belousov wrot= e: > > > > > Author: kib > > > Date: Mon Sep 9 11:29:58 2019 > > > New Revision: 352059 > > > URL: https://svnweb.freebsd.org/changeset/base/352059 > > > > > > Log: > > > Make timehands count selectable at boottime. > > > > > > Tested by: O'Connor, Daniel > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > Differential revision: https://reviews.freebsd.org/D21563 > > > > > > Modified: > > > head/sys/kern/kern_tc.c > > > > > > Modified: head/sys/kern/kern_tc.c > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/sys/kern/kern_tc.c Mon Sep 9 11:22:38 2019 (r352= 058) > > > +++ head/sys/kern/kern_tc.c Mon Sep 9 11:29:58 2019 (r352= 059) > > > @@ -83,19 +83,16 @@ struct timehands { > > > struct timehands *th_next; > > > }; > > > > > > -static struct timehands th0; > > > -static struct timehands th1 =3D { > > > - .th_next =3D &th0 > > > -}; > > > -static struct timehands th0 =3D { > > > +static struct timehands ths[16] =3D { > > > + [0] =3D { > > > .th_counter =3D &dummy_timecounter, > > > .th_scale =3D (uint64_t)-1 / 1000000, > > > .th_offset =3D { .sec =3D 1 }, > > > .th_generation =3D 1, > > > - .th_next =3D &th1 > > > + }, > > > }; > > > > > > -static struct timehands *volatile timehands =3D &th0; > > > +static struct timehands *volatile timehands =3D &ths[0]; > > > struct timecounter *timecounter =3D &dummy_timecounter; > > > static struct timecounter *timecounters =3D &dummy_timecounter; > > > > > > @@ -115,6 +112,10 @@ static int timestepwarnings; > > > SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, > > > ×tepwarnings, 0, "Log time steps"); > > > > > > +static int timehands_count =3D 2; > > > +SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count, CTLFLAG_RDT= UN, > > > + &timehands_count, 0, "Count of timehands in rotation"); > > > + > > > struct bintime bt_timethreshold; > > > struct bintime bt_tickthreshold; > > > sbintime_t sbt_timethreshold; > > > @@ -1960,8 +1961,9 @@ done: > > > static void > > > inittimecounter(void *dummy) > > > { > > > + struct timehands *thp; > > > u_int p; > > > - int tick_rate; > > > + int i, tick_rate; > > > > > > /* > > > * Set the initial timeout to > > > @@ -1987,6 +1989,16 @@ inittimecounter(void *dummy) > > > #ifdef FFCLOCK > > > ffclock_init(); > > > #endif > > > + > > > + /* Set up the requested number of timehands. */ > > > + if (timehands_count < 1) > > > + timehands_count =3D 1; > > > + if (timehands_count > nitems(ths)) > > > + timehands_count =3D nitems(ths); > > > + for (i =3D 1, thp =3D &ths[0]; i < timehands_count; thp =3D = &ths[i++]) > > > + thp->th_next =3D &ths[i]; > > > + thp->th_next =3D &ths[0]; > > > + > > > /* warm up new timecounter (again) and get rolling. */ > > > (void)timecounter->tc_get_timecount(timecounter); > > > (void)timecounter->tc_get_timecount(timecounter); > > > > > >