From: Greg KH <gregkh@linuxfoundation.org>
To: "Måns Rullgård" <mans@mansr.com>
Cc: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] tty: serial: 8250_omap: fix TX with DMA for am33xx
Date: Wed, 14 May 2025 10:56:55 +0200 [thread overview]
Message-ID: <2025051425-thank-unbitten-d814@gregkh> (raw)
In-Reply-To: <yw1xldqzlh3n.fsf@mansr.com>
On Wed, May 14, 2025 at 09:41:16AM +0100, Måns Rullgård wrote:
> "Jiri Slaby (SUSE)" <jirislaby@kernel.org> writes:
>
> > Commit 1788cf6a91d9 ("tty: serial: switch from circ_buf to kfifo")
> > introduced an error in the TX DMA handling for 8250_omap.
> >
> > When the OMAP_DMA_TX_KICK flag is set, the "skip_byte" is pulled from
> > the kfifo and emitted directly in order to start the DMA. While the
> > kfifo is updated, dma->tx_size is not decreased. This leads to
> > uart_xmit_advance() called in omap_8250_dma_tx_complete() advancing the
> > kfifo by one too much.
> >
> > In practice, transmitting N bytes has been seen to result in the last
> > N-1 bytes being sent repeatedly.
> >
> > This change fixes the problem by moving all of the dma setup after the
> > OMAP_DMA_TX_KICK handling and using kfifo_len() instead of the DMA size
> > for the 4-byte cutoff check. This slightly changes the behaviour at
> > buffer wraparound, but it still transmits the correct bytes somehow.
> >
> > Now, the "skip_byte" would no longer be accounted to the stats. As
> > previously, dma->tx_size included also this skip byte, up->icount.tx was
> > updated by aforementioned uart_xmit_advance() in
> > omap_8250_dma_tx_complete(). Fix this by using the uart_fifo_out()
> > helper instead of bare kfifo_get().
> >
> > Based on patch by Mans Rullgard <mans@mansr.com>
> >
> > Fixes: 1788cf6a91d9 ("tty: serial: switch from circ_buf to kfifo")
> > Reported-by: Mans Rullgard <mans@mansr.com>
> > Cc: stable@vger.kernel.org
> >
> > ---
> > The same as for the original patch, I would appreaciate if someone
> > actually tests this one on a real HW too.
> >
> > A patch to optimize the driver to use 2 sgls is still welcome. I will
> > not add it without actually having the HW.
>
> Are you seriously expecting me to waste even more time on this?
> Do your damn job like you should have to begin with.
That type of response is not allowed here. Please refrain from this in
the future.
greg k-h
next prev parent reply other threads:[~2025-05-14 8:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 7:20 [PATCH] tty: serial: 8250_omap: fix TX with DMA for am33xx Jiri Slaby (SUSE)
2025-05-14 7:22 ` Jiri Slaby
2025-05-14 8:41 ` Måns Rullgård
2025-05-14 8:56 ` Greg KH [this message]
2025-05-14 9:53 ` Jiri Slaby
2025-05-21 11:38 ` Greg KH
2025-05-22 5:39 ` Jiri Slaby
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=2025051425-thank-unbitten-d814@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mans@mansr.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox