2020-04-22 12:58:36

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v4 6/7] kernel.h: Split out panic and oops helpers

kernel.h is being used as a dump for all kinds of stuff for a long time.
Here is the attempt to start cleaning it up by splitting out panic and
oops helpers.

At the same time convert users in header and lib folder to use new header.
Though for time being include new header back to kernel.h to avoid twisted
indirected includes for existing users.

Signed-off-by: Andy Shevchenko <[email protected]>
---
v4: new patch
arch/x86/include/asm/desc.h | 1 +
arch/x86/kernel/setup.c | 1 +
include/asm-generic/bug.h | 3 +-
include/linux/kernel.h | 67 +-----------------------------
include/linux/ktime.h | 2 +
include/linux/panic.h | 75 ++++++++++++++++++++++++++++++++++
include/linux/panic_notifier.h | 12 ++++++
include/linux/thread_info.h | 1 +
kernel/kexec_core.c | 1 +
kernel/panic.c | 1 +
kernel/rcu/tree.c | 2 +
kernel/trace/trace.c | 1 +
lib/errseq.c | 1 +
13 files changed, 101 insertions(+), 67 deletions(-)
create mode 100644 include/linux/panic.h
create mode 100644 include/linux/panic_notifier.h

diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 68a99d2a5f335..ac3878ac07091 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -9,6 +9,7 @@
#include <asm/irq_vectors.h>
#include <asm/cpu_entry_area.h>

+#include <linux/debug_locks.h>
#include <linux/smp.h>
#include <linux/percpu.h>

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a3767e74c758c..821960a2b412d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -13,6 +13,7 @@
#include <linux/initrd.h>
#include <linux/iscsi_ibft.h>
#include <linux/memblock.h>
+#include <linux/panic_notifier.h>
#include <linux/pci.h>
#include <linux/root_dev.h>
#include <linux/sfi.h>
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 384b5c835ced3..d3ae3e5b3643e 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -16,7 +16,8 @@
#endif

#ifndef __ASSEMBLY__
-#include <linux/kernel.h>
+#include <linux/panic.h>
+#include <linux/printk.h>

#ifdef CONFIG_BUG

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8a0e5ed1b905a..cd83a57c1b244 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -13,6 +13,7 @@
#include <linux/math.h>
#include <linux/minmax.h>
#include <linux/typecheck.h>
+#include <linux/panic.h>
#include <linux/printk.h>
#include <linux/build_bug.h>

@@ -76,7 +77,6 @@
#define lower_32_bits(n) ((u32)(n))

struct completion;
-struct pt_regs;
struct user;

#ifdef CONFIG_PREEMPT_VOLUNTARY
@@ -159,15 +159,6 @@ void __might_fault(const char *file, int line);
static inline void might_fault(void) { }
#endif

-extern struct atomic_notifier_head panic_notifier_list;
-extern long (*panic_blink)(int state);
-__printf(1, 2)
-void panic(const char *fmt, ...) __noreturn __cold;
-void nmi_panic(struct pt_regs *regs, const char *msg);
-extern void oops_enter(void);
-extern void oops_exit(void);
-void print_oops_end_marker(void);
-extern int oops_may_print(void);
void do_exit(long error_code) __noreturn;
void complete_and_exit(struct completion *, long) __noreturn;

@@ -360,34 +351,7 @@ extern unsigned int sysctl_oops_all_cpu_backtrace;
#endif /* CONFIG_SMP */

extern void bust_spinlocks(int yes);
-extern int panic_timeout;
-extern unsigned long panic_print;
-extern int panic_on_oops;
-extern int panic_on_unrecovered_nmi;
-extern int panic_on_io_nmi;
-extern int panic_on_warn;
-extern int sysctl_panic_on_rcu_stall;
-extern int sysctl_panic_on_stackoverflow;

-extern bool crash_kexec_post_notifiers;
-
-/*
- * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
- * holds a CPU number which is executing panic() currently. A value of
- * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
- */
-extern atomic_t panic_cpu;
-#define PANIC_CPU_INVALID -1
-
-/*
- * Only to be used by arch init code. If the user over-wrote the default
- * CONFIG_PANIC_TIMEOUT, honor it.
- */
-static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
-{
- if (panic_timeout == arch_default_timeout)
- panic_timeout = timeout;
-}
extern const char *print_tainted(void);
enum lockdep_ok {
LOCKDEP_STILL_OK,
@@ -414,35 +378,6 @@ extern enum system_states {
SYSTEM_SUSPEND,
} system_state;

-/* This cannot be an enum because some may be used in assembly source. */
-#define TAINT_PROPRIETARY_MODULE 0
-#define TAINT_FORCED_MODULE 1
-#define TAINT_CPU_OUT_OF_SPEC 2
-#define TAINT_FORCED_RMMOD 3
-#define TAINT_MACHINE_CHECK 4
-#define TAINT_BAD_PAGE 5
-#define TAINT_USER 6
-#define TAINT_DIE 7
-#define TAINT_OVERRIDDEN_ACPI_TABLE 8
-#define TAINT_WARN 9
-#define TAINT_CRAP 10
-#define TAINT_FIRMWARE_WORKAROUND 11
-#define TAINT_OOT_MODULE 12
-#define TAINT_UNSIGNED_MODULE 13
-#define TAINT_SOFTLOCKUP 14
-#define TAINT_LIVEPATCH 15
-#define TAINT_AUX 16
-#define TAINT_RANDSTRUCT 17
-#define TAINT_FLAGS_COUNT 18
-
-struct taint_flag {
- char c_true; /* character printed when tainted */
- char c_false; /* character printed when not tainted */
- bool module; /* also show as a per-module taint flag */
-};
-
-extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
-
extern const char hex_asc[];
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 42d2e6ac35f29..c7aa465a85f77 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -24,6 +24,8 @@
#include <linux/time.h>
#include <linux/jiffies.h>

+#include <asm/bug.h>
+
/* Nanosecond scalar representation for kernel time values */
typedef s64 ktime_t;

diff --git a/include/linux/panic.h b/include/linux/panic.h
new file mode 100644
index 0000000000000..a06e775a5c37f
--- /dev/null
+++ b/include/linux/panic.h
@@ -0,0 +1,75 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PANIC_H
+#define _LINUX_PANIC_H
+
+#include <linux/types.h>
+
+struct pt_regs;
+
+extern long (*panic_blink)(int state);
+__printf(1, 2)
+void panic(const char *fmt, ...) __noreturn __cold;
+void nmi_panic(struct pt_regs *regs, const char *msg);
+extern void oops_enter(void);
+extern void oops_exit(void);
+void print_oops_end_marker(void);
+extern int oops_may_print(void);
+
+extern int panic_timeout;
+extern unsigned long panic_print;
+extern int panic_on_oops;
+extern int panic_on_unrecovered_nmi;
+extern int panic_on_io_nmi;
+extern int panic_on_warn;
+
+extern int sysctl_panic_on_rcu_stall;
+extern int sysctl_panic_on_stackoverflow;
+
+/*
+ * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
+ * holds a CPU number which is executing panic() currently. A value of
+ * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
+ */
+extern atomic_t panic_cpu;
+#define PANIC_CPU_INVALID -1
+
+/*
+ * Only to be used by arch init code. If the user over-wrote the default
+ * CONFIG_PANIC_TIMEOUT, honor it.
+ */
+static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
+{
+ if (panic_timeout == arch_default_timeout)
+ panic_timeout = timeout;
+}
+
+/* This cannot be an enum because some may be used in assembly source. */
+#define TAINT_PROPRIETARY_MODULE 0
+#define TAINT_FORCED_MODULE 1
+#define TAINT_CPU_OUT_OF_SPEC 2
+#define TAINT_FORCED_RMMOD 3
+#define TAINT_MACHINE_CHECK 4
+#define TAINT_BAD_PAGE 5
+#define TAINT_USER 6
+#define TAINT_DIE 7
+#define TAINT_OVERRIDDEN_ACPI_TABLE 8
+#define TAINT_WARN 9
+#define TAINT_CRAP 10
+#define TAINT_FIRMWARE_WORKAROUND 11
+#define TAINT_OOT_MODULE 12
+#define TAINT_UNSIGNED_MODULE 13
+#define TAINT_SOFTLOCKUP 14
+#define TAINT_LIVEPATCH 15
+#define TAINT_AUX 16
+#define TAINT_RANDSTRUCT 17
+#define TAINT_FLAGS_COUNT 18
+
+struct taint_flag {
+ char c_true; /* character printed when tainted */
+ char c_false; /* character printed when not tainted */
+ bool module; /* also show as a per-module taint flag */
+};
+
+extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
+
+#endif /* _LINUX_PANIC_H */
diff --git a/include/linux/panic_notifier.h b/include/linux/panic_notifier.h
new file mode 100644
index 0000000000000..41e32483d7a7b
--- /dev/null
+++ b/include/linux/panic_notifier.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PANIC_NOTIFIERS_H
+#define _LINUX_PANIC_NOTIFIERS_H
+
+#include <linux/notifier.h>
+#include <linux/types.h>
+
+extern struct atomic_notifier_head panic_notifier_list;
+
+extern bool crash_kexec_post_notifiers;
+
+#endif /* _LINUX_PANIC_NOTIFIERS_H */
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index e93e249a4e9bf..7a3033aef28cd 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -35,6 +35,7 @@ enum {
GOOD_STACK,
};

+#include <asm/bug.h>
#include <asm/thread_info.h>

#ifdef __KERNEL__
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index ba1d91e868ca7..077fcf31d5ce9 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -28,6 +28,7 @@
#include <linux/suspend.h>
#include <linux/device.h>
#include <linux/freezer.h>
+#include <linux/panic_notifier.h>
#include <linux/pfn.h>
#include <linux/pm.h>
#include <linux/cpu.h>
diff --git a/kernel/panic.c b/kernel/panic.c
index ec6d7d788ce75..f28a7478e0161 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -23,6 +23,7 @@
#include <linux/reboot.h>
#include <linux/delay.h>
#include <linux/kexec.h>
+#include <linux/panic_notifier.h>
#include <linux/sched.h>
#include <linux/sysrq.h>
#include <linux/init.h>
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 6d39485f7f517..8611f400acd91 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -32,6 +32,8 @@
#include <linux/export.h>
#include <linux/completion.h>
#include <linux/moduleparam.h>
+#include <linux/panic.h>
+#include <linux/panic_notifier.h>
#include <linux/percpu.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8d2b988126250..f23b6ae084b5c 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -39,6 +39,7 @@
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/init.h>
+#include <linux/panic_notifier.h>
#include <linux/poll.h>
#include <linux/nmi.h>
#include <linux/fs.h>
diff --git a/lib/errseq.c b/lib/errseq.c
index 81f9e33aa7e72..93e9b94358dc6 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -3,6 +3,7 @@
#include <linux/bug.h>
#include <linux/atomic.h>
#include <linux/errseq.h>
+#include <linux/log2.h>

/*
* An errseq_t is a way of recording errors in one place, and allowing any
--
2.26.1


2020-04-24 17:09:53

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v4 6/7] kernel.h: Split out panic and oops helpers

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200423]
[cannot apply to tip/locking/core rcu/dev linus/master tip/x86/core v5.7-rc2 v5.7-rc1 v5.6 v5.7-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/drm-shmobile-Reduce-include-dependencies/20200424-044529
base: aefe184e814492e36b2ca350c1522bd71b09b520
config: powerpc-allnoconfig (attached as .config)
compiler: powerpc-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

arch/powerpc/kernel/setup-common.c: In function 'setup_panic':
>> arch/powerpc/kernel/setup-common.c:737:35: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
737 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
arch/powerpc/kernel/setup-common.c:737:35: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/jump_label.h:249,
from arch/powerpc/lib/feature-fixups.c:12:
arch/powerpc/include/asm/cmpxchg.h: In function '__xchg_u8_local':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:23:11: note: in expansion of macro 'BITOFF_CAL'
23 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:83:1: note: in expansion of macro 'XCHG_GEN'
83 | XCHG_GEN(u8, _local, "memory");
| ^~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:12:61: note: each undeclared identifier is reported only once for each function it appears in
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:23:11: note: in expansion of macro 'BITOFF_CAL'
23 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:83:1: note: in expansion of macro 'XCHG_GEN'
83 | XCHG_GEN(u8, _local, "memory");
| ^~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__xchg_u8_relaxed':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:23:11: note: in expansion of macro 'BITOFF_CAL'
23 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:84:1: note: in expansion of macro 'XCHG_GEN'
84 | XCHG_GEN(u8, _relaxed, "cc");
| ^~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__xchg_u16_local':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:23:11: note: in expansion of macro 'BITOFF_CAL'
23 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:85:1: note: in expansion of macro 'XCHG_GEN'
85 | XCHG_GEN(u16, _local, "memory");
| ^~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__xchg_u16_relaxed':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:23:11: note: in expansion of macro 'BITOFF_CAL'
23 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:86:1: note: in expansion of macro 'XCHG_GEN'
86 | XCHG_GEN(u16, _relaxed, "cc");
| ^~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u8':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
>> arch/powerpc/include/asm/cmpxchg.h:213:1: note: in expansion of macro 'CMPXCHG_GEN'
213 | CMPXCHG_GEN(u8, , PPC_ATOMIC_ENTRY_BARRIER, PPC_ATOMIC_EXIT_BARRIER, "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u8_local':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:214:1: note: in expansion of macro 'CMPXCHG_GEN'
214 | CMPXCHG_GEN(u8, _local, , , "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u8_acquire':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:215:1: note: in expansion of macro 'CMPXCHG_GEN'
215 | CMPXCHG_GEN(u8, _acquire, , PPC_ACQUIRE_BARRIER, "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u8_relaxed':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:216:1: note: in expansion of macro 'CMPXCHG_GEN'
216 | CMPXCHG_GEN(u8, _relaxed, , , "cc");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u16':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:217:1: note: in expansion of macro 'CMPXCHG_GEN'
217 | CMPXCHG_GEN(u16, , PPC_ATOMIC_ENTRY_BARRIER, PPC_ATOMIC_EXIT_BARRIER, "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u16_local':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:218:1: note: in expansion of macro 'CMPXCHG_GEN'
218 | CMPXCHG_GEN(u16, _local, , , "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u16_acquire':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:219:1: note: in expansion of macro 'CMPXCHG_GEN'
219 | CMPXCHG_GEN(u16, _acquire, , PPC_ACQUIRE_BARRIER, "memory");
| ^~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h: In function '__cmpxchg_u16_relaxed':
>> arch/powerpc/include/asm/cmpxchg.h:12:61: error: 'BITS_PER_BYTE' undeclared (first use in this function); did you mean 'BITS_PER_LONG'?
12 | #define BITOFF_CAL(size, off) ((sizeof(u32) - size - off) * BITS_PER_BYTE)
| ^~~~~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:49:11: note: in expansion of macro 'BITOFF_CAL'
49 | bitoff = BITOFF_CAL(sizeof(type), off); \
| ^~~~~~~~~~
arch/powerpc/include/asm/cmpxchg.h:220:1: note: in expansion of macro 'CMPXCHG_GEN'
220 | CMPXCHG_GEN(u16, _relaxed, , , "cc");
| ^~~~~~~~~~~

vim +737 arch/powerpc/kernel/setup-common.c

921a79b7802078 Jason Yan 2019-09-20 733
ab9dbf771ff9b6 David Gibson 2017-12-04 734 void __init setup_panic(void)
ab9dbf771ff9b6 David Gibson 2017-12-04 735 {
921a79b7802078 Jason Yan 2019-09-20 736 if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_offset() > 0)
921a79b7802078 Jason Yan 2019-09-20 @737 atomic_notifier_chain_register(&panic_notifier_list,
921a79b7802078 Jason Yan 2019-09-20 738 &kernel_offset_notifier);
921a79b7802078 Jason Yan 2019-09-20 739
855b6232dda2b6 Nicholas Piggin 2018-05-19 740 /* PPC64 always does a hard irq disable in its panic handler */
855b6232dda2b6 Nicholas Piggin 2018-05-19 741 if (!IS_ENABLED(CONFIG_PPC64) && !ppc_md.panic)
ab9dbf771ff9b6 David Gibson 2017-12-04 742 return;
ab9dbf771ff9b6 David Gibson 2017-12-04 743 atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
ab9dbf771ff9b6 David Gibson 2017-12-04 744 }
ab9dbf771ff9b6 David Gibson 2017-12-04 745

