All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-rt-devel:linux-5.10.y-rt-rebase 81/248] kernel/printk/printk.c:2677:50: error: 'prb' undeclared
@ 2020-11-13  3:48 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-11-13  3:48 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.10.y-rt-rebase
head:   13ce1b83bb2b44f074b4fda849bb8b200adca084
commit: 8a39e6b9495a53ffa39f739971e8fad09d1ec3f7 [81/248] printk: move console printing to kthreads
config: sparc-allnoconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?id=8a39e6b9495a53ffa39f739971e8fad09d1ec3f7
        git remote add linux-rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
        git fetch --no-tags linux-rt-devel linux-5.10.y-rt-rebase
        git checkout 8a39e6b9495a53ffa39f739971e8fad09d1ec3f7
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 

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:63:
   kernel/printk/internal.h:56:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
      56 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
         |                    ^~~~~~~~~~~~
   kernel/printk/printk.c:180:5: warning: no previous prototype for 'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes]
     180 | int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/printk/printk.c: In function 'register_console':
>> kernel/printk/printk.c:2677:50: error: 'prb' undeclared (first use in this function)
    2677 |   atomic64_set(&newcon->printk_seq, prb_next_seq(prb));
         |                                                  ^~~
   kernel/printk/printk.c:2677:50: note: each undeclared identifier is reported only once for each function it appears in
   In file included from include/linux/mmzone.h:10,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from kernel/printk/printk.c:23:
   kernel/printk/printk.c: In function 'printk_kthread_func':
