Re: [PATCH v1 24/31] serial: 8250_mxupci: defer uart_write_wakeup to workqueue
From: Andy Shevchenko
Date: Sun Nov 30 2025 - 21:07:18 EST
On Sun, Nov 30, 2025 at 12:45 PM Crescent Hsieh
<crescentcy.hsieh@xxxxxxxx> wrote:
>
> When the TX FIFO drops below WAKEUP_CHARS, mxpcie used to call
> uart_write_wakeup() directly from the interrupt path. Move this into a
> per-port work item so we avoid doing TTY wakeups in interrupt context and
> reduce IRQ-side work.
>
> Changes:
> - Add per-port state (event_flags, work, cached uport pointer).
> - In tx_chars(), set a TXLOW event and schedule the per-port work instead
> of calling uart_write_wakeup() directly.
> - The work handler test-and-clear the TXLOW bit and calls
> uart_write_wakeup().
>
> This keeps IRQ handlers lightweight and avoids potential locking or RT
> latency issues while preserving existing behavior.
>
> Note: removal path must cancel pending works before unregistering ports.
...
> + struct pci_dev *pdev = to_pci_dev(port->dev);
> + struct mxupci8250 *priv = pci_get_drvdata(pdev);
dev_get_drvdata();
...
> +static void mxupci8250_work_handler(struct work_struct *work)
> +{
> + struct mxupci8250_port *priv_port = container_of(work, struct mxupci8250_port, work);
> +
> + if (test_and_clear_bit(MOXA_EVENT_TXLOW, &priv_port->event_flags))
> + uart_write_wakeup(priv_port->uport);
> +
Stray new line.
> +}
--
With Best Regards,
Andy Shevchenko