lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfW0DJMw+7Fh5ty_uy9=c50-Cb7maRcFYuA7S8JT3=nLw@mail.gmail.com>
Date: Mon, 1 Dec 2025 03:52:39 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Crescent Hsieh <crescentcy.hsieh@...a.com>
Cc: gregkh@...uxfoundation.org, jirislaby@...nel.org, 
	ilpo.jarvinen@...ux.intel.com, linux-kernel@...r.kernel.org, 
	linux-serial@...r.kernel.org
Subject: Re: [PATCH v1 16/31] serial: 8250_mxpcie: optimize Tx using
 memory-mapped FIFO access

On Sun, Nov 30, 2025 at 12:44 PM Crescent Hsieh
<crescentcy.hsieh@...a.com> wrote:
>
> Add mxpcie8250_tx_chars() to transmit data via memory-mapped FIFO
> access, using the UART-specific Tx FIFO counter and buffer region.
>
> This replaces serial8250_tx_chars() to reduce per-byte I/O operations
> and improve transmit throughput on Moxa PCIe UART devices.

...

> +static void mxpcie8250_tx_chars(struct uart_8250_port *up)
> +{
> +       struct uart_port *port = &up->port;
> +       struct tty_port *tport = &port->state->port;
> +       unsigned int count, i;
> +       unsigned char c;
> +
> +       if (port->x_char) {
> +               uart_xchar_out(port, UART_TX);
> +               return;
> +       }
> +       if (uart_tx_stopped(port) || kfifo_is_empty(&tport->xmit_fifo)) {
> +               port->ops->stop_tx(port);
> +               return;
> +       }

> +       count = kfifo_len(&tport->xmit_fifo);
> +       count = min(count, port->fifosize - serial_in(up, MOXA_PUART_TX_FIFO_CNT));

Perhaps

  unsigned int i, count, txsize;
  ...
  txsize = serial_in(up, MOXA_PUART_TX_FIFO_CNT);
  count = min(kfifo_len(...), fifosize - txsize);

?

> +       for (i = 0; i < count; ++i) {
> +               if (!uart_fifo_get(port, &c))
> +                       break;

> +               *(port->membase + MOXA_PUART_TX_FIFO_MEM + i) = c;

This is interesting... Why can't the proper IO accessors be used?

> +       }
> +       if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
> +               uart_write_wakeup(port);
> +
> +       if (kfifo_is_empty(&tport->xmit_fifo) && !(up->capabilities & UART_CAP_RPM))
> +               port->ops->stop_tx(port);
> +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