From owner-freebsd-hackers@freebsd.org Sat Mar 2 17:14:31 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45B3E150565B; Sat, 2 Mar 2019 17:14:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 78E0B700AC; Sat, 2 Mar 2019 17:14:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 5BD983DD847; Sun, 3 Mar 2019 04:14:24 +1100 (AEDT) Date: Sun, 3 Mar 2019 04:14:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Poul-Henning Kamp cc: Konstantin Belousov , Ian Lepore , Mark Millard , Mark Millard via freebsd-hackers , Konstantin Belousov , FreeBSD PowerPC ML Subject: Re: powerpc64 head -r344018 stuck sleeping problems: th->th_scale * tc_delta(th) overflows unsigned 64 bits sometimes [patched failed] In-Reply-To: <9993.1551536230@critter.freebsd.dk> Message-ID: <20190303032006.T4781@besplex.bde.org> References: <20190228145542.GT2420@kib.kiev.ua> <20190228150811.GU2420@kib.kiev.ua> <962D78C3-65BE-40C1-BB50-A0088223C17B@yahoo.com> <28C2BB0A-3DAA-4D18-A317-49A8DD52778F@yahoo.com> <20190301112717.GW2420@kib.kiev.ua> <679402FF-907C-43AF-B18C-8C9CC857D7A6@yahoo.com> <6669.1551473821@critter.freebsd.dk> <210dfd0f50ee6b1149c914ee503502654eb5f328.camel@freebsd.org> <20190302105652.GD68879@kib.kiev.ua> <9993.1551536230@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=UJetJGXy c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=nwOOQBBF5AvJ24hNhIcA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 78E0B700AC X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.42 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-6.25 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_IN_DNSWL_LOW(-0.10)[42.132.29.211.list.dnswl.org : 127.0.5.1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[optusnet.com.au]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-0.83)[-0.827,0]; RCPT_COUNT_SEVEN(0.00)[7]; IP_SCORE(-3.11)[ip: (-8.30), ipnet: 211.28.0.0/14(-4.01), asn: 4804(-3.19), country: AU(-0.04)]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Sun, 03 Mar 2019 01:45:11 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Mar 2019 17:14:31 -0000 On Sat, 2 Mar 2019, Poul-Henning Kamp wrote: > -------- > In message <20190302105652.GD68879@kib.kiev.ua>, Konstantin Belousov writes: > >> Using more than two timehands increases a chance of reader to try to >> use outdated timehands. > > No, using only two timehands increase the chance that the reader tries > to use the timehand which is being updated. Then it sees the generation change and retries. We fixed the ordering of accesses to the generation count so that this is robust. 1 timehands is always valid, so with 2 timehands there is no wait for the retry except in the very unlikely event that the generation changes for the new timehands too. 1 timehands would work too, but the retries would have to wait while it is updated. > As long as the reader does not use the timehand being updated, using > a one or two generations old timehand is OK. In old versions, there were races checking the generation count. Having multiple timehands made these races more unlikely to matter. > The target-value for delta-t was "a few milliseconds" when I wrote > timecounters, if somebody has changed that since, I hope they did > their math first. Tickless kernels complicate things. It's surprising that tc_ticktock() works so well with them. Calls to hardclock() are not periodic, so calls to tc_ticktock() are not periodic either. It has to handle coalesced and 1/hz ticks. Too much coalescing would break it. With my normal hz = 100, cpu0:timer interrupts still occur at at least 100 Hz. These presumably go to hardclock(), so the timing is satisfied. With hz = 1000, cpu0:timer interrupts only occur at at least 200 Hz. This is less than tc_ticktock() expects, but it still works. Bruce