Re: [PATCH 3/3] printk: move CONSOLE_EXT_LOG_MAX to kernel/printk/printk.c

Petr Mladek
2021-02-03T14:00:32Z

On Tue 2021-02-02 20:29:31, kernel test robot wrote:
> Hi Masahiro,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on linux/master]
> [also build test ERROR on efi/next tty/tty-testing tip/x86/core v5.11-rc6 next-20210125]
> [cannot apply to pmladek/for-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url: https://github.com/0day-ci/linux/commits/Masahiro-Yamada/printk-use-CONFIG_CONSOLE_LOGLEVEL_-directly/20210202-151411
> base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ab38c17aac10bf55ab3efde4c4db3893d8691d2
> config: alpha-randconfig-s031-20210202 (attached as .config)
> compiler: alpha-linux-gcc (GCC) 9.3.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.3-215-g0fb77bb6-dirty
> # https://github.com/0day-ci/linux/commit/35d219bfad62e5008215f996430732aeb52c0652
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Masahiro-Yamada/printk-use-CONFIG_CONSOLE_LOGLEVEL_-directly/20210202-151411
> git checkout 35d219bfad62e5008215f996430732aeb52c0652
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
> In file included from kernel/printk/printk.c:61:
> kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
> 59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
> | ^~~~~~~~~~~~
> kernel/printk/printk.c:175:5: warning: no previous prototype for 'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes]
> 175 | int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/printk/printk.c: In function 'console_unlock':
> >> kernel/printk/printk.c:2469:23: error: 'CONSOLE_EXT_LOG_MAX' undeclared (first use in this function)
> 2469 | static char ext_text[CONSOLE_EXT_LOG_MAX];
> | ^~~~~~~~~~~~~~~~~~~

This code is called also when CONFIG_PRINTK is not enabled.

It is a historic mess. console_lock() is used to synchronize also some
other stuff, especially in tty code, even when printk logging is
not enabled.

It should work to define:

#define CONSOLE_EXT_LOG_MAX 0

in the middle of printk.c, search for:

#else /* CONFIG_PRINTK */

Best Regards,
Petr