From nobody Fri Oct 8 06:00:16 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 8BC3312D1433 for ; Fri, 8 Oct 2021 06:00:36 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQcxH4kbvz3Hxw for ; Fri, 8 Oct 2021 06:00:35 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mailhost.netlabit.sk with ESMTPSA; Fri, 08 Oct 2021 08:00:27 +0200 id 00DCA80D.615FDE7B.00013D06 Date: Fri, 8 Oct 2021 08:00:16 +0200 From: Milan Obuch To: freebsd-hackers@freebsd.org Subject: Persistent USB serial? Message-ID: <20211008080016.7830e3d5@zeta.dino.sk> X-Mailer: Claws Mail 3.18.0git266 (GTK+ 2.24.33; i386-portbld-freebsd11.4) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HQcxH4kbvz3Hxw X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk X-Spamd-Result: default: False [-2.10 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.80)[-0.802]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5578, ipnet:84.245.64.0/18, country:SK]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N Hi, I'd like to solicit opinions/hints for following scenario, which is quite common currently. There are some development and evaluation boards designed with USB port as power source and serial console at the same time (sometimes even more ports or JTAG as well). When board has power on switch, usually no activity is present on USB wire without board being powered - there is some USB-to-UART circuitry powered from board power source. So serial port device /dev/cuaUn et al. get created only after power on of the board. Problem: port number can be different depending on USB port enumeration or connection order. Another one: it is easy to miss first characters sent from the board if you are not able to write required command like 'cu -l /dev/cuaU9 -s 115200' quickly. Maybe it is possible to write some devd config file snippet which ensures consistent device naming without need of maintaining correct (everytime the same) order of cable connecting, but even that, this does not solve second problem, starting up some terminal or terminal like program in time. Has anybody some experience in this area who can share it? Some hints what to test? Do we have some pseudo serial device, which can be used as device argument for cu command, which can just grab the real USB serial when it appears on connecting the board under test? Regards, Milan From nobody Fri Oct 8 07:25:37 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 3801112D43E9 for ; Fri, 8 Oct 2021 07:25:40 +0000 (UTC) (envelope-from debdrup@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQfqS15myz4k9W for ; Fri, 8 Oct 2021 07:25:40 +0000 (UTC) (envelope-from debdrup@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1633677940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+4Y3HGNAFc7XoMigpM0My59Yfvtf/1ATSXzaVSVJiF0=; b=DKd4oCua4A84ri3QXuudeji/doDIts1EUNA/OG0nTad2DxKRUU7P34qaA/EJDX8RePXxp+ p33xNM8+xGaATPpfcz9j2bvFqr8mQF3Gc6ZuHvn8Aap4E7mvOfyRZz5I91ivjbp5txbpEs IQV9g+8tcSAX+lrBJVaT7N4k5I4qo+SW6a8FMZun5AZMiaUfb/EYwjKQ2+67Nidnrd3IYI iF7nayw/vM8w9LtWk+sTu7YOedXXp4QmXCJgGEdSp2mH+4vcsjy8abJOdfKtURWNmek8Fu G0qNwTPpotxU1OPh7ds1C21EnUWI2ILvsNOec3n4oP75LHdtrwf9h1NIrpg0DA== Received: by freefall.freebsd.org (Postfix, from userid 1471) id 14F111BEC7; Fri, 8 Oct 2021 07:25:40 +0000 (UTC) Date: Fri, 8 Oct 2021 09:25:37 +0200 From: Daniel Ebdrup Jensen To: freebsd-hackers@freebsd.org Subject: Re: Persistent USB serial? Message-ID: <20211008072537.vytjzyqol5cksy5d@nerd-thinkpad.local> Mail-Followup-To: Daniel Ebdrup Jensen , freebsd-hackers@freebsd.org References: <20211008080016.7830e3d5@zeta.dino.sk> 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 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2irchopb7p54edbx" Content-Disposition: inline In-Reply-To: <20211008080016.7830e3d5@zeta.dino.sk> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1633677940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+4Y3HGNAFc7XoMigpM0My59Yfvtf/1ATSXzaVSVJiF0=; b=Oll6mXKJJlwHWEzVmz8cG24cJgBxXElmKpMQNAt5gJUjxu4HueoJUyLWllb0fDXkgTQiA3 KA2aA9xUz/cV6dOA/UJKYmpDrFXQPPAQN3G80kaiztaIGK0vGvZCANgp5V6t6kJOBhqiqI dSLxGsa66pQjloN2U+FhC+d0sMaivopl7sBeG9iqU78kSHnaamVa6bamYTRNNKvv4en4NZ YVbfNZbc98UCEjvNX0LBnQZKDm84/3Rc3/6woGYOdC902rs2Zmilj+OS7umTG3j7Ud4SjT TA8ycvAGx2nwWwD8j091+3rL8I0AAkVpF5a/i7GxJSWuS0ZwTCukeXXLWUMvfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1633677940; a=rsa-sha256; cv=none; b=Ck6YGR7vbacRyLdoT5SAEXaUrToEykEFBtaLFEUl9sHTVjaGjW04VVKK5KkZNS4WbA0DPq PgsyUY9p9K0eSr1+LPMp+zpxq/vZFEeqPIouVJqjuQxvJCX5trQT4AszRY8VLJ/KnG0V6Q xlNnDbh/EKVevB/kSWBYdNRAbJWqTIiKvol2dq8THei/wPgvSyzn5+Swi81IYxCFqFBlEH Uj84n63oesUYA0V6rYv7s4AvKDbjoaIGxu0hR5OmJdt+6PSRSDs47n5E+GdOYkJTOyw5mh XiSX4qRyK9UTxMspjgrIlKH7ykIP/9iQwAIzLdoDTZkrfKlIl9l1/sDSV80VMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --2irchopb7p54edbx Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On Fri, Oct 08, 2021 at 08:00:16AM +0200, Milan Obuch wrote: >Hi, > >I'd like to solicit opinions/hints for following scenario, which is >quite common currently. > >There are some development and evaluation boards designed with USB port >as power source and serial console at the same time (sometimes even >more ports or JTAG as well). When board has power on switch, usually no >activity is present on USB wire without board being powered - there is >some USB-to-UART circuitry powered from board power source. So serial >port device /dev/cuaUn et al. get created only after power on of the >board. > >Problem: port number can be different depending on USB port enumeration >or connection order. Another one: it is easy to miss first characters >sent from the board if you are not able to write required command like >'cu -l /dev/cuaU9 -s 115200' quickly. > >Maybe it is possible to write some devd config file snippet which >ensures consistent device naming without need of maintaining correct >(everytime the same) order of cable connecting, but even that, this >does not solve second problem, starting up some terminal or terminal >like program in time. > >Has anybody some experience in this area who can share it? Some hints >what to test? Do we have some pseudo serial device, which can be used >as device argument for cu command, which can just grab the real USB >serial when it appears on connecting the board under test? > >Regards, >Milan > Hi Milan, There's an open review [1] for location-based unit numbering for USB, which some of us have been using for quite some time - and while it's not completely done, it's very useful. Yours, Daniel Ebdrup Jensen 1: https://reviews.freebsd.org/D21886 --2irchopb7p54edbx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEDonNJPbg/JLIMoS6Ps5hSHzN87oFAmFf8nFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDBF ODlDRDI0RjZFMEZDOTJDODMyODRCQTNFQ0U2MTQ4N0NDREYzQkEACgkQPs5hSHzN 87ob7AgAk5UO37K8hkFMlNVFCrcur/0recy33yw0jZC2FU9bAL1cpgAt2X02eSF7 5/YldPVBEkqlja6LGGftVc1JqHVTLB4q+jm/2cdcrVE822cq+m+en1ShRWU5KSud x/6EBeEIOY38wFtZBJLdo2o4O36ALQAz0v9Tz6pE0b2Uv5KJfJOOZpg56RV9aVs1 kDSZfyDaVevmDBNl67/ira6umQv14s+l8VUxldFptrFxKtgxtP+jbxBDg34g1+BA Uioj61e4URPAtnEL/r0xokKmOntPaXVZbUTp99pR622rcYguHyMAFlsBhZnhOIqs lNRQ6GnntnK1F2fAP7oCMYLT7gvktw== =O9JP -----END PGP SIGNATURE----- --2irchopb7p54edbx-- From nobody Fri Oct 8 07:26:32 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 409FD12D4E93 for ; Fri, 8 Oct 2021 07:26:50 +0000 (UTC) (envelope-from chrisj@rtems.org) Received: from nsstlmta19p.bpe.bigpond.com (nsstlmta19p.bpe.bigpond.com [203.38.21.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "", Issuer "Openwave Messaging Inc." (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQfrn3sVgz4kb1 for ; Fri, 8 Oct 2021 07:26:49 +0000 (UTC) (envelope-from chrisj@rtems.org) Received: from smtp.telstra.com ([10.10.24.4]) by nsstlfep19p-svc.bpe.nexus.telstra.com.au with ESMTP id <20211008072638.IYTE6690.nsstlfep19p-svc.bpe.nexus.telstra.com.au@smtp.telstra.com>; Fri, 8 Oct 2021 18:26:38 +1100 X-RG-Spam: Unknown X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvtddrudelledguddufecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfupfevtfgpvffgnffuvffttedpqfgfvfenuceurghilhhouhhtmecugedttdenucenucfjughrpefkffggfgfuvfhfhfhojggtgfesthejredttdefjeenucfhrhhomhepvehhrhhishculfhohhhnshcuoegthhhrihhsjhesrhhtvghmshdrohhrgheqnecuggftrfgrthhtvghrnhepkeehudegveejuedvkeeiieelleeijeeugeektefhfeeiveefgeelgfefueeugfdtnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppedufeelrddufedtrddvgeehrddvtddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghlohepmhgrihhlrdgtohhnthgvmhhpohhrrghrhidrnhgvthdrrghupdhinhgvthepudefledrudeftddrvdeghedrvddttddpmhgrihhlfhhrohhmpegthhhrihhsjhesrhhtvghmshdrohhrghdprhgtphhtthhopehfrhgvvggsshguqdhhrggtkhgvrhhsseguihhnohdrshhkpdhrtghpthhtohepfhhrvggvsghsugdqhhgrtghkvghrshesfhhrvggvsghsugdrohhrgh X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean X-RG-VS-CLASS: clean Received: from mail.contemporary.net.au (139.130.245.200) by smtp.telstra.com (5.8.716.02) id 610B5E210D62B58D; Fri, 8 Oct 2021 18:26:37 +1100 Received: from [10.10.11.2] ([10.10.11.2]) (authenticated bits=0) by mail.contemporary.net.au (8.15.2/8.15.2) with ESMTPSA id 1987QWJn094995 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 8 Oct 2021 18:26:34 +1100 (EST) (envelope-from chrisj@rtems.org) Message-ID: <6510e27f-29f0-37a8-37b5-3b5b4e297b65@rtems.org> Date: Fri, 8 Oct 2021 18:26:32 +1100 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 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Persistent USB serial? Content-Language: en-AU To: Milan Obuch , freebsd-hackers@freebsd.org References: <20211008080016.7830e3d5@zeta.dino.sk> From: Chris Johns Organization: https://www.rtems.org/ In-Reply-To: <20211008080016.7830e3d5@zeta.dino.sk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-104.9 required=2.7 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,USER_IN_WELCOMELIST,USER_IN_WHITELIST autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on corb.contemporary.net.au X-Rspamd-Queue-Id: 4HQfrn3sVgz4kb1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 8/10/21 5:00 pm, Milan Obuch wrote: > I'd like to solicit opinions/hints for following scenario, which is > quite common currently. > > There are some development and evaluation boards designed with USB port > as power source and serial console at the same time (sometimes even > more ports or JTAG as well). When board has power on switch, usually no > activity is present on USB wire without board being powered - there is > some USB-to-UART circuitry powered from board power source. So serial > port device /dev/cuaUn et al. get created only after power on of the > board. > > Problem: port number can be different depending on USB port enumeration > or connection order. Another one: it is easy to miss first characters > sent from the board if you are not able to write required command like > 'cu -l /dev/cuaU9 -s 115200' quickly. > > Maybe it is possible to write some devd config file snippet which > ensures consistent device naming without need of maintaining correct > (everytime the same) order of cable connecting, but even that, this > does not solve second problem, starting up some terminal or terminal > like program in time. > > Has anybody some experience in this area who can share it? Some hints > what to test? Do we have some pseudo serial device, which can be used > as device argument for cu command, which can just grab the real USB > serial when it appears on connecting the board under test? It is something I have just had to live with it and with RTEMS we suggest using `ser2net` [1] to handle the connection. I see consistent enumerations once connected if the USB ports are not moved. You could then wrap the telnet connection in something that hammers the connection as fast as you need to pick up characters. It is not prefect but it is ok and simple to implement. The actual issue is usually a bug in the USB UART circuit on the target. Chris [1] I recently raised a bug against ser2net on FreeBSD .. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258382 From nobody Fri Oct 8 07:34:13 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 5D9E812D612B for ; Fri, 8 Oct 2021 07:34:24 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQg1W4MXxz4m5f for ; Fri, 8 Oct 2021 07:34:23 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mailhost.netlabit.sk with ESMTPSA; Fri, 08 Oct 2021 09:34:21 +0200 id 00DCA813.615FF47D.000149AD Date: Fri, 8 Oct 2021 09:34:13 +0200 From: Milan Obuch To: freebsd-hackers@freebsd.org Subject: Re: Persistent USB serial? Message-ID: <20211008093413.19e7acd2@zeta.dino.sk> In-Reply-To: <20211008072537.vytjzyqol5cksy5d@nerd-thinkpad.local> References: <20211008080016.7830e3d5@zeta.dino.sk> <20211008072537.vytjzyqol5cksy5d@nerd-thinkpad.local> X-Mailer: Claws Mail 3.18.0git266 (GTK+ 2.24.33; i386-portbld-freebsd11.4) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HQg1W4MXxz4m5f X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk X-Spamd-Result: default: False [-2.13 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.83)[-0.831]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5578, ipnet:84.245.64.0/18, country:SK]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N On Fri, 8 Oct 2021 09:25:37 +0200 Daniel Ebdrup Jensen wrote: > On Fri, Oct 08, 2021 at 08:00:16AM +0200, Milan Obuch wrote: > >Hi, > > > >I'd like to solicit opinions/hints for following scenario, which is > >quite common currently. > > > >There are some development and evaluation boards designed with USB > >port as power source and serial console at the same time (sometimes > >even more ports or JTAG as well). When board has power on switch, > >usually no activity is present on USB wire without board being > >powered - there is some USB-to-UART circuitry powered from board > >power source. So serial port device /dev/cuaUn et al. get created > >only after power on of the board. > > > >Problem: port number can be different depending on USB port > >enumeration or connection order. Another one: it is easy to miss > >first characters sent from the board if you are not able to write > >required command like 'cu -l /dev/cuaU9 -s 115200' quickly. > > > >Maybe it is possible to write some devd config file snippet which > >ensures consistent device naming without need of maintaining correct > >(everytime the same) order of cable connecting, but even that, this > >does not solve second problem, starting up some terminal or terminal > >like program in time. > > > >Has anybody some experience in this area who can share it? Some hints > >what to test? Do we have some pseudo serial device, which can be used > >as device argument for cu command, which can just grab the real USB > >serial when it appears on connecting the board under test? > > > >Regards, > >Milan > > > > Hi Milan, > > There's an open review [1] for location-based unit numbering for USB, > which some of us have been using for quite some time - and while it's > not completely done, it's very useful. > > Yours, > Daniel Ebdrup Jensen > > 1: https://reviews.freebsd.org/D21886 Thanks for pointer, I'll try to evaluate. This does not give me a full solution, if I understand it right - I can have some unique name for a given USB serial port instance, but I still must write my command to attach to this port quickly in order to not miss first characters sent over this port, right? Regards, Milan From nobody Fri Oct 8 07:40:58 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 8385112D7DFF for ; Fri, 8 Oct 2021 07:41:11 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQg9L4FgJz4nvd for ; Fri, 8 Oct 2021 07:41:10 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mailhost.netlabit.sk with ESMTPSA; Fri, 08 Oct 2021 09:41:08 +0200 id 00DCA808.615FF614.00014A44 Date: Fri, 8 Oct 2021 09:40:58 +0200 From: Milan Obuch To: freebsd-hackers@freebsd.org Subject: Re: Persistent USB serial? Message-ID: <20211008094058.0c0bd17f@zeta.dino.sk> In-Reply-To: <6510e27f-29f0-37a8-37b5-3b5b4e297b65@rtems.org> References: <20211008080016.7830e3d5@zeta.dino.sk> <6510e27f-29f0-37a8-37b5-3b5b4e297b65@rtems.org> X-Mailer: Claws Mail 3.18.0git266 (GTK+ 2.24.33; i386-portbld-freebsd11.4) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HQg9L4FgJz4nvd X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk X-Spamd-Result: default: False [-2.13 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.83)[-0.832]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5578, ipnet:84.245.64.0/18, country:SK]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N On Fri, 8 Oct 2021 18:26:32 +1100 Chris Johns wrote: > On 8/10/21 5:00 pm, Milan Obuch wrote: > > I'd like to solicit opinions/hints for following scenario, which is > > quite common currently. > > > > There are some development and evaluation boards designed with USB > > port as power source and serial console at the same time (sometimes > > even more ports or JTAG as well). When board has power on switch, > > usually no activity is present on USB wire without board being > > powered - there is some USB-to-UART circuitry powered from board > > power source. So serial port device /dev/cuaUn et al. get created > > only after power on of the board. > > > > Problem: port number can be different depending on USB port > > enumeration or connection order. Another one: it is easy to miss > > first characters sent from the board if you are not able to write > > required command like 'cu -l /dev/cuaU9 -s 115200' quickly. > > > > Maybe it is possible to write some devd config file snippet which > > ensures consistent device naming without need of maintaining correct > > (everytime the same) order of cable connecting, but even that, this > > does not solve second problem, starting up some terminal or terminal > > like program in time. > > > > Has anybody some experience in this area who can share it? Some > > hints what to test? Do we have some pseudo serial device, which can > > be used as device argument for cu command, which can just grab the > > real USB serial when it appears on connecting the board under test? > > > > It is something I have just had to live with it and with RTEMS we > suggest using `ser2net` [1] to handle the connection. I see > consistent enumerations once connected if the USB ports are not > moved. You could then wrap the telnet connection in something that > hammers the connection as fast as you need to pick up characters. It > is not prefect but it is ok and simple to implement. > > The actual issue is usually a bug in the USB UART circuit on the > target. > > Chris > > [1] I recently raised a bug against ser2net on FreeBSD .. > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258382 > I have no idea what ser2net does, I'll check what it is and how I can possibly use it. Thanks for pointer. Regards, Milan From nobody Fri Oct 8 07:58:40 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 9629D12DA1CA for ; Fri, 8 Oct 2021 07:59:16 +0000 (UTC) (envelope-from m.e.sanliturk@gmail.com) Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4HQgZD3hnnz4qGH for ; Fri, 8 Oct 2021 07:59:16 +0000 (UTC) (envelope-from m.e.sanliturk@gmail.com) Received: by mail-vs1-xe2c.google.com with SMTP id g10so9587843vsb.8 for ; Fri, 08 Oct 2021 00:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KZHzRv00KPAvvqt4NDe4fiPSRhsCComxOs53qG1fxWk=; b=B9cYXIZaAZa810DMnvrXNGILaazoJZRI7/WpgQay7sGZVk38r9pVWZaBEgQ0zm8flC Wk6vVJL/4imn5REUQGuptTzpHLQdPU7MR+VndwF6Vy7RMFHdyQcL23lm/76BDTrgE1kF Bcmk2Dcs8f5M2+2pXICP1hBS0UZT64bXIPqB9ZcGM10YJbnWF9viRTKdX24U58EYHbZ3 SGR85BIwkDJkgvvxupzqOa31YIxl4luEfiiThluBJT0uSQEzda4e/Hobna4jg4DiD0nZ lZWqyRh1mY7WyI/8lsVJqhyKj08YNDP7mqmZ4DNEUCbZKoBlcOA8wlNoP0riNiw8hMSY YCGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KZHzRv00KPAvvqt4NDe4fiPSRhsCComxOs53qG1fxWk=; b=kk6CoeedSogr49Rt6boRxCM7qLlNJ5kad5yGMa0gPz4ARJ7ogpzDPMOQ4irM1paUNR Ot0TynTw3JS24Zc+trH/OySVx9UmvYE2yzllM7aWo3V5Sv5jH+A8bvHCPFpxAl/mZtrQ eBMA/z+z7FDHaJ3ObSLFW0iB086IoIybyZ8p84s5ASnZHjX1KUgl8ciyMQFOeqHYQPIs gSg9yWBZj5cLAe2XydrbYBTgrmwal/E1GjWmuYjR76irvCY6zc9j8hNidEYw6kgI7eSc VS7PQyyy+aMYnR4FLOZ90uX9PWlTFrC5d5f3X1KKnWA9SZI4cmhaMgftTTTYrm+OQpWi xz6g== X-Gm-Message-State: AOAM532CFF8xW34MgeAu0+VxPrPT6WwJ5PA+LgTIS5l7OcGN5vo0kOaJ aM/pc09Dp4V106vudZ+UQUzW9s8AKW+WVAYlHV7WS0WN X-Google-Smtp-Source: ABdhPJyOXLfAJmXsxROkn7xYFRpdw0YwBZrMZqEbcuOk6MRxGtCsK7I1RZI8KpivB+WavFii8kE+Ih3xYtK7BpB3Sz4= X-Received: by 2002:a05:6102:722:: with SMTP id u2mr9007178vsg.57.1633679956177; Fri, 08 Oct 2021 00:59:16 -0700 (PDT) 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 References: <20211008080016.7830e3d5@zeta.dino.sk> In-Reply-To: <20211008080016.7830e3d5@zeta.dino.sk> From: Mehmet Erol Sanliturk Date: Fri, 8 Oct 2021 10:58:40 +0300 Message-ID: Subject: Re: Persistent USB serial? To: Milan Obuch Cc: FreeBSD Hackers Content-Type: multipart/alternative; boundary="00000000000076f57505cdd2c14c" X-Rspamd-Queue-Id: 4HQgZD3hnnz4qGH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: Y --00000000000076f57505cdd2c14c Content-Type: text/plain; charset="UTF-8" On Fri, Oct 8, 2021 at 9:01 AM Milan Obuch wrote: > Hi, > > I'd like to solicit opinions/hints for following scenario, which is > quite common currently. > > There are some development and evaluation boards designed with USB port > as power source and serial console at the same time (sometimes even > more ports or JTAG as well). When board has power on switch, usually no > activity is present on USB wire without board being powered - there is > some USB-to-UART circuitry powered from board power source. So serial > port device /dev/cuaUn et al. get created only after power on of the > board. > > Problem: port number can be different depending on USB port enumeration > or connection order. Another one: it is easy to miss first characters > sent from the board if you are not able to write required command like > 'cu -l /dev/cuaU9 -s 115200' quickly. > > Maybe it is possible to write some devd config file snippet which > ensures consistent device naming without need of maintaining correct > (everytime the same) order of cable connecting, but even that, this > does not solve second problem, starting up some terminal or terminal > like program in time. > > Has anybody some experience in this area who can share it? Some hints > what to test? Do we have some pseudo serial device, which can be used > as device argument for cu command, which can just grab the real USB > serial when it appears on connecting the board under test? > > Regards, > Milan > > I am not using the following idea , but my opinion on that case is as follows : Assume that there is a list of ports to be defined such as USB , PCI , RS-232 , etc . If the board is a new one ( Boot the computer and obtain the above list . Make it a configuration file with ASSIGNED suitable port numbers by the user . ) otherwise use a previously prepared configuration . When the computer starts to boot , it looks at the above file . If it is present , ( without fancy mount operations by the user ) loads it and uses port numbersspecified in the given list . If it is not present , the computer uses its own defaults . In case of specified port numbers ( or names , labeling is not important ) , it uses giving numbers , causing repeatable boot sequences and the related scripts , etc. can continue as specified without being broken . Perhaps , such an application requires some changes in the boot processing sources which these are beyond my knowledge . Mehmet Erol Sanliturk --00000000000076f57505cdd2c14c-- From nobody Fri Oct 8 14:20:23 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 DEA1C12DD529 for ; Fri, 8 Oct 2021 14:20:28 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (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 4HQr2445dMz4XVP for ; Fri, 8 Oct 2021 14:20:28 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1633702827; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=sOGAbVyRKJ0WRypaLf7ib6LlSMvG5kQPKPV0PGg6S/AQOncebPw1HtzqKc+jrVeBVjp1R8xEZ0gXs wsC+VsL7mJOt9AkbYuAnkcc+o0311SQLlF4Y3IzGnx457qdpDEkbava03jb7r3B/ZHAYbr9J6T8uuB MXE09j6IVO6LoVsJBezzC/Ujktw1WNip8eallq5j8NhY/X0U/8R7WabTxYygCICMhcw1x8WjjkBF/f r/VhQbvjuTyLP4mzVO1zGeUv7LYg2eQK+4UPlS3np6IkqqlDc0JnNPQelCrDh4lqzuleS2njS8K5sU iNfCvv+X4YtVUwEsi0y8qSOLwJfrh/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=i8TVUjKoiXGFY1qKe1p93IIHKsz4kKv9uWLXZNkaDkc=; b=t2BUEdL8MiZwOwgyyGuTmPce4ARkIbueY70ObSARs9KpWxa8U2E8vhrCtBnC0estadYsuvEr2yYyC 6SkyqOsTuBAvVMgXsqeKh5L0spQX6KrKxl+/CrZRKK1wN9W+oXvMPdH7/Drg+x+jc6M9ktEbYSySfg d65RQFDIi+VTJQPSz5Zzg3c2pFtOFK0WMpcvsQ3vpvRG/TlR0nxWSvjyIEtWQr6jm4wEKzBlQOTlQq 1aFe3V/01oDGS76cmGsAAcxKVPCf/MEm7TU8Cflbf+H0IEX30tek7AInH9md1beMizQg3kpNcs9jSk Axo4GAEAIQmxud0Fm/GkHM1LNDUwdlg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=i8TVUjKoiXGFY1qKe1p93IIHKsz4kKv9uWLXZNkaDkc=; b=vAmf6MSWCoECnZo7f7/DthK0mCqJC1BfJUow7C7dKoB8iHrMktLbdEfR4vMsqF8hbEBkJkaIpLuhR LMv97nD5YjyXy+kt39YTGB3k9ul8YpSOpjx1v36AbCg0/+2w6iVyo5icnWRsbIkxj/9NC0P0uNWYM2 wtKI6b7zI0sY6HXO1hNAAyT7QdAbqOU0B7fWLTbmFZYU6x5swfM8O8OKKrwFgSwfvWZdSi3sxfagsT 6H7wY+mnKWcwXvrgo4/z7/+ufCn38fdBI0d9M1wHyxu3q3ZPPyjd4wJEeBISETq6XglVkuaRCoQNRE yVkZQ+rueAVx5u1VFENCUDW+P/1P71A== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: e0dbc496-2842-11ec-9b08-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id e0dbc496-2842-11ec-9b08-bf9d68d023b6; Fri, 08 Oct 2021 14:20:26 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 198EKNvj025481; Fri, 8 Oct 2021 08:20:24 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <11af95cf3d72616823ed5ce3113b33c5154a4775.camel@freebsd.org> Subject: Re: Persistent USB serial? From: Ian Lepore To: Milan Obuch , freebsd-hackers@freebsd.org Date: Fri, 08 Oct 2021 08:20:23 -0600 In-Reply-To: <20211008080016.7830e3d5@zeta.dino.sk> References: <20211008080016.7830e3d5@zeta.dino.sk> Content-Type: text/plain; charset="ASCII" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team 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 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HQr2445dMz4XVP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 2021-10-08 at 08:00 +0200, Milan Obuch wrote: > Hi, > > I'd like to solicit opinions/hints for following scenario, which is > quite common currently. > > There are some development and evaluation boards designed with USB > port > as power source and serial console at the same time (sometimes even > more ports or JTAG as well). When board has power on switch, usually > no > activity is present on USB wire without board being powered - there > is > some USB-to-UART circuitry powered from board power source. So serial > port device /dev/cuaUn et al. get created only after power on of the > board. > > Problem: port number can be different depending on USB port > enumeration > or connection order. Another one: it is easy to miss first characters > sent from the board if you are not able to write required command > like > 'cu -l /dev/cuaU9 -s 115200' quickly. > > Maybe it is possible to write some devd config file snippet which > ensures consistent device naming without need of maintaining correct > (everytime the same) order of cable connecting, but even that, this > does not solve second problem, starting up some terminal or terminal > like program in time. > > Has anybody some experience in this area who can share it? Some hints > what to test? Do we have some pseudo serial device, which can be used > as device argument for cu command, which can just grab the real USB > serial when it appears on connecting the board under test? > > Regards, > Milan > If the device on the other side of the usb serial adapter is already sending data when you attach the adapter to the freebsd system, you will lose data and/or get corrupted data. There is nothing you can do about it. Opening a usb-serial device involves a 100ms sleep (in usb_serial.c). For every config command sent to the device (change speed, change line parameters such as asserting DTR), there is another 100ms sleep. Because of the freebsd line config mechanisms (.init and .lock files) there is a surprising amount of config traffic that happens when you open a tty device -- it configures everything based on .init and .lock files, then the app opening the device will reconfigure everything again. For usb serial you can see all that happening with usbdump(8). A 115200 connection is roughly 11 kbytes data per second, and it takes up to a second to open a usb-serial device. The ftdi on-chip fifo is only 384 bytes on the older-generation chips (the common ones), and even on the modern H-series chips the fifo is only 2K or 4K depending on chip model. So the fifo can't hold enough data to capture everything arriving during during the open-and-config sequence. Even if it could, some of the data would have arrived at the wrong line speed and will just be garbage. -- Ian From nobody Sat Oct 9 19:41:28 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 0D36D17E0242 for ; Sat, 9 Oct 2021 19:41:37 +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 4HRb682PRzz4VCX for ; Sat, 9 Oct 2021 19:41:36 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from sslproxy03.your-server.de ([88.198.220.132]) by dedi548.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mZIDp-000GaE-DZ for freebsd-hackers@freebsd.org; Sat, 09 Oct 2021 21:41:29 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mZIDp-000UZA-Ab for freebsd-hackers@freebsd.org; Sat, 09 Oct 2021 21:41:29 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 10F3E480082 for ; Sat, 9 Oct 2021 21:41:29 +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 j38dUGB4ncGX for ; Sat, 9 Oct 2021 21:41:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id B708A480107 for ; Sat, 9 Oct 2021 21:41:28 +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 xYbz3OB8hmuc for ; Sat, 9 Oct 2021 21:41:28 +0200 (CEST) Received: from [10.10.171.10] (unknown [10.10.171.10]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 96EF2480082 for ; Sat, 9 Oct 2021 21:41:28 +0200 (CEST) To: freebsd-hackers@freebsd.org From: Sebastian Huber Subject: Why was the timehands_count sysctl added? Message-ID: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> Date: Sat, 9 Oct 2021 21:41:28 +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 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/26317/Sat Oct 9 10:19:24 2021) X-Rspamd-Queue-Id: 4HRb682PRzz4VCX 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 [-0.21 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:85.10.215.148]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_MEDIUM(-0.98)[-0.985]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_SHORT(-0.86)[-0.859]; NEURAL_SPAM_LONG(0.93)[0.930]; DMARC_NA(0.00)[embedded-brains.de]; ARC_NA(0.00)[]; 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, I synchronize currently the port of the FreeBSD timecounters to RTEMS=20 and came across a change in 2019 which I do not understand. Some time=20 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 The corresponding sysctl is not documented: https://www.freebsd.org/cgi/man.cgi?query=3Dtimecounters&sektion=3D4 Does someone know why this sysctl to select the count of timehands was=20 added? Is this a performance optimization for some systems? Best regards, Sebastian --=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/ From nobody Sat Oct 9 19:55:13 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 5211117E2134 for ; Sat, 9 Oct 2021 19:55:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4HRbQ66qYNz4WnY for ; Sat, 9 Oct 2021 19:55:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 199JtD8H012056 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 9 Oct 2021 22:55:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 199JtD8H012056 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 199JtDon012055; Sat, 9 Oct 2021 22:55:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 9 Oct 2021 22:55:13 +0300 From: Konstantin Belousov To: Sebastian Huber Cc: freebsd-hackers@freebsd.org Subject: Re: Why was the timehands_count sysctl added? Message-ID: References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HRbQ66qYNz4WnY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 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=timecounters&sektion=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. From nobody Sat Oct 9 20:54:30 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 746DC17EA9FA for ; Sat, 9 Oct 2021 20:54:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4HRckd2jQ9z4fmq for ; Sat, 9 Oct 2021 20:54:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa2f.google.com with SMTP id j38so3516101vkd.10 for ; Sat, 09 Oct 2021 13:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P7rRh9vIICVnAuNATfEErfjpasmcal9LTV7Pen78AXM=; b=iZ7duXNwRj0/SxwXXZt3LZa8j5V52TbFhb+GgRje183h1TL6x2u7Z88daBAsZjJRL5 mQl/ipFqXVnU/zgRV4PXCWUyN9S68tzxHXw7aFK80DFXtfhrtOJD+MdCu0rZ3ePtkG5u SRxR6bM4MWc3SDo0jatn2cjf2CL5gM7co+savgB/CswdFZBVZh9RlnQ9Ni4NWzEJge07 eaj6Lk0lCgv1mPJ2X6BViwzUruW2mkqD7oFtQv/KInWMoYJq0NBh2285X5dKNeyvhi4+ JC8MMBKethQyBIkgd4dzK8Ttg8GsSen8OTfPzP+ButJH6IY1kOksMJqw9237ckGzmKtm QgIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P7rRh9vIICVnAuNATfEErfjpasmcal9LTV7Pen78AXM=; b=QO8/2yLj2UfoHJ6KwZSd1CQgZItar6S4TH4PcNLMolOUc8Zvu+zLWK2jaIisaAFnn4 E8QeZpqAiC3rZ8rq3OYpVcznsQCsvziL/Jfd6Bgr73Oz/UFzBXKOwV6VbmaoYN9ivJIo VN7bJ1i5fwcvV6UkaqEcvffnnyKfKI7lVMmBoeYgplnC7tf8TNw3hVTbQYJ7RGh7uKQC +A8idwSjQ57cVZ/B2rx9e7NOSV1s915TW4EoT4KrMTdcAOV8TzIBz5J+Vb2iW72tSjhl bPJk3ZT5+wp2OVv5JWbmA/R/Jc7sNAPpEuql/9Xqe6JaJSvM6R0JZlacY18D4nFLIdAB AQhQ== X-Gm-Message-State: AOAM531m8fFOhxja444Fyy75oDQwOO93UxKodE5cLfYUDAMlgAJZxGC7 44UZm2Axzt/lciidY8Z7ygvvmXpLqZTOMhzO9AFOrQ== X-Google-Smtp-Source: ABdhPJzmdRZw9a6K9ipf1t6oDYPuAd6/b2dxOgu64mxwQExWytRVvVRJPb3MnKl/t9vGTQoaXDXpT8JhxC0w1qzDqt0= X-Received: by 2002:a05:6122:c95:: with SMTP id ba21mr6946766vkb.22.1633812882575; Sat, 09 Oct 2021 13:54:42 -0700 (PDT) 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 References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> In-Reply-To: From: Warner Losh Date: Sat, 9 Oct 2021 14:54:30 -0600 Message-ID: Subject: Re: Why was the timehands_count sysctl added? To: Konstantin Belousov Cc: Sebastian Huber , FreeBSD Hackers Content-Type: multipart/alternative; boundary="0000000000007ee9d405cdf1b484" X-Rspamd-Queue-Id: 4HRckd2jQ9z4fmq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --0000000000007ee9d405cdf1b484 Content-Type: text/plain; charset="UTF-8" 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=timecounters&sektion=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 > --0000000000007ee9d405cdf1b484-- From nobody Sat Oct 9 21:07:29 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 2461317ED15B for ; Sat, 9 Oct 2021 21:07:39 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (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 4HRd1Q6pPXz4hmG for ; Sat, 9 Oct 2021 21:07:38 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 538E689290; Sat, 9 Oct 2021 21:07:30 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.16.1/8.16.1) with ESMTPS id 199L7UDJ059129 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 9 Oct 2021 21:07:30 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.16.1/8.16.1/Submit) id 199L7T4j059128; Sat, 9 Oct 2021 21:07:29 GMT (envelope-from phk) Message-Id: <202110092107.199L7T4j059128@critter.freebsd.dk> To: Warner Losh cc: Konstantin Belousov , Sebastian Huber , FreeBSD Hackers Subject: Re: Why was the timehands_count sysctl added? In-reply-to: From: "Poul-Henning Kamp" References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> 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 Content-Type: text/plain; charset="us-ascii" Content-ID: <59126.1633813649.1@critter.freebsd.dk> Date: Sat, 09 Oct 2021 21:07:29 +0000 X-Rspamd-Queue-Id: 4HRd1Q6pPXz4hmG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N -------- Warner Losh writes: > > 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? The reason there were originally 10 timehands was that latency in the early SMP kernels was ... ehh ... variable ... and some of the time-counters rolled over quite fast compared to that. I really hope no relevant current hardware has that problem. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From nobody Sat Oct 9 21:21:39 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 CF1E817EEFE1 for ; Sat, 9 Oct 2021 21:21:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4HRdKn3fRyz4kgT for ; Sat, 9 Oct 2021 21:21:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 199LLe9w033850 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 10 Oct 2021 00:21:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 199LLe9w033850 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 199LLdxZ033849; Sun, 10 Oct 2021 00:21:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 10 Oct 2021 00:21:39 +0300 From: Konstantin Belousov To: Poul-Henning Kamp Cc: Warner Losh , Sebastian Huber , FreeBSD Hackers Subject: Re: Why was the timehands_count sysctl added? Message-ID: References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> <202110092107.199L7T4j059128@critter.freebsd.dk> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202110092107.199L7T4j059128@critter.freebsd.dk> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HRdKn3fRyz4kgT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sat, Oct 09, 2021 at 09:07:29PM +0000, Poul-Henning Kamp wrote: > -------- > Warner Losh writes: > > > > 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? > > The reason there were originally 10 timehands was that latency in > the early SMP kernels was ... ehh ... variable ... and some of the > time-counters rolled over quite fast compared to that. > > I really hope no relevant current hardware has that problem. The current algorithm to read timehands is resilient to the wrap-out of the current hand. You really need to experience enourmous delays in the reader loop to make it lock-step with tc_windup() updates, in which case it could indeed be better to have more than two timehands. I believe it was Ian who reported that 16 timehands worked better for him than 2. From nobody Sun Oct 10 17:15:39 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 B600617DE9A3 for ; Sun, 10 Oct 2021 17:15:50 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2o.ore.mailhop.org (outbound2o.ore.mailhop.org [54.187.213.119]) (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 4HS7qV2q4Dz3LN8 for ; Sun, 10 Oct 2021 17:15:50 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1633886144; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=qHa1xW+LcYWXM0Vp5qAHBs8VpGNLDfe6ZCftC8QSf+OG/DHOYHolqZEL0qOoby+pdW+TpZr2SWipe nVihH/LqQjZDYWT62LzoNeWDEqA4ek0mIq5GJIEkrNm+y6hwYypRHmZpBVmd6mRKKlUgcfeufjjdwd vC1IPfmjevR6rl66YcpGDbonqn1Y7LLEitSrng/by23xH4y1FuJAiHc+Nz1StkCwNtq/hkNBf0iQ8W fMD3p2c8l9PhPAvMVK4m5sQcxkH0VUMpOcCgc/vHJyx3GazBs/TNVdei8ojQ/HCD3YfMMyAkRWRj6a noop+/z98z/PIZAs3u649ymoBrOe1SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=ZEuP4/08p10U6C+sSA/dMLWi+kbZSn0+mC6CaIdk85o=; b=UuZYpxezymK89EHDGyvAXG8O92IsKBqsblbSR7BSwonlcAoaixMaC3HxJIm+C9GOmA8RwCtlTpXWl HpopB+WpfVaMjKzrs1S1hQOiIZzACPaImJDjOVPLMhmRC5oRQD4zSDvy5+M2OKGOmP99PPwkGsP2iD BDYaFr0dPxj/C73LSdXtwbNpRWlS/c0EeAe8vuw/rBlcrgIwvbrpz2aGKPDgkz8lY0hiWyVEE4kqfH ud29ghxd5MvCif6wnZERRj38omRCpg+eRHUfY/iFEkcg/V6fR4UZ+ikPkz/Fhz0wZDErH7J5+/oYUh rydBpl+CKEr0IK9mhojvU8USjtQegbA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=ZEuP4/08p10U6C+sSA/dMLWi+kbZSn0+mC6CaIdk85o=; b=bLTyohy23tskohcZ11AFCr8fd/XiIFz+H11M4txBGcpucsPm54fbO+zJdR3sA+PkTgrdmTD2eHpmw PXr0kT1F2ILluwQRIbfKpXS7q9LoiLNOgRJl8aaOFwTemVxnv9j2VJKlOgLIjPI34fYARNPA+hdCB5 DPySQx1WG3MbG2Bqzqj3x6zlDgShx3ckEBrR+1ZKVIyQjT9yVNUI+2AY8SmOwsEtkxF4U8mlgaRl// 8cs1rmClOwz78HPoNnL923rU4oKqaj1w0h/XeGXBNsz/npZlO8rOM21dqyyztOP1Ja0mQ+sncxZHMv BOWT+msvJOrhqCfRgoG7SClPf+dSRVA== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: b19c790b-29ed-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id b19c790b-29ed-11ec-a67c-89389772cfc7; Sun, 10 Oct 2021 17:15:42 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19AHFdPC034355; Sun, 10 Oct 2021 11:15:39 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: Subject: Re: Why was the timehands_count sysctl added? From: Ian Lepore To: Warner Losh , Konstantin Belousov Cc: Sebastian Huber , FreeBSD Hackers Date: Sun, 10 Oct 2021 11:15:39 -0600 In-Reply-To: References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> Content-Type: text/plain; charset="ASCII" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team 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 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HS7qV2q4Dz3LN8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 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=timecounters&sektion=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. 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. I found that on a BeagleBone system. It takes a minimum of 3 timehands for it to work right. -- Ian From nobody Sun Oct 10 17:39:17 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 A623217E348C for ; Sun, 10 Oct 2021 17:39:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4HS8Lv2r7cz3QcG; Sun, 10 Oct 2021 17:39:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19AHdHoK053463 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 10 Oct 2021 20:39:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19AHdHoK053463 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19AHdHMm053462; Sun, 10 Oct 2021 20:39:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 10 Oct 2021 20:39:17 +0300 From: Konstantin Belousov To: Ian Lepore Cc: Warner Losh , Sebastian Huber , FreeBSD Hackers Subject: Re: Why was the timehands_count sysctl added? Message-ID: References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HS8Lv2r7cz3QcG 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 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=timecounters&sektion=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. 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. I found that on a > BeagleBone system. 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. From nobody Sun Oct 10 17:44:46 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 8AE9917E4315 for ; Sun, 10 Oct 2021 17:44:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2q.ore.mailhop.org (outbound2q.ore.mailhop.org [54.187.71.48]) (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 4HS8T31jdqz3hDW for ; Sun, 10 Oct 2021 17:44:55 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1633887889; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=dbXt6DYSSBCpdCJ1F2IdmO0HKSObmx0O6HRmuTimd4XWu+U4Ovl5u0NJbvF3rjknY3jSbQdw9GchD Ab/xvZVvXu8GN/hHUq6AgXqkJRT4SwPfRxvxkgxP2JIiVMWUDjml6VxFdFSvDgUHj2EZRQrAQ7ZPh8 KsT3Ai/zqzvTmCeD6dLYjgDKQTmH107Yb12b3ldaIOQKy0vrRaz7guqMVzdfZMGheHT/aV721vOzSj g1qhUkgNxnSvOE33Ig1+0iGyW993VaknKKS1bFpw7HGA1pheZzvOYpOKySpwZlCoboz23hZHHIQ3SZ 1fS7W75JlJ95djvUHV5C/cizHSklCZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=2v+MrO91ApjR61LvWa70wSf2YywEe3Z9ywfV3HcLtqI=; b=nYYYSD8uifDkqCHwsv5A0+U84bZeRnPHmGEigUTC2Xw3XGN0sDfgDgur6iSqaGWAqmZkCGP/Lki6E uFF78QRlYqtOQov4FaLrIGayzUV1BXTODXSX1yHeu0oe5RmwCX7xTEMnvT48W497aMGiDzDcAsV2dD mKzXF55dZoTy6EDCh10ACrT9IbJNO1sVrsICqTecMZa5xvrxLRRCshc82Mc3ICPfkZvCMXCSKREtpY 7H6nYRBQl2u/MwjywjkRfK687JiA0GN66Lv0JCno4XXImgIfj4qwo1dCQr3IcXbBqSD8zAt1p/Enbq w+L9zaRIHkU1PTppbM0miMYFrr5oSkg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=2v+MrO91ApjR61LvWa70wSf2YywEe3Z9ywfV3HcLtqI=; b=QfU5HmUiczoYL6t57FSU6SjjHmJLtLUorA8qG2xSNpUGqUmbv2j/0KuEUzKT5t0fHrL/4ck7sj2+Q pjxcAP9TXuZk8UpVRQoc5xz6NViXY0nEsrqni9OXtLiYGO/6KjsaHCrgvlAg25KvoNGr6m2Firqy6U SyZFC/OitIUtshH5GLNog6waILagVFNu+N1PvwAJC+DO6B7PFYFcFCQ2tLBQCjjRtmw5VTHyljFeM8 oE5vNs6XS5yIkzzqcnbqH78Gr1Ga9nvINJLVxgbrkYWus5WN/uUGn9AcRUviltWzZExCeyHOvIvrGE dEQ37q78M2eLiacrTzoNklXxudVRCIA== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: c2ab379a-29f1-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id c2ab379a-29f1-11ec-a67c-89389772cfc7; Sun, 10 Oct 2021 17:44:47 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19AHiks3034446; Sun, 10 Oct 2021 11:44:46 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <1e7b3766007ed6e35ff9f75f680b2e786b4355f9.camel@freebsd.org> Subject: Re: Why was the timehands_count sysctl added? From: Ian Lepore To: Konstantin Belousov Cc: Warner Losh , Sebastian Huber , FreeBSD Hackers Date: Sun, 10 Oct 2021 11:44:46 -0600 In-Reply-To: References: <2d1d2a6d-ec6b-7f52-8af3-09a833c52820@embedded-brains.de> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team 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 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HS8T31jdqz3hDW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 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=timecounters&sektion=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.  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.  I found that on a > > BeagleBone system.  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. -- Ian