diff mbox series

[1/2] console/serial: set the default transmit buffer size in Kconfig

Message ID 20220623090852.29622-2-roger.pau@citrix.com (mailing list archive)
State Superseded
Headers show
Series console/serial: adjust default TX buffer size | expand

Commit Message

Roger Pau Monné June 23, 2022, 9:08 a.m. UTC
Take the opportunity to convert the variable to read-only after init.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/char/Kconfig  | 10 ++++++++++
 xen/drivers/char/serial.c |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Jan Beulich June 23, 2022, 1:30 p.m. UTC | #1
On 23.06.2022 11:08, Roger Pau Monne wrote:
> --- a/xen/drivers/char/Kconfig
> +++ b/xen/drivers/char/Kconfig
> @@ -74,3 +74,13 @@ config HAS_EHCI
>  	help
>  	  This selects the USB based EHCI debug port to be used as a UART. If
>  	  you have an x86 based system with USB, say Y.
> +
> +config SERIAL_TX_BUFSIZE
> +	int "Size of the transmit serial buffer"
> +	default 16384
> +	help
> +	  Controls the default size of the transmit buffer (in bytes) used by
> +	  the serial driver.  Note the value provided will be rounder up to
> +	  PAGE_SIZE.

I first wanted to point out the spelling mistake (rounded), but I
wonder what good that rounding does and whether this description
isn't really misleading: serial_async_transmit() rounds down to a
power of two. So likely the value here would better be a log-2
one.

> +	  Default value is 16384 (16KB).

Perhaps (16kiB) (albeit the default value would change anyway if
the above is followed)?

Jan
diff mbox series

Patch

diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index e5f7b1d8eb..a349d55f18 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -74,3 +74,13 @@  config HAS_EHCI
 	help
 	  This selects the USB based EHCI debug port to be used as a UART. If
 	  you have an x86 based system with USB, say Y.
+
+config SERIAL_TX_BUFSIZE
+	int "Size of the transmit serial buffer"
+	default 16384
+	help
+	  Controls the default size of the transmit buffer (in bytes) used by
+	  the serial driver.  Note the value provided will be rounder up to
+	  PAGE_SIZE.
+
+	  Default value is 16384 (16KB).
diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index 5ecba0af33..8d375a41e3 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -16,7 +16,8 @@ 
 /* Never drop characters, even if the async transmit buffer fills. */
 /* #define SERIAL_NEVER_DROP_CHARS 1 */
 
-unsigned int __read_mostly serial_txbufsz = 16384;
+unsigned int __ro_after_init serial_txbufsz = ROUNDUP(CONFIG_SERIAL_TX_BUFSIZE,
+                                                      PAGE_SIZE);
 size_param("serial_tx_buffer", serial_txbufsz);
 
 #define mask_serial_rxbuf_idx(_i) ((_i)&(serial_rxbufsz-1))