Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tapio Reijonen" <tapio.reijonen@vaisala.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 2/4] serial: max310x: re-check the TX queue before the after-send hold
Date: Tue, 17 Nov 2026 06:21:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-218247@kernel.org> (raw)
In-Reply-To: <20261117-max310x-tx-fixes-v2-2-b395126fd23d@vaisala.com>

> max310x_delayed_stop_tx() decides that a software-timed RS-485 envelope
> is over when the transmit queue is empty and the chip's TX FIFO is
> empty. It tests the queue first, then reads TXFIFOLVL over the bus, and
> only then takes the port lock and arms the after-send hold. The bus read
> sleeps, under load for tens of milliseconds, and write() queues data
> under the port lock in that window. start_tx() finds the envelope in
> MAX310X_TX_SEND and does nothing but reschedule tx_work.
> 
> When the stop routine resumes it sees an empty chip FIFO and arms the
> hold on a queue that was empty before the read. The hold expires, the
> RTS release is scheduled, the rescheduled tx_work pushes the new data
> into the chip FIFO, and RTS drops while the chip is still shifting it
> out. The tail of the write leaves through a disabled transceiver. No
> FIFO overflows, so no counter moves; the loss is silent.
> 
> Seen on a MAX14830 behind a slow SPI path with 20 ms of before-send
> delay: 25-byte writes every 20 ms lost 1600 to 2200 bytes per port in
> five minutes in RS-485 mode and nothing in RS-232 mode under the same
> traffic, overrun counters equal; 96-byte writes every 60 ms lost
> partial chunks of 14 to 75 bytes a few times per run.
> 
> Re-check the queue under the port lock before arming the hold. Data
> queued before the check keeps the envelope open and the pending tx_work
> ends it once that data has drained; data queued after the hold is
> armed is already handled by start_tx(), which cancels the hold.
> 
> Fixes: 33632215e1bb ("serial: max310x: drive RTS in software when hardware delays are too short")
> Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-max310x-tx-fixes-v2-0-b395126fd23d@vaisala.com?part=2


  reply	other threads:[~2026-11-17  6:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  6:14 [PATCH v2 0/4] serial: max310x: transmit path fixes Tapio Reijonen
2026-11-17  6:14 ` [PATCH v2 1/4] serial: max310x: do not advance the TX fifo past a flush Tapio Reijonen
2026-11-17  6:31   ` sashiko-bot
2026-11-17  6:14 ` [PATCH v2 2/4] serial: max310x: re-check the TX queue before the after-send hold Tapio Reijonen
2026-11-17  6:21   ` sashiko-bot [this message]
2026-11-17  6:14 ` [PATCH v2 3/4] serial: max310x: hold TX data until the software RTS send phase Tapio Reijonen
2026-11-17  6:48   ` sashiko-bot
2026-11-17  6:14 ` [PATCH v2 4/4] serial: max310x: end the RTS envelope when a flush leaves nothing to send Tapio Reijonen
2026-11-17  6:22   ` sashiko-bot

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=sashiko-outbox-218247@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tapio.reijonen@vaisala.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox