Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Michael Zaidman <michael.zaidman@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: Michael Zaidman <michael.zaidman@gmail.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-input@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-gpio@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v4 02/16] HID: ft260: uart: fix serial driver
Date: Wed, 18 Nov 2026 22:56:59 +0200	[thread overview]
Message-ID: <20261118205703.49167-1-michael.zaidman@gmail.com> (raw)
In-Reply-To: <sashiko-outbox-219657@kernel.org>

On Tue, Nov 17, 2026 at 08:49:47PM +0000, sashiko-bot@kernel.org wrote:
> Can taking port->xmit_fifo_lock with plain spin_lock() deadlock against
> ft260_uart_write()?

Thanks, that is a real deadlock. kfifo_in_spinlocked() and
kfifo_out_spinlocked() take the lock with spin_lock_irqsave(), and the
other users of xmit_fifo_lock must do the same. In v5, patch 2 uses
spin_lock_irqsave() in all of them.

> Can ft260_uart_write_room() and ft260_uart_chars_in_buffer() race with
> kfifo_reset() and return a bogus count?

Right, kfifo_reset() writes in and out with two stores. A reader
without the lock can see one old and one new value. In v5 both
functions read the FIFO under xmit_fifo_lock, as uart_write_room() and
uart_chars_in_buffer() do in serial_core.

> Does removing ft260_uart_change_speed() from ft260_uart_port_activate()
> leave tty->termios out of sync with the hardware across an unplug and
> replug?

Yes, it's correct. v5 sets TTY_DRIVER_RESET_SAVED_TERMIOS in
tty_alloc_driver(), as you propose.

> Can publishing dev in ft260_uart_add_port() before
> tty_port_register_device_attr() allow a concurrent open to reach
> tty_init_dev() before driver->ports[dev->index] is updated?

It can. tty_kopen_exclusive() and tty_kopen_shared() find the driver
by dev_t and do not need the cdev. They can open the minor in that
window. I will take both of your proposals in v5: ft260_uart_install()
uses tty_port_install(), and ft260_uart_probe() makes the port visible
to ft260_uart_install() only after the chip is configured, just before
tty_port_register_device_attr().

  reply	other threads:[~2026-11-18 20:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:04 [PATCH v4 00/16] HID: ft260: add UART and GPIO support, plus I2C fixes Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 01/16] HID: ft260: add serial driver Michael Zaidman
2026-11-17 20:32   ` sashiko-bot
2026-11-18  7:21   ` Jiri Slaby
2026-11-18 16:38     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 02/16] HID: ft260: uart: fix " Michael Zaidman
2026-11-17 20:49   ` sashiko-bot
2026-11-18 20:56     ` Michael Zaidman [this message]
2026-11-17 20:04 ` [PATCH v4 03/16] HID: ft260: add GPIO support Michael Zaidman
2026-11-17 20:23   ` sashiko-bot
2026-11-18 20:56     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 04/16] HID: ft260: i2c: reduce driver module loading time Michael Zaidman
2026-11-17 20:11   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 05/16] HID: ft260: fix sysfs store failure notice for big numbers Michael Zaidman
2026-11-17 20:12   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 06/16] HID: ft260: i2c: reduce bus-error message severity Michael Zaidman
2026-11-17 20:13   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 07/16] HID: ft260: uart: enable flow control Michael Zaidman
2026-11-17 20:21   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 08/16] HID: ft260: uart: add modem pins control via ioctl Michael Zaidman
2026-11-17 20:24   ` sashiko-bot
2026-11-17 23:56   ` Maarten Brock
2026-11-18 16:40     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 09/16] HID: ft260: group sysfs attrs per HID interface Michael Zaidman
2026-11-17 20:30   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 10/16] HID: ft260: i2c: fix large write transaction failure Michael Zaidman
2026-11-17 20:30   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 11/16] HID: ft260: workaround for TN_189 errata endpoint STALL after enumeration Michael Zaidman
2026-11-17 20:50   ` sashiko-bot
2026-11-18 20:57     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 12/16] HID: ft260: i2c: abort in-flight transfers with STOP before reset Michael Zaidman
2026-11-17 20:33   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 13/16] HID: ft260: i2c: reject an I2C clock outside the supported range Michael Zaidman
2026-11-17 20:34   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 14/16] HID: ft260: i2c: fix i2c_reset sysfs store return value Michael Zaidman
2026-11-17 20:35   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 15/16] HID: ft260: i2c: recover a bus held by a slave Michael Zaidman
2026-11-17 20:44   ` sashiko-bot
2026-11-17 20:04 ` [PATCH v4 16/16] HID: ft260: use lock guards Michael Zaidman
2026-11-17 20:36   ` 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=20261118205703.49167-1-michael.zaidman@gmail.com \
    --to=michael.zaidman@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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