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

kernel test robot
2021-02-02T12:30:44Z

[-- Attachment #1: Type: text/plain, Size: 19664 bytes --]

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];
| ^~~~~~~~~~~~~~~~~~~
kernel/printk/printk.c:2469:23: note: each undeclared identifier is reported only once for each function it appears in
kernel/printk/printk.c:2469:14: warning: unused variable 'ext_text' [-Wunused-variable]
2469 | static char ext_text[CONSOLE_EXT_LOG_MAX];
| ^~~~~~~~

vim +/CONSOLE_EXT_LOG_MAX +2469 kernel/printk/printk.c

a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2452
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2453 /**
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2454 * console_unlock - unlock the console system
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2455 *
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2456 * Releases the console_lock which the caller holds on the console system
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2457 * and the console driver list.
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2458 *
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2459 * While the console_lock was held, console output may have been buffered
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2460 * by printk(). If this is the case, console_unlock(); emits
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2461 * the output prior to releasing the lock.
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2462 *
7f3a781d6fd81e kernel/printk.c Kay Sievers 2012-05-09 2463 * If there is output waiting, we wake /dev/kmsg and syslog() users.
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2464 *
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2465 * console_unlock(); may be called from any context.
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2466 */
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2467 void console_unlock(void)
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2468 {
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 @2469 static char ext_text[CONSOLE_EXT_LOG_MAX];
70498253186586 kernel/printk.c Kay Sievers 2012-07-16 2470 static char text[LOG_LINE_MAX + PREFIX_MAX];
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2471 unsigned long flags;
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2472 bool do_cond_resched, retry;
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2473 struct printk_info info;
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2474 struct printk_record r;
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2475
557240b48e2dc4 kernel/printk.c Linus Torvalds 2006-06-19 2476 if (console_suspended) {
bd8d7cf5b8410f kernel/printk/printk.c Jan Kara 2014-06-04 2477 up_console_sem();
557240b48e2dc4 kernel/printk.c Linus Torvalds 2006-06-19 2478 return;
557240b48e2dc4 kernel/printk.c Linus Torvalds 2006-06-19 2479 }
78944e549d3667 kernel/printk.c Antonino A. Daplas 2006-08-05 2480
f35efc78add643 kernel/printk/printk.c John Ogness 2020-09-19 2481 prb_rec_init_rd(&r, &info, text, sizeof(text));
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2482
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2483 /*
257ab443118bff kernel/printk/printk.c Petr Mladek 2017-03-24 2484 * Console drivers are called with interrupts disabled, so
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2485 * @console_may_schedule should be cleared before; however, we may
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2486 * end up dumping a lot of lines, for example, if called from
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2487 * console registration path, and should invoke cond_resched()
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2488 * between lines if allowable. Not doing so can cause a very long
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2489 * scheduling stall on a slow console leading to RCU stall and
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2490 * softlockup warnings which exacerbate the issue with more
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2491 * messages practically incapacitating the system.
257ab443118bff kernel/printk/printk.c Petr Mladek 2017-03-24 2492 *
257ab443118bff kernel/printk/printk.c Petr Mladek 2017-03-24 2493 * console_trylock() is not able to detect the preemptive
257ab443118bff kernel/printk/printk.c Petr Mladek 2017-03-24 2494 * context reliably. Therefore the value must be stored before
547bbf7d214fff kernel/printk/printk.c Randy Dunlap 2020-08-06 2495 * and cleared after the "again" goto label.
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2496 */
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2497 do_cond_resched = console_may_schedule;
257ab443118bff kernel/printk/printk.c Petr Mladek 2017-03-24 2498 again:
78944e549d3667 kernel/printk.c Antonino A. Daplas 2006-08-05 2499 console_may_schedule = 0;
78944e549d3667 kernel/printk.c Antonino A. Daplas 2006-08-05 2500
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2501 /*
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2502 * We released the console_sem lock, so we need to recheck if
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2503 * cpu is online and (if not) is there at least one CON_ANYTIME
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2504 * console.
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2505 */
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2506 if (!can_use_console()) {
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2507 console_locked = 0;
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2508 up_console_sem();
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2509 return;
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2510 }
a8199371afc279 kernel/printk/printk.c Sergey Senozhatsky 2016-03-17 2511
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2512 for (;;) {
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2513 size_t ext_len = 0;
3ce9a7c0ac2856 kernel/printk.c Kay Sievers 2012-05-13 2514 size_t len;
7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2515
f975237b768279 kernel/printk/printk.c Sergey Senozhatsky 2016-12-27 2516 printk_safe_enter_irqsave(flags);
f975237b768279 kernel/printk/printk.c Sergey Senozhatsky 2016-12-27 2517 raw_spin_lock(&logbuf_lock);
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2518 skip:
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2519 if (!prb_read_valid(prb, console_seq, &r))
7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2520 break;
7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2521
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2522 if (console_seq != r.info->seq) {
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2523 console_dropped += r.info->seq - console_seq;
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2524 console_seq = r.info->seq;
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2525 }
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2526
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2527 if (suppress_message_printing(r.info->level)) {
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2528 /*
a6ae928c25835c kernel/printk/printk.c Petr Mladek 2018-09-10 2529 * Skip record we have buffered and already printed
a6ae928c25835c kernel/printk/printk.c Petr Mladek 2018-09-10 2530 * directly to the console when we received it, and
a6ae928c25835c kernel/printk/printk.c Petr Mladek 2018-09-10 2531 * record that has level above the console loglevel.
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2532 */
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2533 console_seq++;
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2534 goto skip;
084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2535 }
649e6ee33f73ba kernel/printk.c Kay Sievers 2012-05-10 2536
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2537 /* Output to all consoles once old messages replayed. */
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2538 if (unlikely(exclusive_console &&
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2539 console_seq >= exclusive_console_stop_seq)) {
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2540 exclusive_console = NULL;
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2541 }
f92b070f2dc89a kernel/printk/printk.c Petr Mladek 2018-09-13 2542
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2543 /*
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2544 * Handle extended console text first because later
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2545 * record_print_text() will modify the record buffer in-place.
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2546 */
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2547 if (nr_ext_console_drivers) {
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2548 ext_len = info_print_ext_header(ext_text,
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2549 sizeof(ext_text),
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2550 r.info);
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2551 ext_len += msg_print_ext_body(ext_text + ext_len,
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2552 sizeof(ext_text) - ext_len,
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2553 &r.text_buf[0],
74caba7f2a0685 kernel/printk/printk.c John Ogness 2020-09-21 2554 r.info->text_len,
74caba7f2a0685 kernel/printk/printk.c John Ogness 2020-09-21 2555 &r.info->dev_info);
6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2556 }
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2557 len = record_print_text(&r,
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2558 console_msg_format & MSG_FORMAT_SYSLOG,
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2559 printk_time);
7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2560 console_seq++;
07354eb1a74d1e kernel/printk.c Thomas Gleixner 2009-07-25 2561 raw_spin_unlock(&logbuf_lock);
7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2562
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2563) /*
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2564) * While actively printing out messages, if another printk()
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2565) * were to occur on another CPU, it may wait for this one to
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2566) * finish. This task can not be preempted if there is a
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2567) * waiter waiting to take over.
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2568) */
c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2569 console_lock_spinning_enable();
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2570)
81d68a96a39844 kernel/printk.c Steven Rostedt 2008-05-12 2571 stop_critical_timings(); /* don't trace print latency */
d9c23523ed98a3 kernel/printk/printk.c Sergey Senozhatsky 2016-12-24 2572 call_console_drivers(ext_text, ext_len, text, len);
81d68a96a39844 kernel/printk.c Steven Rostedt 2008-05-12 2573 start_critical_timings();
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2574)
c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2575 if (console_lock_spinning_disable_and_check()) {
c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2576 printk_safe_exit_irqrestore(flags);
43a17111c25539 kernel/printk/printk.c Sergey Senozhatsky 2018-04-19 2577 return;
c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2578 }
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2579)
f975237b768279 kernel/printk/printk.c Sergey Senozhatsky 2016-12-27 2580 printk_safe_exit_irqrestore(flags);
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2581
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2582 if (do_cond_resched)
8d91f8b15361df kernel/printk/printk.c Tejun Heo 2016-01-15 2583 cond_resched();
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2584 }
dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2585)
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2586 console_locked = 0;
fe3d8ad31cf51b kernel/printk.c Feng Tang 2011-03-22 2587
07354eb1a74d1e kernel/printk.c Thomas Gleixner 2009-07-25 2588 raw_spin_unlock(&logbuf_lock);
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2589
bd8d7cf5b8410f kernel/printk/printk.c Jan Kara 2014-06-04 2590 up_console_sem();
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2591
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2592 /*
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2593 * Someone could have filled up the buffer again, so re-check if there's
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2594 * something to flush. In case we cannot trylock the console_sem again,
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2595 * there's a new owner and the console_unlock() from them will do the
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2596 * flush, no worries.
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2597 */
07354eb1a74d1e kernel/printk.c Thomas Gleixner 2009-07-25 2598 raw_spin_lock(&logbuf_lock);
896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2599 retry = prb_read_valid(prb, console_seq, NULL);
f975237b768279 kernel/printk/printk.c Sergey Senozhatsky 2016-12-27 2600 raw_spin_unlock(&logbuf_lock);
f975237b768279 kernel/printk/printk.c Sergey Senozhatsky 2016-12-27 2601 printk_safe_exit_irqrestore(flags);
09dc3cf93f7d16 kernel/printk.c Peter Zijlstra 2011-12-08 2602
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2603 if (retry && console_trylock())
4f2a8d3cf5e048 kernel/printk.c Peter Zijlstra 2011-06-22 2604 goto again;
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2605 }
ac751efa6a0d70 kernel/printk.c Torben Hohn 2011-01-25 2606 EXPORT_SYMBOL(console_unlock);
^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2607

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25400 bytes --]