From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Date: 2022-08-25 09:17:23
Add uart_xmit_advance() helper to handle circular xmit buffer
advancement + accounting of Tx'ed bytes. Use it to fix a few drivers
that previously lacked to accounting for DMA Tx.
Greg,
I've a another series on top this which is tty-next material making the
rest of the drivers to use uart_xmit_advance(). That series obviously
depends on the patch 1/3 of this series so if you end up putting these
3 patches into tty-linus, I'll need it to be merged into tty-next at
some point (I'm not in a big hurry with this so if you choose to delay
the merge, it's not a big deal).
Ilpo Järvinen (3):
serial: Create uart_xmit_advance()
serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
drivers/tty/serial/serial-tegra.c | 5 ++---
drivers/tty/serial/tegra-tcu.c | 2 +-
include/linux/serial_core.h | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
--
2.30.2
From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Date: 2022-08-25 09:17:32
A very common pattern in the drivers is to advance xmit tail
index and do bookkeeping of Tx'ed characters. Create
uart_xmit_advance() to handle it.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
include/linux/serial_core.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -616,6 +616,23 @@ struct uart_state {/* number of characters left in xmit buffer before we ask for more */#define WAKEUP_CHARS 256+/**+*uart_xmit_advance-AdvancexmitbufferandaccountTx'edchars+*@up:uart_portstructuredescribingtheport+*@chars:numberofcharacterssent+*+*Thisfunctionadvancesthetailofcircularxmitbufferbythenumberof+*@charstransmittedandhandlesaccountingoftransmittedbytes(into+*@up'sicount.tx).+*/+staticinlinevoiduart_xmit_advance(structuart_port*up,unsignedintchars)+{+structcirc_buf*xmit=&up->state->xmit;++xmit->tail=(xmit->tail+chars)&(UART_XMIT_SIZE-1);+up->icount.tx+=chars;+}+structmodule;structtty_driver;
From: Andy Shevchenko <hidden> Date: 2022-08-26 16:04:34
On Thu, Aug 25, 2022 at 12:19 PM Ilpo Järvinen
[off-list ref] wrote:
Add uart_xmit_advance() helper to handle circular xmit buffer
advancement + accounting of Tx'ed bytes. Use it to fix a few drivers
that previously lacked to accounting for DMA Tx.
For the whole series
Reviewed-by: Andy Shevchenko <redacted>
Thanks for fixing this issue.
Greg,
I've a another series on top this which is tty-next material making the
rest of the drivers to use uart_xmit_advance(). That series obviously
depends on the patch 1/3 of this series so if you end up putting these
3 patches into tty-linus, I'll need it to be merged into tty-next at
some point (I'm not in a big hurry with this so if you choose to delay
the merge, it's not a big deal).
Ilpo Järvinen (3):
serial: Create uart_xmit_advance()
serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
drivers/tty/serial/serial-tegra.c | 5 ++---
drivers/tty/serial/tegra-tcu.c | 2 +-
include/linux/serial_core.h | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
--
2.30.2
Add uart_xmit_advance() helper to handle circular xmit buffer
advancement + accounting of Tx'ed bytes. Use it to fix a few drivers
that previously lacked to accounting for DMA Tx.
Greg,
I've a another series on top this which is tty-next material making the
rest of the drivers to use uart_xmit_advance(). That series obviously
depends on the patch 1/3 of this series so if you end up putting these
3 patches into tty-linus, I'll need it to be merged into tty-next at
some point (I'm not in a big hurry with this so if you choose to delay
the merge, it's not a big deal).
From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Date: 2022-08-29 07:41:20
On Mon, 29 Aug 2022, Jiri Slaby wrote:
On 25. 08. 22, 11:17, Ilpo Järvinen wrote:
quoted
Add uart_xmit_advance() helper to handle circular xmit buffer
advancement + accounting of Tx'ed bytes. Use it to fix a few drivers
that previously lacked to accounting for DMA Tx.
Greg,
I've a another series on top this which is tty-next material making the
rest of the drivers to use uart_xmit_advance(). That series obviously
depends on the patch 1/3 of this series so if you end up putting these
3 patches into tty-linus, I'll need it to be merged into tty-next at
some point (I'm not in a big hurry with this so if you choose to delay
the merge, it's not a big deal).
Sure, I can hold off a while (as long as we're speaking of reasonable
timescales :-)). Looking into your patches, they also seemed to lack that
icount.tx++ thing.
--
i.
On 29. 08. 22, 9:41, Ilpo Järvinen wrote:> Looking into your patches, they also seemed to lack that> icount.tx++ thing.
Perhaps, you only overlooked it?
+ for (; (for_test) && (!tx_ready || tx_ready(port));
+ (for_post), port->icount.tx++) {
thanks,
--
js
suse labs
From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Date: 2022-08-29 07:54:55
On Mon, 29 Aug 2022, Jiri Slaby wrote:
On 29. 08. 22, 9:41, Ilpo Järvinen wrote:> Looking into your patches, they
also seemed to lack that> icount.tx++ thing.
Perhaps, you only overlooked it?
+ for (; (for_test) && (!tx_ready || tx_ready(port));
+ (for_post), port->icount.tx++) {
Ah, yes, I did (and its placement at the end of a multi-line for() didn't
help that much either for pick it up :-)).
--
i.
On Thu, Aug 25, 2022 at 12:17:05PM +0300, Ilpo Järvinen wrote:
A very common pattern in the drivers is to advance xmit tail
index and do bookkeeping of Tx'ed characters. Create
uart_xmit_advance() to handle it.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
This commit only adds a new function, it does not "Fix" anything :(
From: Andy Shevchenko <hidden> Date: 2022-08-30 12:39:42
On Tue, Aug 30, 2022 at 3:31 PM Greg Kroah-Hartman
[off-list ref] wrote:
On Thu, Aug 25, 2022 at 12:17:05PM +0300, Ilpo Järvinen wrote:
quoted
A very common pattern in the drivers is to advance xmit tail
index and do bookkeeping of Tx'ed characters. Create
uart_xmit_advance() to handle it.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
This commit only adds a new function, it does not "Fix" anything :(
I'm wondering how to tell stable maintainers about dependencies of
(not yet applied) patches? In practice I saw that contributors use
Fixes tag for the entire chain (for the preparatory patches + the real
fix) when it's not easy / in a nice way to rebase to have a one-patch
fix followed by refactoring, etc.
--
With Best Regards,
Andy Shevchenko
On Tue, Aug 30, 2022 at 03:38:27PM +0300, Andy Shevchenko wrote:
On Tue, Aug 30, 2022 at 3:31 PM Greg Kroah-Hartman
[off-list ref] wrote:
quoted
On Thu, Aug 25, 2022 at 12:17:05PM +0300, Ilpo Järvinen wrote:
quoted
A very common pattern in the drivers is to advance xmit tail
index and do bookkeeping of Tx'ed characters. Create
uart_xmit_advance() to handle it.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
This commit only adds a new function, it does not "Fix" anything :(
I'm wondering how to tell stable maintainers about dependencies of
(not yet applied) patches? In practice I saw that contributors use
Fixes tag for the entire chain (for the preparatory patches + the real
fix) when it's not easy / in a nice way to rebase to have a one-patch
fix followed by refactoring, etc.
It's as if no one has ever had this issue before and wrote it down for
all to read and know what to do in the future.
{sigh}
Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
If you don't know the git id, just use the subject line and it should
work the same.
greg "why even write documentation?" k-h
From: Andy Shevchenko <hidden> Date: 2022-08-30 12:55:42
On Tue, Aug 30, 2022 at 3:48 PM Greg Kroah-Hartman
[off-list ref] wrote:
On Tue, Aug 30, 2022 at 03:38:27PM +0300, Andy Shevchenko wrote:
quoted
On Tue, Aug 30, 2022 at 3:31 PM Greg Kroah-Hartman
[off-list ref] wrote:
quoted
On Thu, Aug 25, 2022 at 12:17:05PM +0300, Ilpo Järvinen wrote:
...
quoted
I'm wondering how to tell stable maintainers about dependencies of
(not yet applied) patches? In practice I saw that contributors use
Fixes tag for the entire chain (for the preparatory patches + the real
fix) when it's not easy / in a nice way to rebase to have a one-patch
fix followed by refactoring, etc.
It's as if no one has ever had this issue before and wrote it down for
all to read and know what to do in the future.
{sigh}
Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
If you don't know the git id, just use the subject line and it should
work the same.
greg "why even write documentation?" k-h
It's good we have it, thanks for writing!
From time to time even experienced developers need to re-read documentation.
--
With Best Regards,
Andy Shevchenko