>> kernel/printk/printk.c:2836:36: error: 'log_wait' undeclared (first use in this function); did you mean 'poll_wait'?
    2836 |   error = wait_event_interruptible(log_wait,
         |                                    ^~~~~~~~
   include/linux/wait.h:272:39: note: in definition of macro '___wait_event'
     272 |   long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
         |                                       ^~~~~~~
   include/linux/wait.h:465:11: note: in expansion of macro '__wait_event_interruptible'
     465 |   __ret = __wait_event_interruptible(wq_head, condition);  \
         |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/printk/printk.c:2836:11: note: in expansion of macro 'wait_event_interruptible'
    2836 |   error = wait_event_interruptible(log_wait,
         |           ^~~~~~~~~~~~~~~~~~~~~~~~
   kernel/printk/printk.c:2877:7: error: implicit declaration of function 'kernel_sync_mode' [-Werror=implicit-function-declaration]
    2877 |   if (kernel_sync_mode() && con->write_atomic) {
         |       ^~~~~~~~~~~~~~~~
>> kernel/printk/printk.c:2889:4: error: implicit declaration of function 'printk_delay'; did you mean 'print_dev_t'? [-Werror=implicit-function-declaration]
    2889 |    printk_delay(r.info->level);
         |    ^~~~~~~~~~~~
         |    print_dev_t
   kernel/printk/printk.c: In function 'console_try_thread':
>> kernel/printk/printk.c:2938:8: error: implicit declaration of function 'get_sprint_buf' [-Werror=implicit-function-declaration]
    2938 |  buf = get_sprint_buf(&sprint_id, &irqflags);
         |        ^~~~~~~~~~~~~~
   kernel/printk/printk.c:2938:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    2938 |  buf = get_sprint_buf(&sprint_id, &irqflags);
         |      ^
>> kernel/printk/printk.c:2942:2: error: implicit declaration of function 'print_sync_until' [-Werror=implicit-function-declaration]
    2942 |  print_sync_until(prb_next_seq(prb), con, buf, PREFIX_MAX + LOG_LINE_MAX);
         |  ^~~~~~~~~~~~~~~~
   kernel/printk/printk.c:2942:32: error: 'prb' undeclared (first use in this function)
    2942 |  print_sync_until(prb_next_seq(prb), con, buf, PREFIX_MAX + LOG_LINE_MAX);
         |                                ^~~
>> kernel/printk/printk.c:2944:2: error: implicit declaration of function 'put_sprint_buf' [-Werror=implicit-function-declaration]
    2944 |  put_sprint_buf(sprint_id, irqflags);
         |  ^~~~~~~~~~~~~~
   kernel/printk/printk.c: At top level:
   kernel/printk/printk.c:3483:6: warning: no previous prototype for 'prb_lock' [-Wmissing-prototypes]
    3483 | void prb_lock(struct prb_cpulock *cpu_lock, unsigned int *cpu_store)
         |      ^~~~~~~~
   kernel/printk/printk.c:3501:6: warning: no previous prototype for 'prb_unlock' [-Wmissing-prototypes]
    3501 | void prb_unlock(struct prb_cpulock *cpu_lock, unsigned int cpu_store)
         |      ^~~~~~~~~~
   kernel/printk/printk.c:2094:13: warning: 'call_console_drivers' defined but not used [-Wunused-function]
    2094 | static void call_console_drivers(const char *ext_text, size_t ext_len,
         |             ^~~~~~~~~~~~~~~~~~~~
   kernel/printk/printk.c:2079:12: warning: 'syslog_seq' defined but not used [-Wunused-variable]
    2079 | static u64 syslog_seq;
         |            ^~~~~~~~~~
   kernel/printk/printk.c:84:13: warning: 'sync_mode' defined but not used [-Wunused-variable]
      84 | static bool sync_mode;
         |             ^~~~~~~~~
   cc1: some warnings being treated as errors

vim +/prb +2677 kernel/printk/printk.c

  2563	
  2564	/*
  2565	 * The console driver calls this routine during kernel initialization
  2566	 * to register the console printing procedure with printk() and to
  2567	 * print any messages that were printed by the kernel before the
  2568	 * console driver was initialized.
  2569	 *
  2570	 * This can happen pretty early during the boot process (because of
  2571	 * early_printk) - sometimes before setup_arch() completes - be careful
  2572	 * of what kernel features are used - they may not be initialised yet.
  2573	 *
  2574	 * There are two types of consoles - bootconsoles (early_printk) and
  2575	 * "real" consoles (everything which is not a bootconsole) which are
  2576	 * handled differently.
  2577	 *  - Any number of bootconsoles can be registered at any time.
  2578	 *  - As soon as a "real" console is registered, all bootconsoles
  2579	 *    will be unregistered automatically.
  2580	 *  - Once a "real" console is registered, any attempt to register a
  2581	 *    bootconsoles will be rejected
  2582	 */
  2583	void register_console(struct console *newcon)
  2584	{
  2585		struct console *bcon = NULL;
  2586		int err;
  2587	
  2588		for_each_console(bcon) {
  2589			if (WARN(bcon == newcon, "console '%s%d' already registered\n",
  2590						 bcon->name, bcon->index))
  2591				return;
  2592		}
  2593	
  2594		/*
  2595		 * before we register a new CON_BOOT console, make sure we don't
  2596		 * already have a valid console
  2597		 */
  2598		if (newcon->flags & CON_BOOT) {
  2599			for_each_console(bcon) {
  2600				if (!(bcon->flags & CON_BOOT)) {
  2601					pr_info("Too late to register bootconsole %s%d\n",
  2602						newcon->name, newcon->index);
  2603					return;
  2604				}
  2605			}
  2606		}
  2607	
  2608		newcon->thread = NULL;
  2609	
  2610		if (console_drivers && console_drivers->flags & CON_BOOT)
  2611			bcon = console_drivers;
  2612	
  2613		if (!has_preferred_console || bcon || !console_drivers)
  2614			has_preferred_console = preferred_console >= 0;
  2615	
  2616		/*
  2617		 *	See if we want to use this console driver. If we
  2618		 *	didn't select a console we take the first one
  2619		 *	that registers here.
  2620		 */
  2621		if (!has_preferred_console) {
  2622			if (newcon->index < 0)
  2623				newcon->index = 0;
  2624			if (newcon->setup == NULL ||
  2625			    newcon->setup(newcon, NULL) == 0) {
  2626				newcon->flags |= CON_ENABLED;
  2627				if (newcon->device) {
  2628					newcon->flags |= CON_CONSDEV;
  2629					has_preferred_console = true;
  2630				}
  2631			}
  2632		}
  2633	
  2634		/* See if this console matches one we selected on the command line */
  2635		err = try_enable_new_console(newcon, true);
  2636	
  2637		/* If not, try to match against the platform default(s) */
  2638		if (err == -ENOENT)
  2639			err = try_enable_new_console(newcon, false);
  2640	
  2641		/* printk() messages are not printed to the Braille console. */
  2642		if (err || newcon->flags & CON_BRL)
  2643			return;
  2644	
  2645		/*
  2646		 * If we have a bootconsole, and are switching to a real console,
  2647		 * don't print everything out again, since when the boot console, and
  2648		 * the real console are the same physical device, it's annoying to
  2649		 * see the beginning boot messages twice
  2650		 */
  2651		if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV))
  2652			newcon->flags &= ~CON_PRINTBUFFER;
  2653	
  2654		/*
  2655		 *	Put this console in the list - keep the
  2656		 *	preferred driver at the head of the list.
  2657		 */
  2658		console_lock();
  2659		if ((newcon->flags & CON_CONSDEV) || console_drivers == NULL) {
  2660			newcon->next = console_drivers;
  2661			console_drivers = newcon;
  2662			if (newcon->next)
  2663				newcon->next->flags &= ~CON_CONSDEV;
  2664			/* Ensure this flag is always set for the head of the list */
  2665			newcon->flags |= CON_CONSDEV;
  2666		} else {
  2667			newcon->next = console_drivers->next;
  2668			console_drivers->next = newcon;
  2669		}
  2670	
  2671		if (newcon->flags & CON_EXTENDED)
  2672			nr_ext_console_drivers++;
  2673	
  2674		if (newcon->flags & CON_PRINTBUFFER)
  2675			atomic64_set(&newcon->printk_seq, 0);
  2676		else
> 2677			atomic64_set(&newcon->printk_seq, prb_next_seq(prb));
  2678	
  2679		console_try_thread(newcon);
  2680		console_unlock();
  2681		console_sysfs_notify();
  2682	
  2683		/*
  2684		 * By unregistering the bootconsoles after we enable the real console
  2685		 * we get the "console xxx enabled" message on all the consoles -
  2686		 * boot consoles, real consoles, etc - this is to ensure that end
  2687		 * users know there might be something in the kernel's log buffer that
  2688		 * went to the bootconsole (that they do not see on the real console)
  2689		 */
  2690		pr_info("%sconsole [%s%d] enabled\n",
  2691			(newcon->flags & CON_BOOT) ? "boot" : "" ,
  2692			newcon->name, newcon->index);
  2693		if (bcon &&
  2694		    ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV) &&
  2695		    !keep_bootcon) {
  2696			/* We need to iterate through all boot consoles, to make
  2697			 * sure we print everything out, before we unregister them.
  2698			 */
  2699			for_each_console(bcon)
  2700				if (bcon->flags & CON_BOOT)
  2701					unregister_console(bcon);
  2702		}
  2703	}
  2704	EXPORT_SYMBOL(register_console);
  2705	
  2706	int unregister_console(struct console *console)
  2707	{
  2708		struct console *con;
  2709		int res;
  2710	
  2711		pr_info("%sconsole [%s%d] disabled\n",
  2712			(console->flags & CON_BOOT) ? "boot" : "" ,
  2713			console->name, console->index);
  2714	
  2715		res = _braille_unregister_console(console);
  2716		if (res < 0)
  2717			return res;
  2718		if (res > 0)
  2719			return 0;
  2720	
  2721		res = -ENODEV;
  2722		console_lock();
  2723		if (console_drivers == console) {
  2724			console_drivers=console->next;
  2725			res = 0;
  2726		} else {
  2727			for_each_console(con) {
  2728				if (con->next == console) {
  2729					con->next = console->next;
  2730					res = 0;
  2731					break;
  2732				}
  2733			}
  2734		}
  2735	
  2736		if (res)
  2737			goto out_disable_unlock;
  2738	
  2739		if (console->flags & CON_EXTENDED)
  2740			nr_ext_console_drivers--;
  2741	
  2742		/*
  2743		 * If this isn't the last console and it has CON_CONSDEV set, we
  2744		 * need to set it on the next preferred console.
  2745		 */
  2746		if (console_drivers != NULL && console->flags & CON_CONSDEV)
  2747			console_drivers->flags |= CON_CONSDEV;
  2748	
  2749		console->flags &= ~CON_ENABLED;
  2750		console_unlock();
  2751		console_sysfs_notify();
  2752	
  2753		if (console->thread && !IS_ERR(console->thread))
  2754			kthread_stop(console->thread);
  2755	
  2756		if (console->exit)
  2757			res = console->exit(console);
  2758	
  2759		return res;
  2760	
  2761	out_disable_unlock:
  2762		console->flags &= ~CON_ENABLED;
  2763		console_unlock();
  2764	
  2765		return res;
  2766	}
  2767	EXPORT_SYMBOL(unregister_console);
  2768	
  2769	/*
  2770	 * Initialize the console device. This is called *early*, so
  2771	 * we can't necessarily depend on lots of kernel help here.
  2772	 * Just do some early initializations, and do the complex setup
  2773	 * later.
  2774	 */
  2775	void __init console_init(void)
  2776	{
  2777		int ret;
  2778		initcall_t call;
  2779		initcall_entry_t *ce;
  2780	
  2781		/* Setup the default TTY line discipline. */
  2782		n_tty_init();
  2783	
  2784		/*
  2785		 * set up the console device so that later boot sequences can
  2786		 * inform about problems etc..
  2787		 */
  2788		ce = __con_initcall_start;
  2789		trace_initcall_level("console");
  2790		while (ce < __con_initcall_end) {
  2791			call = initcall_from_entry(ce);
  2792			trace_initcall_start(call);
  2793			ret = call();
  2794			trace_initcall_finish(call, ret);
  2795			ce++;
  2796		}
  2797	}
  2798	
  2799	static int printk_kthread_func(void *data)
  2800	{
  2801		struct console *con = data;
  2802		unsigned long dropped = 0;
  2803		struct printk_info info;
  2804		struct printk_record r;
  2805		char *ext_text = NULL;
  2806		size_t dropped_len;
  2807		char *dropped_text;
  2808		int ret = -ENOMEM;
  2809		char *write_text;
  2810		u64 printk_seq;
  2811		size_t len;
  2812		char *text;
  2813		int error;
  2814		u64 seq;
  2815	
  2816		if (con->flags & CON_EXTENDED) {
  2817			ext_text = kmalloc(CONSOLE_EXT_LOG_MAX, GFP_KERNEL);
  2818			if (!ext_text)
  2819				return ret;
  2820		}
  2821		text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
  2822		dropped_text = kmalloc(64, GFP_KERNEL);
  2823		if (!text || !dropped_text)
  2824			goto out;
  2825	
  2826		if (con->flags & CON_EXTENDED)
  2827			write_text = ext_text;
  2828		else
  2829			write_text = text;
  2830	
  2831		seq = atomic64_read(&con->printk_seq);
  2832	
  2833		prb_rec_init_rd(&r, &info, text, LOG_LINE_MAX + PREFIX_MAX);
  2834	
  2835		for (;;) {
> 2836			error = wait_event_interruptible(log_wait,
  2837					prb_read_valid(prb, seq, &r) || kthread_should_stop());
  2838	
  2839			if (kthread_should_stop())
  2840				break;
  2841	
  2842			if (error)
  2843				continue;
  2844	
  2845			if (seq != r.info->seq) {
  2846				dropped += r.info->seq - seq;
  2847				seq = r.info->seq;
  2848			}
  2849	
  2850			seq++;
  2851	
  2852			if (!(con->flags & CON_ENABLED))
  2853				continue;
  2854	
  2855			if (suppress_message_printing(r.info->level))
  2856				continue;
  2857	
  2858			if (con->flags & CON_EXTENDED) {
  2859				len = info_print_ext_header(ext_text,
  2860					CONSOLE_EXT_LOG_MAX,
  2861					r.info);
  2862				len += msg_print_ext_body(ext_text + len,
  2863					CONSOLE_EXT_LOG_MAX - len,
  2864					&r.text_buf[0], r.info->text_len,
  2865					&r.info->dev_info);
  2866			} else {
  2867				len = record_print_text(&r,
  2868					console_msg_format & MSG_FORMAT_SYSLOG,
  2869					printk_time);
  2870			}
  2871	
  2872			printk_seq = atomic64_read(&con->printk_seq);
  2873	
  2874			console_lock();
  2875			console_may_schedule = 0;
  2876	
  2877			if (kernel_sync_mode() && con->write_atomic) {
  2878				console_unlock();
  2879				break;
  2880			}
  2881	
  2882			if (!(con->flags & CON_EXTENDED) && dropped) {
  2883				dropped_len = snprintf(dropped_text, 64,
  2884						       "** %lu printk messages dropped **\n",
  2885						       dropped);
  2886				dropped = 0;
  2887	
  2888				con->write(con, dropped_text, dropped_len);
  2889				printk_delay(r.info->level);
  2890			}
  2891	
  2892			con->write(con, write_text, len);
  2893			if (len)
  2894				printk_delay(r.info->level);
  2895	
  2896			atomic64_cmpxchg_relaxed(&con->printk_seq, printk_seq, seq);
  2897	
  2898			console_unlock();
  2899		}
  2900	out:
  2901		kfree(dropped_text);
  2902		kfree(text);
  2903		kfree(ext_text);
  2904		pr_info("%sconsole [%s%d]: printing thread stopped\n",
  2905			(con->flags & CON_BOOT) ? "boot" : "" ,
  2906			con->name, con->index);
  2907		return ret;
  2908	}
  2909	

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

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-13  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13  3:48 [linux-rt-devel:linux-5.10.y-rt-rebase 81/248] kernel/printk/printk.c:2677:50: error: 'prb' undeclared kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.