Re: [PATCH v2] printk: Remove redundant CONFIG_BASE_SMALL

From: Jiri Slaby
Date: Mon Jan 29 2024 - 06:28:32 EST


On 27. 01. 24, 23:00, Yoann Congal wrote:
CONFIG_BASE_SMALL is currently a type int but is only used as a boolean
equivalent to !CONFIG_BASE_FULL.

So, remove it entirely and move every usage to !CONFIG_BASE_FULL.

In addition, recent kconfig changes (see the discussion in Closes: tag)
revealed that using:
config SOMETHING
default "some value" if X
does not work as expected if X is not of type bool.

CONFIG_BASE_SMALL was used that way in init/Kconfig:
config LOG_CPU_MAX_BUF_SHIFT
default 12 if !BASE_SMALL
default 0 if BASE_SMALL

Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 to
CONFIG_LOG_CPU_MAX_BUF_SHIFT=0 for some defconfigs, but that will not be
a big impact due to this code in kernel/printk/printk.c:
/* by default this will only continue through for large > 64 CPUs */
if (cpu_extra <= __LOG_BUF_LEN / 2)
return;

Signed-off-by: Yoann Congal <yoann.congal@xxxxxxxx>
Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@xxxxxxxxxxxxxx/
Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable")
---
v1 patch was named "treewide: Change CONFIG_BASE_SMALL to bool type"
https://lore.kernel.org/all/20240126163032.1613731-1-yoann.congal@xxxxxxxx/

v1 -> v2: Applied Masahiro Yamada's comments (Thanks!):
* Changed from "Change CONFIG_BASE_SMALL to type bool" to
"Remove it and switch usage to !CONFIG_BASE_FULL"
* Fixed "Fixes:" tag and reference to the mailing list thread.
* Added a note about CONFIG_LOG_CPU_MAX_BUF_SHIFT changing.
..
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -51,7 +51,7 @@
#include <asm/unaligned.h>
#define HEADER_SIZE 4u
-#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
+#define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_FULL) ? PAGE_SIZE : 256)

Why is the IS_ENABLED() addition needed? You don't say anything about that in the commit log.

thanks,
--
js
suse labs