:::::: The code at line 737 was first introduced by commit
:::::: 921a79b7802078fab3787c7eae561536906cb8f3 powerpc/fsl_booke/kaslr: dump out kernel offset information on panic

:::::: TO: Jason Yan <[email protected]>
:::::: CC: Michael Ellerman <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (12.55 kB)
.config.gz (6.31 kB)
Download all attachments

2020-04-24 17:32:29

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v4 6/7] kernel.h: Split out panic and oops helpers

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200423]
[cannot apply to tip/locking/core rcu/dev linus/master tip/x86/core v5.7-rc2 v5.7-rc1 v5.6 v5.7-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/drm-shmobile-Reduce-include-dependencies/20200424-044529
base: aefe184e814492e36b2ca350c1522bd71b09b520
config: sh-allmodconfig (attached as .config)
compiler: sh4-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=sh

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/char/ipmi/ipmi_msghandler.c: In function 'ipmi_init_msghandler':
>> drivers/char/ipmi/ipmi_msghandler.c:5145:34: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
5145 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/char/ipmi/ipmi_msghandler.c:5145:34: note: each undeclared identifier is reported only once for each function it appears in
drivers/char/ipmi/ipmi_msghandler.c: In function 'cleanup_ipmi':
drivers/char/ipmi/ipmi_msghandler.c:5172:37: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
5172 | atomic_notifier_chain_unregister(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/misc/pvpanic.c: In function 'pvpanic_mmio_probe':
>> drivers/misc/pvpanic.c:156:34: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
156 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/misc/pvpanic.c:156:34: note: each undeclared identifier is reported only once for each function it appears in
drivers/misc/pvpanic.c: In function 'pvpanic_mmio_remove':
drivers/misc/pvpanic.c:165:36: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
165 | atomic_notifier_chain_unregister(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/remoteproc/remoteproc_core.c: In function 'rproc_init_panic':
>> drivers/remoteproc/remoteproc_core.c:2383:34: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
2383 | atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb);
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/remoteproc/remoteproc_core.c:2383:34: note: each undeclared identifier is reported only once for each function it appears in
drivers/remoteproc/remoteproc_core.c: In function 'rproc_exit_panic':
drivers/remoteproc/remoteproc_core.c:2388:36: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
2388 | atomic_notifier_chain_unregister(&panic_notifier_list, &rproc_panic_nb);
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/power/reset/ltc2952-poweroff.c: In function 'ltc2952_poweroff_probe':
>> drivers/power/reset/ltc2952-poweroff.c:276:34: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
276 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/power/reset/ltc2952-poweroff.c:276:34: note: each undeclared identifier is reported only once for each function it appears in
drivers/power/reset/ltc2952-poweroff.c: In function 'ltc2952_poweroff_remove':
drivers/power/reset/ltc2952-poweroff.c:290:36: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
290 | atomic_notifier_chain_unregister(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/leds/trigger/ledtrig-heartbeat.c: In function 'heartbeat_trig_init':
>> drivers/leds/trigger/ledtrig-heartbeat.c:192:35: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
192 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/leds/trigger/ledtrig-heartbeat.c:192:35: note: each undeclared identifier is reported only once for each function it appears in
drivers/leds/trigger/ledtrig-heartbeat.c: In function 'heartbeat_trig_exit':
drivers/leds/trigger/ledtrig-heartbeat.c:202:36: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
202 | atomic_notifier_chain_unregister(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/leds/trigger/ledtrig-activity.c: In function 'activity_init':
>> drivers/leds/trigger/ledtrig-activity.c:249:35: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
249 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/leds/trigger/ledtrig-activity.c:249:35: note: each undeclared identifier is reported only once for each function it appears in
drivers/leds/trigger/ledtrig-activity.c: In function 'activity_exit':
drivers/leds/trigger/ledtrig-activity.c:259:36: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
259 | atomic_notifier_chain_unregister(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
--
drivers/leds/trigger/ledtrig-panic.c: In function 'ledtrig_panic_init':
>> drivers/leds/trigger/ledtrig-panic.c:66:34: error: 'panic_notifier_list' undeclared (first use in this function); did you mean 'reboot_notifier_list'?
66 | atomic_notifier_chain_register(&panic_notifier_list,
| ^~~~~~~~~~~~~~~~~~~
| reboot_notifier_list
drivers/leds/trigger/ledtrig-panic.c:66:34: note: each undeclared identifier is reported only once for each function it appears in

vim +5145 drivers/char/ipmi/ipmi_msghandler.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 5128
^1da177e4c3f41 Linus Torvalds 2005-04-16 5129 static int ipmi_init_msghandler(void)
^1da177e4c3f41 Linus Torvalds 2005-04-16 5130 {
50c812b2b9513e Corey Minyard 2006-03-26 5131 int rv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5132
913a89f009d98c Corey Minyard 2018-12-20 5133 mutex_lock(&ipmi_interfaces_mutex);
913a89f009d98c Corey Minyard 2018-12-20 5134 rv = ipmi_register_driver();
913a89f009d98c Corey Minyard 2018-12-20 5135 if (rv)
913a89f009d98c Corey Minyard 2018-12-20 5136 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5137 if (initialized)
913a89f009d98c Corey Minyard 2018-12-20 5138 goto out;
50c812b2b9513e Corey Minyard 2006-03-26 5139
913a89f009d98c Corey Minyard 2018-12-20 5140 init_srcu_struct(&ipmi_interfaces_srcu);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5141
e99e88a9d2b067 Kees Cook 2017-10-16 5142 timer_setup(&ipmi_timer, ipmi_timeout, 0);
409035e088ce15 Corey Minyard 2006-06-28 5143 mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5144
e041c683412d5b Alan Stern 2006-03-27 @5145 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5146
913a89f009d98c Corey Minyard 2018-12-20 5147 initialized = true;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5148
913a89f009d98c Corey Minyard 2018-12-20 5149 out:
913a89f009d98c Corey Minyard 2018-12-20 5150 mutex_unlock(&ipmi_interfaces_mutex);
913a89f009d98c Corey Minyard 2018-12-20 5151 return rv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5152 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 5153

:::::: The code at line 5145 was first introduced by commit
:::::: e041c683412d5bf44dc2b109053e3b837b71742d [PATCH] Notifier chain update: API changes

:::::: TO: Alan Stern <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (9.70 kB)
.config.gz (53.68 kB)
Download all attachments