From: Russell King - ARM Linux admin <linux@armlinux.org.uk> To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sascha Hauer <s.hauer@pengutronix.de>, Sergey Organov <sorganov@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Date: Mon, 22 Jul 2019 11:17:57 +0100 [thread overview] Message-ID: <20190722101757.GC1330@shell.armlinux.org.uk> (raw) In-Reply-To: <20190722100414.k5wp4osx3gtuhmnc@pengutronix.de> On Mon, Jul 22, 2019 at 12:04:14PM +0200, Uwe Kleine-König wrote: > Hello Russell, > > On Mon, Jul 22, 2019 at 10:57:21AM +0100, Russell King - ARM Linux admin wrote: > > However, RTS is not guaranteed to stop the remote end sending characters > > as soon as it is deasserted - 16550 relies on software noticing that > > CTS has changed, and even then it may have a FIFO full of characters > > already queued to be sent that will still be sent. > > > > So, disabling RTS just before changing the baud doesn't give any > > guarantees that a character won't be in the process of being received > > while we're changing the baud rate, which means disabling it doesn't > > actually gain us anything. > > <sarcasm>With that reasoning we can drop RTS driving completely. Let's > just assert it unconditionally.</sarcam> Please, I'm being serious. > Right, deasserting RTS doesn't help against long receive FIFOs or > senders that react slowly (or not at all), but still it's better than > nothing, isn't it? Not really. In the normal use case of RTS, RTS doesn't get deasserted when there is no buffer space available, but when the available buffer space reaches a low-threshold. Buffer space remains to allow the sender to react to the change of RTS state. In the case you are promoting, which is to deassert RTS and then immediately start changing the port settings, you are not giving any chance for the sender to react to that state change. You could even be mid-way through receiving a character from the remote end - and at 75 baud, a single character lasts around 133ms. Even if you wait 133ms, that doesn't mean that the remote end has finished sending. If the remote end has a 16 byte FIFO, you'd need to wait about 2.2 seconds. At faster baud rates, of course the delay gets shorter. Just deasserting RTS just before changing the port settings gains very little protection. You need a character-period based delay as well. If we do start adding delays, it means that changing the baud rate for a port set to 75 baud starts taking ages to complete if CRTSCTS is enabled, irrespective of the settings change mode that was requested by userspace. However, adding delays is likely to screw up various userspace applications, such as those that do need to change baud rate at specific points in their protocol. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk> To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sascha Hauer <s.hauer@pengutronix.de>, Sergey Organov <sorganov@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Date: Mon, 22 Jul 2019 11:17:57 +0100 [thread overview] Message-ID: <20190722101757.GC1330@shell.armlinux.org.uk> (raw) In-Reply-To: <20190722100414.k5wp4osx3gtuhmnc@pengutronix.de> On Mon, Jul 22, 2019 at 12:04:14PM +0200, Uwe Kleine-König wrote: > Hello Russell, > > On Mon, Jul 22, 2019 at 10:57:21AM +0100, Russell King - ARM Linux admin wrote: > > However, RTS is not guaranteed to stop the remote end sending characters > > as soon as it is deasserted - 16550 relies on software noticing that > > CTS has changed, and even then it may have a FIFO full of characters > > already queued to be sent that will still be sent. > > > > So, disabling RTS just before changing the baud doesn't give any > > guarantees that a character won't be in the process of being received > > while we're changing the baud rate, which means disabling it doesn't > > actually gain us anything. > > <sarcasm>With that reasoning we can drop RTS driving completely. Let's > just assert it unconditionally.</sarcam> Please, I'm being serious. > Right, deasserting RTS doesn't help against long receive FIFOs or > senders that react slowly (or not at all), but still it's better than > nothing, isn't it? Not really. In the normal use case of RTS, RTS doesn't get deasserted when there is no buffer space available, but when the available buffer space reaches a low-threshold. Buffer space remains to allow the sender to react to the change of RTS state. In the case you are promoting, which is to deassert RTS and then immediately start changing the port settings, you are not giving any chance for the sender to react to that state change. You could even be mid-way through receiving a character from the remote end - and at 75 baud, a single character lasts around 133ms. Even if you wait 133ms, that doesn't mean that the remote end has finished sending. If the remote end has a 16 byte FIFO, you'd need to wait about 2.2 seconds. At faster baud rates, of course the delay gets shorter. Just deasserting RTS just before changing the port settings gains very little protection. You need a character-period based delay as well. If we do start adding delays, it means that changing the baud rate for a port set to 75 baud starts taking ages to complete if CRTSCTS is enabled, irrespective of the settings change mode that was requested by userspace. However, adding delays is likely to screw up various userspace applications, such as those that do need to change baud rate at specific points in their protocol. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-07-22 10:17 UTC|newest] Thread overview: 154+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-14 7:28 [PATCH] serial: imx: fix RTS/CTS setting Sascha Hauer 2019-06-14 7:28 ` Sascha Hauer 2019-06-14 7:48 ` Uwe Kleine-König 2019-06-14 7:48 ` Uwe Kleine-König 2019-06-14 12:11 ` [PATCH RFC 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 1/7] serial: imx: fix locking in set_termios() Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 4/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-20 9:37 ` Sascha Hauer 2019-06-20 9:37 ` Sascha Hauer 2019-06-20 13:24 ` Sergey Organov 2019-06-20 13:24 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 5/7] serial: imx: set_termios(): preserve RTS state Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 13:05 ` Lothar Waßmann 2019-06-14 13:28 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-14 12:11 ` [PATCH RFC 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-06-14 12:11 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 1/7] serial: imx: fix locking in set_termios() Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-20 14:47 ` [PATCH RFC v1 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-06-20 14:47 ` Sergey Organov 2019-06-26 10:00 ` [PATCH RFC v1 0/7] serial: imx: fix RTS and RTS/CTS handling Sascha Hauer 2019-06-26 10:00 ` Sascha Hauer 2019-06-26 11:19 ` Sergey Organov 2019-06-26 11:19 ` Sergey Organov 2019-06-26 14:11 ` [PATCH v2 " Sergey Organov 2019-06-26 14:11 ` [PATCH v2 1/7] serial: imx: fix locking in set_termios() Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 5:05 ` Uwe Kleine-König 2019-06-27 5:05 ` Uwe Kleine-König 2019-06-26 14:11 ` [PATCH v2 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 5:05 ` Uwe Kleine-König 2019-06-27 5:05 ` Uwe Kleine-König 2019-06-26 14:11 ` [PATCH v2 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 5:26 ` Uwe Kleine-König 2019-06-27 5:26 ` Uwe Kleine-König 2019-06-27 5:58 ` Sergey Organov 2019-06-26 14:11 ` [PATCH v2 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 5:40 ` Uwe Kleine-König 2019-06-27 5:40 ` Uwe Kleine-König 2019-06-27 6:15 ` Sergey Organov 2019-06-26 14:11 ` [PATCH v2 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 5:47 ` Uwe Kleine-König 2019-06-27 5:47 ` Uwe Kleine-König 2019-06-27 6:16 ` Sergey Organov 2019-06-26 14:11 ` [PATCH v2 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 6:05 ` Uwe Kleine-König 2019-06-27 6:05 ` Uwe Kleine-König 2019-06-27 7:01 ` Sergey Organov 2019-06-26 14:11 ` [PATCH v2 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-06-26 14:11 ` Sergey Organov 2019-06-27 6:08 ` Uwe Kleine-König 2019-06-27 6:08 ` Uwe Kleine-König 2019-06-27 7:58 ` Sergey Organov 2019-07-04 13:00 ` [PATCH v3 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-07-04 13:00 ` [PATCH v3 1/7] serial: imx: fix locking in set_termios() Sergey Organov 2019-07-04 13:00 ` [PATCH v3 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov 2019-07-04 13:00 ` [PATCH v3 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov 2019-07-04 13:00 ` Sergey Organov 2019-07-04 13:00 ` [PATCH v3 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov 2019-07-04 13:00 ` Sergey Organov 2019-07-04 13:00 ` [PATCH v3 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-07-04 13:00 ` Sergey Organov 2019-07-04 13:00 ` [PATCH v3 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-07-04 13:00 ` Sergey Organov 2019-07-04 13:00 ` [PATCH v3 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-07-04 13:00 ` Sergey Organov 2019-07-19 8:47 ` [PATCH v4 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-07-19 8:47 ` [PATCH v4 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-07-19 8:47 ` Sergey Organov 2019-07-19 9:11 ` Uwe Kleine-König 2019-07-19 9:11 ` Uwe Kleine-König 2019-07-19 12:18 ` Sergey Organov 2019-07-19 14:31 ` Uwe Kleine-König 2019-07-19 14:31 ` Uwe Kleine-König 2019-07-19 15:13 ` Sergey Organov 2019-07-19 20:19 ` Uwe Kleine-König 2019-07-19 20:19 ` Uwe Kleine-König 2019-07-22 7:42 ` Sergey Organov 2019-07-22 7:51 ` Uwe Kleine-König 2019-07-22 7:51 ` Uwe Kleine-König 2019-07-22 9:20 ` Sergey Organov 2019-07-22 9:46 ` Uwe Kleine-König 2019-07-22 9:46 ` Uwe Kleine-König 2019-07-22 13:54 ` Sergey Organov 2019-07-22 16:47 ` Uwe Kleine-König 2019-07-22 16:47 ` Uwe Kleine-König 2019-07-22 9:57 ` Russell King - ARM Linux admin 2019-07-22 9:57 ` Russell King - ARM Linux admin 2019-07-22 10:04 ` Uwe Kleine-König 2019-07-22 10:04 ` Uwe Kleine-König 2019-07-22 10:17 ` Russell King - ARM Linux admin [this message] 2019-07-22 10:17 ` Russell King - ARM Linux admin 2019-07-19 8:47 ` [PATCH v4 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-07-19 8:47 ` Sergey Organov 2019-07-19 8:47 ` [PATCH v4 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-07-19 8:47 ` Sergey Organov 2019-07-22 9:22 ` [PATCH v5 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-07-22 9:22 ` [PATCH v5 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-07-22 9:54 ` Uwe Kleine-König 2019-07-22 9:54 ` Uwe Kleine-König 2019-07-22 13:57 ` Sergey Organov 2019-07-22 16:20 ` Uwe Kleine-König 2019-07-22 16:20 ` Uwe Kleine-König 2019-07-22 19:09 ` Sergey Organov 2019-07-22 9:22 ` [PATCH v5 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-07-22 9:22 ` [PATCH v5 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-07-22 19:22 ` [PATCH v6 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-07-22 19:22 ` [PATCH v6 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-07-22 19:22 ` [PATCH v6 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-07-22 20:24 ` Uwe Kleine-König 2019-07-22 20:24 ` Uwe Kleine-König 2019-07-23 9:20 ` Sergey Organov 2019-07-23 9:49 ` Uwe Kleine-König 2019-07-23 9:49 ` Uwe Kleine-König 2019-07-23 11:16 ` Sergey Organov 2019-07-23 11:30 ` Sergey Organov 2019-07-22 19:22 ` [PATCH v6 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-07-26 18:52 ` [PATCH v7 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov 2019-07-26 18:52 ` [PATCH v7 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov 2019-07-26 18:52 ` [PATCH v7 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov 2019-07-26 18:52 ` Sergey Organov 2019-07-26 18:52 ` [PATCH v7 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov 2019-07-26 18:52 ` Sergey Organov 2019-07-26 19:29 ` Uwe Kleine-König 2019-07-26 19:29 ` Uwe Kleine-König 2019-07-29 9:03 ` Sergey Organov 2019-07-29 9:29 ` Uwe Kleine-König 2019-07-29 9:29 ` Uwe Kleine-König
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190722101757.GC1330@shell.armlinux.org.uk \ --to=linux@armlinux.org.uk \ --cc=gregkh@linuxfoundation.org \ --cc=kernel@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-imx@nxp.com \ --cc=linux-serial@vger.kernel.org \ --cc=s.hauer@pengutronix.de \ --cc=sorganov@gmail.com \ --cc=u.kleine-koenig@pengutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.