[jimc:m-5 14/146] kernel/locking/lockdep.c:6777:2: error: 'bootstrap_stack_trace' undeclared

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/jimc/linux.git m-5
head:   f4586ca88dc640ffb7dea6725f1b347cd3c51bf9
commit: b380fdf118d57d97bf5a7acd5b3ccb1d8dd74e9e [14/146] locking/lockdep: Migrate and compact stack trace entries into folio_scratchpad
config: powerpc-randconfig-002-20260821 (https://download.01.org/0day-ci/archive/20260821/[email protected]/config)
compiler: powerpc-linux-gcc (GCC) 9.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260821/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

   kernel/locking/lockdep.c: In function 'lockdep_init':
>> kernel/locking/lockdep.c:6777:2: error: 'bootstrap_stack_trace' undeclared (first use in this function)
    6777 |  bootstrap_stack_trace = early_stack_trace;
         |  ^~~~~~~~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:6777:2: note: each undeclared identifier is reported only once for each function it appears in
>> kernel/locking/lockdep.c:6777:26: error: 'early_stack_trace' undeclared (first use in this function)
    6777 |  bootstrap_stack_trace = early_stack_trace;
         |                          ^~~~~~~~~~~~~~~~~
>> kernel/locking/lockdep.c:6778:2: error: 'bootstrap_stack_trace_in_use' undeclared (first use in this function); did you mean 'bootstrap_entries_in_use'?
    6778 |  bootstrap_stack_trace_in_use = &early_stack_trace_in_use;
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  bootstrap_entries_in_use
>> kernel/locking/lockdep.c:6778:34: error: 'early_stack_trace_in_use' undeclared (first use in this function)
    6778 |  bootstrap_stack_trace_in_use = &early_stack_trace_in_use;
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:31,
                    from arch/powerpc/include/asm/bug.h:116,
                    from include/linux/bug.h:5,
                    from arch/powerpc/include/asm/cmpxchg.h:8,
                    from arch/powerpc/include/asm/atomic.h:11,
                    from include/linux/atomic.h:7,
                    from include/linux/cpumask.h:10,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/mutex.h:17,
                    from kernel/locking/lockdep.c:30:
   kernel/locking/lockdep.c: In function 'lockdep_boot_report':
   kernel/locking/lockdep.c:6822:3: error: 'early_stack_trace_in_use' undeclared (first use in this function)
    6822 |   early_stack_trace_in_use,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:483:19: note: in definition of macro 'printk_index_wrap'
     483 |   _p_func(_fmt, ##__VA_ARGS__);    \
         |                   ^~~~~~~~~~~
   include/linux/printk.h:584:2: note: in expansion of macro 'printk'
     584 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~
   kernel/locking/lockdep.c:6819:2: note: in expansion of macro 'pr_info'
    6819 |  pr_info("lockdep: %lu/%lu bootstrap entries, %lu/%lu bootstrap traces used before buddy init, folio_pool active\n",
         |  ^~~~~~~
>> kernel/locking/lockdep.c:6823:18: error: 'BOOTSTRAP_STACK_TRACE_ENTRIES' undeclared (first use in this function); did you mean 'MAX_STACK_TRACE_ENTRIES'?
    6823 |   (unsigned long)BOOTSTRAP_STACK_TRACE_ENTRIES);
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:483:19: note: in definition of macro 'printk_index_wrap'
     483 |   _p_func(_fmt, ##__VA_ARGS__);    \
         |                   ^~~~~~~~~~~
   include/linux/printk.h:584:2: note: in expansion of macro 'printk'
     584 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~
   kernel/locking/lockdep.c:6819:2: note: in expansion of macro 'pr_info'
    6819 |  pr_info("lockdep: %lu/%lu bootstrap entries, %lu/%lu bootstrap traces used before buddy init, folio_pool active\n",
         |  ^~~~~~~
   kernel/locking/lockdep.c: In function 'lockdep_compact_boot_graph':
   kernel/locking/lockdep.c:6845:26: error: 'lockdep_trace_scratchpad' undeclared (first use in this function); did you mean 'lockdep_trace_stats'?
    6845 |  folio_scratchpad_alloc(&lockdep_trace_scratchpad, sizeof(struct lock_trace) + 32 * sizeof(unsigned long),
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~
         |                          lockdep_trace_stats
   kernel/locking/lockdep.c:6845:59: error: invalid application of 'sizeof' to incomplete type 'struct lock_trace'
    6845 |  folio_scratchpad_alloc(&lockdep_trace_scratchpad, sizeof(struct lock_trace) + 32 * sizeof(unsigned long),
         |                                                           ^~~~~~
   In file included from include/linux/kernel.h:16,
                    from arch/powerpc/include/asm/page.h:11,
                    from arch/powerpc/include/asm/thread_info.h:13,
                    from include/linux/thread_info.h:62,
                    from arch/powerpc/include/asm/ptrace.h:339,
                    from arch/powerpc/include/asm/hw_irq.h:12,
                    from arch/powerpc/include/asm/irqflags.h:12,
                    from include/linux/irqflags.h:18,
                    from include/asm-generic/cmpxchg-local.h:6,
                    from arch/powerpc/include/asm/cmpxchg.h:755,
                    from arch/powerpc/include/asm/atomic.h:11,
                    from include/linux/atomic.h:7,
                    from include/linux/cpumask.h:10,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/mutex.h:17,
                    from kernel/locking/lockdep.c:30:
   kernel/locking/lockdep.c:6855:29: error: 'stack_trace_hash' undeclared (first use in this function); did you mean 'stack_trace_save'?
    6855 |  for (i = 0; i < ARRAY_SIZE(stack_trace_hash); i++) {
         |                             ^~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/mutex.h:15,
                    from kernel/locking/lockdep.c:30:
   include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:28: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                            ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:6855:18: note: in expansion of macro 'ARRAY_SIZE'
    6855 |  for (i = 0; i < ARRAY_SIZE(stack_trace_hash); i++) {
         |                  ^~~~~~~~~~
   In file included from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/mutex.h:15,
                    from kernel/locking/lockdep.c:30:
   include/linux/container_of.h:21:28: error: invalid type argument of unary '*' (have 'int')
      21 |  static_assert(__same_type(*(ptr), ((type *)0)->member) || \
         |                            ^~~~~~
   include/linux/build_bug.h:80:56: note: in definition of macro '__static_assert'
      80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:21:2: note: in expansion of macro 'static_assert'
      21 |  static_assert(__same_type(*(ptr), ((type *)0)->member) || \
         |  ^~~~~~~~~~~~~
   include/linux/container_of.h:21:16: note: in expansion of macro '__same_type'
      21 |  static_assert(__same_type(*(ptr), ((type *)0)->member) || \
         |                ^~~~~~~~~~~
   include/linux/list.h:1183:40: note: in expansion of macro 'container_of'
    1183 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:1194:15: note: in expansion of macro 'hlist_entry'
    1194 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/list.h:1235:13: note: in expansion of macro 'hlist_entry_safe'
    1235 |  for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
         |             ^~~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:6859:3: note: in expansion of macro 'hlist_for_each_entry_safe'
    6859 |   hlist_for_each_entry_safe(trace, n, &stack_trace_hash[i], hash_entry) {
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:1235:52: error: dereferencing pointer to incomplete type 'struct lock_trace'
    1235 |  for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
   include/linux/build_bug.h:80:56: note: in definition of macro '__static_assert'
      80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:21:2: note: in expansion of macro 'static_assert'
      21 |  static_assert(__same_type(*(ptr), ((type *)0)->member) || \
         |  ^~~~~~~~~~~~~
   include/linux/container_of.h:21:16: note: in expansion of macro '__same_type'
      21 |  static_assert(__same_type(*(ptr), ((type *)0)->member) || \
         |                ^~~~~~~~~~~
   include/linux/list.h:1183:40: note: in expansion of macro 'container_of'
    1183 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)


vim +/bootstrap_stack_trace +6777 kernel/locking/lockdep.c

  6772	
  6773	void __init lockdep_init(void)
  6774	{
  6775		bootstrap_entries = early_list_entries;
  6776		bootstrap_entries_in_use = early_list_entries_in_use;
> 6777		bootstrap_stack_trace = early_stack_trace;
> 6778		bootstrap_stack_trace_in_use = &early_stack_trace_in_use;
  6779	
  6780		pr_info("Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\n");
  6781	
  6782		pr_info("... MAX_LOCKDEP_SUBCLASSES:  %lu\n", MAX_LOCKDEP_SUBCLASSES);
  6783		pr_info("... MAX_LOCK_DEPTH:          %lu\n", MAX_LOCK_DEPTH);
  6784		pr_info("... MAX_LOCKDEP_KEYS:        %lu\n", MAX_LOCKDEP_KEYS);
  6785		pr_info("... CLASSHASH_SIZE:          %lu\n", CLASSHASH_SIZE);
  6786		pr_info("... MAX_LOCKDEP_ENTRIES:     %lu\n", MAX_LOCKDEP_ENTRIES);
  6787		pr_info("... MAX_LOCKDEP_CHAINS:      %lu\n", MAX_LOCKDEP_CHAINS);
  6788		pr_info("... CHAINHASH_SIZE:          %lu\n", CHAINHASH_SIZE);
  6789	
  6790		pr_info(" memory used by lock dependency info: %zu kB\n",
  6791		       (sizeof(lock_classes) +
  6792			sizeof(lock_classes_in_use) +
  6793			sizeof(classhash_table) +
  6794			sizeof(early_list_entries) +
  6795			sizeof(early_list_entries_in_use) +
  6796			sizeof(chainhash_table) +
  6797			sizeof(delayed_free)
  6798	#ifdef CONFIG_PROVE_LOCKING
  6799			+ sizeof(lock_cq)
  6800			+ sizeof(lock_chains)
  6801			+ sizeof(lock_chains_in_use)
  6802			+ sizeof(chain_hlocks)
  6803	#endif
  6804			) / 1024
  6805			);
  6806	
  6807	#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
  6808		pr_info(" memory used for stack traces: dynamic (bootstrap %zu kB)\n",
  6809		       sizeof(early_stack_trace) / 1024
  6810		       );
  6811	#endif
  6812	
  6813		pr_info(" per task-struct memory footprint: %zu bytes\n",
  6814		       sizeof(((struct task_struct *)NULL)->held_locks));
  6815	}
  6816	
  6817	static int __init lockdep_boot_report(void)
  6818	{
  6819		pr_info("lockdep: %lu/%lu bootstrap entries, %lu/%lu bootstrap traces used before buddy init, folio_pool active\n",
  6820			min_t(unsigned long, nr_list_entries, BOOTSTRAP_LOCKDEP_ENTRIES),
  6821			BOOTSTRAP_LOCKDEP_ENTRIES,
  6822			early_stack_trace_in_use,
> 6823			(unsigned long)BOOTSTRAP_STACK_TRACE_ENTRIES);
  6824		return 0;
  6825	}
  6826	core_initcall(lockdep_boot_report);
  6827	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.