From: "Janusz Użycki" <j.uzycki@elproma.com.pl>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>,
Richard Genoud <richard.genoud@gmail.com>,
Fabio Estevam <festevam@gmail.com>,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Marek Vasut <marex@denx.de>
Subject: Re: [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals
Date: Sat, 27 Sep 2014 13:15:00 +0200 [thread overview]
Message-ID: <54269C34.8040702@elproma.com.pl> (raw)
In-Reply-To: <20140927105408.GD5182@n2100.arm.linux.org.uk>
W dniu 2014-09-27 12:54, Russell King - ARM Linux pisze:
> On Sat, Sep 27, 2014 at 12:33:16PM +0200, Janusz Użycki wrote:
>> Could somebody comment if DMA could be enabled also
>> if CTS/RTS is supported by GPIOs? Is it safe?
>> It would allow me to avoid ugly code in mxs_auart_settermios(),
>> as commented Russel King.
> Russel*L* please, otherwise you are giving me implicit permission to
> mis-spell your name.
Sorry. I will care about.
Many people change my name also from Janusz to Januzs.
>> Otherwise I have to keep backward compatibility on DMA
>> and HW flow control, and fix the ugly code.
>>
>> Marek Vasut:
>> "Why do you think DMA would do any good on long transfers without
>> flowcontrol."
> The problem with DMA without hardware flow control is that the UART
> transmission will run at full speed, with characters back to back.
>
> You will have a variable amount of latency when dealing with the CTS
> signal - interrupt handling latency in Linux can be quite variable.
> (I'm not sure whether this has improved recently, USB used to be
> particularly bad, causing 3+ ms latencies.)
>
> When CTS is deasserted, you have to pause the transmission as soon as
> possible to avoid overflowing the remote end. At 115200 baud, each
> character takes around 90us to be transmitted. If you are delayed in
> handling the CTS interrupt for 3ms, then you will have transmitted
> around 35 characters in that time, which could be enough to cause an
> overflow at the remote end.
>
> Since the idea of flow control is to prevent overruns/overflow at the
> receiver, this is far from ideal.
>
> If Linux had a way to handle flow control interrupts as a higher
> priority than other interrupts (especially interrupting an already
> in-progress interrupt handler) then having GPIOs as flow control
> signals would be a much saner proposition.
>
> Unfortunately, lockdep completely gets in the way of that.
It means it is possible but not in Linux today?
I think the problem is not interrupt delay, which is often much below 100us
(we get ~10us delay on DCD).
USB or PCIe are exceptions - interrupt is packed to frame by serialized
and even polled by USB controller.
Isn't the problem rather how to break DMA transmission fast?
Hardware flow control not always requires to stop transmission
immediately. Usually delay of some chars is acceptable if remote receiver
implements low/high water mark (overflow trigger lower than RX FIFO size).
best regards
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: j.uzycki@elproma.com.pl (Janusz Użycki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals
Date: Sat, 27 Sep 2014 13:15:00 +0200 [thread overview]
Message-ID: <54269C34.8040702@elproma.com.pl> (raw)
In-Reply-To: <20140927105408.GD5182@n2100.arm.linux.org.uk>
W dniu 2014-09-27 12:54, Russell King - ARM Linux pisze:
> On Sat, Sep 27, 2014 at 12:33:16PM +0200, Janusz U?ycki wrote:
>> Could somebody comment if DMA could be enabled also
>> if CTS/RTS is supported by GPIOs? Is it safe?
>> It would allow me to avoid ugly code in mxs_auart_settermios(),
>> as commented Russel King.
> Russel*L* please, otherwise you are giving me implicit permission to
> mis-spell your name.
Sorry. I will care about.
Many people change my name also from Janusz to Januzs.
>> Otherwise I have to keep backward compatibility on DMA
>> and HW flow control, and fix the ugly code.
>>
>> Marek Vasut:
>> "Why do you think DMA would do any good on long transfers without
>> flowcontrol."
> The problem with DMA without hardware flow control is that the UART
> transmission will run at full speed, with characters back to back.
>
> You will have a variable amount of latency when dealing with the CTS
> signal - interrupt handling latency in Linux can be quite variable.
> (I'm not sure whether this has improved recently, USB used to be
> particularly bad, causing 3+ ms latencies.)
>
> When CTS is deasserted, you have to pause the transmission as soon as
> possible to avoid overflowing the remote end. At 115200 baud, each
> character takes around 90us to be transmitted. If you are delayed in
> handling the CTS interrupt for 3ms, then you will have transmitted
> around 35 characters in that time, which could be enough to cause an
> overflow at the remote end.
>
> Since the idea of flow control is to prevent overruns/overflow at the
> receiver, this is far from ideal.
>
> If Linux had a way to handle flow control interrupts as a higher
> priority than other interrupts (especially interrupting an already
> in-progress interrupt handler) then having GPIOs as flow control
> signals would be a much saner proposition.
>
> Unfortunately, lockdep completely gets in the way of that.
It means it is possible but not in Linux today?
I think the problem is not interrupt delay, which is often much below 100us
(we get ~10us delay on DCD).
USB or PCIe are exceptions - interrupt is packed to frame by serialized
and even polled by USB controller.
Isn't the problem rather how to break DMA transmission fast?
Hardware flow control not always requires to stop transmission
immediately. Usually delay of some chars is acceptable if remote receiver
implements low/high water mark (overflow trigger lower than RX FIFO size).
best regards
Janusz
next prev parent reply other threads:[~2014-09-27 11:14 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-27 9:46 [PATCH v3] serial: mxs-auart: gpios as modem signals (dirty) Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 9:46 ` [PATCH 1/4] serial: mxs-auart: ctrl removed from mxs_auart_port Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 10:03 ` Russell King - ARM Linux
2014-09-27 10:03 ` Russell King - ARM Linux
2014-09-27 11:44 ` [PATCH] serial: mxs-auart: clean get_mctrl and set_mctrl Janusz Uzycki
2014-09-27 11:44 ` Janusz Uzycki
2014-09-27 9:46 ` [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 10:07 ` Russell King - ARM Linux
2014-09-27 10:07 ` Russell King - ARM Linux
2014-09-27 20:32 ` serial: mxs-auart: gpios as modem signals (dirty) Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 20:32 ` [PATCH 1/2] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 20:32 ` [PATCH 2/2] serial: mxs-auart: add interrupts for modem control lines Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 10:33 ` [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Użycki
2014-09-27 10:33 ` Janusz Użycki
2014-09-27 10:54 ` Russell King - ARM Linux
2014-09-27 10:54 ` Russell King - ARM Linux
2014-09-27 11:15 ` Janusz Użycki [this message]
2014-09-27 11:15 ` Janusz Użycki
2014-09-27 12:18 ` Russell King - ARM Linux
2014-09-27 12:18 ` Russell King - ARM Linux
2014-09-27 9:46 ` [PATCH 3/4] serial: mxs-auart: add interrupts for modem control lines Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-10-24 15:32 ` Richard Genoud
2014-10-24 15:32 ` Richard Genoud
2014-10-24 15:36 ` Janusz Użycki
2014-10-24 15:36 ` Janusz Użycki
2014-09-27 9:46 ` [PATCH 4/4] serial: mxs-auart: enable PPS support Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 12:47 ` Sergei Shtylyov
2014-09-27 12:47 ` Sergei Shtylyov
2014-09-27 13:36 ` [PATCH] " Janusz Uzycki
2014-09-27 13:36 ` Janusz Uzycki
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=54269C34.8040702@elproma.com.pl \
--to=j.uzycki@elproma.com.pl \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=marex@denx.de \
--cc=richard.genoud@gmail.com \
/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: link
Be 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.