Skip to contentSkip to conversation

drm: shmobile: Reduce include dependencies

PATCH In review Andy Shevchenko 4 participants 15 messages Apr 22, 2020 – Apr 24, 2020

Subsystems (20)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/7 drm: shmobile: Reduce include dependencies

This file doesn't need anything provided by <linux/kernel.h>. All it needs are some types, which are provided by <drm/drm_mode.h>.

Drop unneeded <linux/kernel.h> completely.

---
v4: new patch (reviewed by driver maintainer)

 include/linux/platform_data/shmob_drm.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/platform_data/shmob_drm.h +0 -2
index fe815d7d9f58c..d661399b217df 100644
@@ -10,8 +10,6 @@
 #ifndef __SHMOB_DRM_H__
 #define __SHMOB_DRM_H__
 
-#include <linux/kernel.h>
-
 #include <drm/drm_mode.h>
 
 enum shmob_drm_clk_source {
Signature · 1 line
2.26.1
#8 lore raw

PATCH v4 5/7 kernel.h: Split out mathematical 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 mathematical 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.

---
v4: rebase on latest kernel

 fs/nfs/callback_proc.c        |   5 +
 include/linux/bitops.h        |  11 ++-
 include/linux/dcache.h        |   1 +
 include/linux/iommu-helper.h  |   4 +-
 include/linux/kernel.h        | 174 +--------------------------------
 include/linux/math.h          | 177 ++++++++++++++++++++++++++++++++++
 include/linux/rcu_node_tree.h |   2 +
 include/linux/units.h         |   2 +-
 lib/errname.c                 |   1 +
 lib/find_bit.c                |   3 +-
 lib/math/div64.c              |   3 +-
 lib/math/int_pow.c            |   2 +-
 lib/math/int_sqrt.c           |   3 +-
 lib/math/reciprocal_div.c     |   9 +-
 14 files changed, 213 insertions(+), 184 deletions(-)
 create mode 100644 include/linux/math.h
fs/nfs/callback_proc.c +5 -0
index e61dbc9b86ae2..f7786e00a6a7f 100644
@@ -6,10 +6,15 @@
  *
  * NFSv4 callback procedures
  */
+
+#include <linux/errno.h>
+#include <linux/math.h>
 #include <linux/nfs4.h>
 #include <linux/nfs_fs.h>
 #include <linux/slab.h>
 #include <linux/rcupdate.h>
+#include <linux/types.h>
+
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
include/linux/bitops.h +7 -4
index 9acf654f0b191..72c911779f45d 100644
@@ -1,9 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef _LINUX_BITOPS_H
 #define _LINUX_BITOPS_H
+
 #include <asm/types.h>
 #include <linux/bits.h>
 
+#include <uapi/linux/kernel.h>
+
 /* Set bits in the first 'n' bytes when loaded from memory */
 #ifdef __LITTLE_ENDIAN
 #  define aligned_byte_mask(n) ((1UL << 8*(n))-1)
@@ -12,10 +15,10 @@
 #endif
 
 #define BITS_PER_TYPE(type)	(sizeof(type) * BITS_PER_BYTE)
-#define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
-#define BITS_TO_U64(nr)		DIV_ROUND_UP(nr, BITS_PER_TYPE(u64))
-#define BITS_TO_U32(nr)		DIV_ROUND_UP(nr, BITS_PER_TYPE(u32))
-#define BITS_TO_BYTES(nr)	DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
+#define BITS_TO_LONGS(nr)	__KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
+#define BITS_TO_U64(nr)		__KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u64))
+#define BITS_TO_U32(nr)		__KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u32))
+#define BITS_TO_BYTES(nr)	__KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
 
 extern unsigned int __sw_hweight8(unsigned int w);
 extern unsigned int __sw_hweight16(unsigned int w);
include/linux/dcache.h +1 -0
index c1488cc84fd94..096e04b7f38dc 100644
@@ -4,6 +4,7 @@
 
 #include <linux/atomic.h>
 #include <linux/list.h>
+#include <linux/math.h>
 #include <linux/rculist.h>
 #include <linux/rculist_bl.h>
 #include <linux/spinlock.h>
include/linux/iommu-helper.h +3 -1
index 70d01edcbf8be..74be34f3a20ac 100644
@@ -3,7 +3,9 @@
 #define _LINUX_IOMMU_HELPER_H
 
 #include <linux/bug.h>
-#include <linux/kernel.h>
+#include <linux/log2.h>
+#include <linux/math.h>
+#include <linux/types.h>
 
 static inline unsigned long iommu_device_max_index(unsigned long size,
 						   unsigned long offset,
include/linux/kernel.h +3 -171

215 lines not on this page · raw message

include/linux/math.h new file +177 -0

177 lines not on this page · raw message

include/linux/rcu_node_tree.h +2 -0
index b8e094b125ee6..78feb8ba73585 100644
@@ -20,6 +20,8 @@
 #ifndef __LINUX_RCU_NODE_TREE_H
 #define __LINUX_RCU_NODE_TREE_H
 
+#include <linux/math.h>
+
 /*
  * Define shape of hierarchy based on NR_CPUS, CONFIG_RCU_FANOUT, and
  * CONFIG_RCU_FANOUT_LEAF.
include/linux/units.h +1 -1
index aaf716364ec34..5c115c809507f 100644
@@ -2,7 +2,7 @@
 #ifndef _LINUX_UNITS_H
 #define _LINUX_UNITS_H
 
-#include <linux/kernel.h>
+#include <linux/math.h>
 
 #define ABSOLUTE_ZERO_MILLICELSIUS -273150
 
lib/errname.c +1 -0
index 0c4d3e66170e9..05cbf731545f0 100644
@@ -3,6 +3,7 @@
 #include <linux/errno.h>
 #include <linux/errname.h>
 #include <linux/kernel.h>
+#include <linux/math.h>
 
 /*
  * Ensure these tables do not accidentally become gigantic if some
lib/find_bit.c +2 -1
index 4a8751010d59f..f67f86fd2f620 100644
@@ -15,8 +15,9 @@
 #include <linux/bitops.h>
 #include <linux/bitmap.h>
 #include <linux/export.h>
-#include <linux/kernel.h>
+#include <linux/math.h>
 #include <linux/minmax.h>
+#include <linux/swab.h>
 
 #if !defined(find_next_bit) || !defined(find_next_zero_bit) ||			\
 	!defined(find_next_bit_le) || !defined(find_next_zero_bit_le) ||	\
lib/math/div64.c +2 -1
index 368ca7fd0d828..259303233610e 100644
@@ -18,8 +18,9 @@
  * or by defining a preprocessor macro in arch/include/asm/div64.h.
  */
 
+#include <linux/bitops.h>
 #include <linux/export.h>
-#include <linux/kernel.h>
+#include <linux/math.h>
 #include <linux/math64.h>
 
 /* Not needed on 64bit architectures */
lib/math/int_pow.c +1 -1
index 622fc1ab3c745..0cf426e69bdaa 100644
@@ -6,7 +6,7 @@
  */
 
 #include <linux/export.h>
-#include <linux/kernel.h>
+#include <linux/math.h>
 #include <linux/types.h>
 
 /**
lib/math/int_sqrt.c +2 -1
index 30e0f9770f88c..a8170bb9142f3 100644
@@ -6,9 +6,10 @@
  *  square root from Guy L. Steele.
  */
 
-#include <linux/kernel.h>
 #include <linux/export.h>
 #include <linux/bitops.h>
+#include <linux/limits.h>
+#include <linux/math.h>
 
 /**
  * int_sqrt - computes the integer square root
lib/math/reciprocal_div.c +6 -3
index 32436dd4171e9..6cb4adbb81d27 100644
@@ -1,10 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <linux/bitops.h>
 #include <linux/bug.h>
-#include <linux/kernel.h>
-#include <asm/div64.h>
-#include <linux/reciprocal_div.h>
 #include <linux/export.h>
+#include <linux/limits.h>
+#include <linux/math.h>
 #include <linux/minmax.h>
+#include <linux/types.h>
+
+#include <linux/reciprocal_div.h>
 
 /*
  * For a description of the algorithm please have a look at
Signature · 1 line
2.26.1
#3 lore raw

PATCH v4 4/7 kernel.h: Split out min()/max() et al helpers

In reply to Andy Shevchenko

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 min()/max() et al 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.

---
v4: rebase on latest kernel

 include/linux/blkdev.h    |   1 +
 include/linux/bvec.h      |   6 +-
 include/linux/jiffies.h   |   3 +-
 include/linux/kernel.h    | 142 +------------------------------------
 include/linux/minmax.h    | 145 ++++++++++++++++++++++++++++++++++++++
 include/linux/nodemask.h  |   2 +-
 include/linux/uaccess.h   |   1 +
 kernel/range.c            |   3 +-
 lib/find_bit.c            |   1 +
 lib/hexdump.c             |   1 +
 lib/math/rational.c       |   2 +-
 lib/math/reciprocal_div.c |   1 +
 12 files changed, 162 insertions(+), 146 deletions(-)
 create mode 100644 include/linux/minmax.h
include/linux/blkdev.h +1 -0
index 32868fbedc9e9..e39853ebf9c21 100644
@@ -11,6 +11,7 @@
 #include <linux/genhd.h>
 #include <linux/list.h>
 #include <linux/llist.h>
+#include <linux/minmax.h>
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <linux/pagemap.h>
include/linux/bvec.h +5 -1
index a81c13ac19728..56d4dec749263 100644
@@ -7,10 +7,14 @@
 #ifndef __LINUX_BVEC_ITER_H
 #define __LINUX_BVEC_ITER_H
 
-#include <linux/kernel.h>
 #include <linux/bug.h>
 #include <linux/errno.h>
+#include <linux/limits.h>
+#include <linux/minmax.h>
 #include <linux/mm.h>
+#include <linux/types.h>
+
+struct page;
 
 /*
  * was unsigned short, but we might as well be ready for > 64kB I/O pages
include/linux/jiffies.h +2 -1
index fed6ba96c5278..5e13f801c9021 100644
@@ -3,8 +3,9 @@
 #define _LINUX_JIFFIES_H
 
 #include <linux/cache.h>
+#include <linux/limits.h>
 #include <linux/math64.h>
-#include <linux/kernel.h>
+#include <linux/minmax.h>
 #include <linux/types.h>
 #include <linux/time.h>
 #include <linux/timex.h>
include/linux/kernel.h +1 -141

154 lines not on this page · raw message

include/linux/minmax.h new file +145 -0

145 lines not on this page · raw message

include/linux/nodemask.h +1 -1
index 27e7fa36f707f..7f38399cc9fe7 100644
@@ -90,9 +90,9 @@
  * for such situations. See below and CPUMASK_ALLOC also.
  */
 
-#include <linux/kernel.h>
 #include <linux/threads.h>
 #include <linux/bitmap.h>
+#include <linux/minmax.h>
 #include <linux/numa.h>
 
 typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
include/linux/uaccess.h +1 -0
index 8a215c5c1aed8..cb11957a017f6 100644
@@ -3,6 +3,7 @@
 #define __LINUX_UACCESS_H__
 
 #include <linux/instrumented.h>
+#include <linux/minmax.h>
 #include <linux/sched.h>
 #include <linux/thread_info.h>
 
kernel/range.c +2 -1
index d84de6766472d..56435f96da73b 100644
@@ -2,8 +2,9 @@
 /*
  * Range add and subtract
  */
-#include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/minmax.h>
+#include <linux/printk.h>
 #include <linux/sort.h>
 #include <linux/string.h>
 #include <linux/range.h>
lib/find_bit.c +1 -0
index 49f875f1baf7e..4a8751010d59f 100644
@@ -16,6 +16,7 @@
 #include <linux/bitmap.h>
 #include <linux/export.h>
 #include <linux/kernel.h>
+#include <linux/minmax.h>
 
 #if !defined(find_next_bit) || !defined(find_next_zero_bit) ||			\
 	!defined(find_next_bit_le) || !defined(find_next_zero_bit_le) ||	\
lib/hexdump.c +1 -0
index 147133f8eb2fc..9301578f98e8c 100644
@@ -7,6 +7,7 @@
 #include <linux/ctype.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/minmax.h>
 #include <linux/export.h>
 #include <asm/unaligned.h>
 
lib/math/rational.c +1 -1
index 31fb27db2deb5..d8e985850d10c 100644
@@ -11,7 +11,7 @@
 #include <linux/rational.h>
 #include <linux/compiler.h>
 #include <linux/export.h>
-#include <linux/kernel.h>
+#include <linux/minmax.h>
 
 /*
  * calculate best rational approximation for a given fraction
lib/math/reciprocal_div.c +1 -0
index bf043258fa008..32436dd4171e9 100644
@@ -4,6 +4,7 @@
 #include <asm/div64.h>
 #include <linux/reciprocal_div.h>
 #include <linux/export.h>
+#include <linux/minmax.h>
 
 /*
  * For a description of the algorithm please have a look at
Signature · 1 line
2.26.1
#9 lore raw

PATCH v4 6/7 kernel.h: Split out panic and oops helpers

In reply to Andy Shevchenko

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.

---
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
arch/x86/include/asm/desc.h +1 -0
index 68a99d2a5f335..ac3878ac07091 100644
@@ -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>
 
arch/x86/kernel/setup.c +1 -0
index a3767e74c758c..821960a2b412d 100644
@@ -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>
include/asm-generic/bug.h +2 -1
index 384b5c835ced3..d3ae3e5b3643e 100644
@@ -16,7 +16,8 @@
 #endif
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
+#include <linux/panic.h>
+#include <linux/printk.h>
 
 #ifdef CONFIG_BUG
 
include/linux/kernel.h +1 -66

98 lines not on this page · raw message

include/linux/ktime.h +2 -0
index 42d2e6ac35f29..c7aa465a85f77 100644
@@ -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;
 
include/linux/panic.h new file +75 -0

75 lines not on this page · raw message

include/linux/panic_notifier.h new file +12 -0
new file mode 100644
index 0000000000000..41e32483d7a7b
@@ -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 */
include/linux/thread_info.h +1 -0
index e93e249a4e9bf..7a3033aef28cd 100644
@@ -35,6 +35,7 @@ enum {
 	GOOD_STACK,
 };
 
+#include <asm/bug.h>
 #include <asm/thread_info.h>
 
 #ifdef __KERNEL__
kernel/kexec_core.c +1 -0
index ba1d91e868ca7..077fcf31d5ce9 100644
@@ -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>
kernel/panic.c +1 -0
index ec6d7d788ce75..f28a7478e0161 100644
@@ -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>
kernel/rcu/tree.c +2 -0
index 6d39485f7f517..8611f400acd91 100644
@@ -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>
kernel/trace/trace.c +1 -0
index 8d2b988126250..f23b6ae084b5c 100644
@@ -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>
lib/errseq.c +1 -0
index 81f9e33aa7e72..93e9b94358dc6 100644
@@ -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
Signature · 1 line
2.26.1
#12 lore raw

PATCH v4 7/7 kernel.h: Split out might_sleep() and friends

In reply to Andy Shevchenko

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 might_sleep() and friends.

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

---
v4: rebase on latest kernel and previous patches in the series

 crypto/asymmetric_keys/pkcs7_trust.c |  3 +-
 include/linux/kernel.h               | 67 +------------------------
 include/linux/might_sleep.h          | 73 ++++++++++++++++++++++++++++
 include/linux/percpu-rwsem.h         |  1 +
 include/linux/sched.h                |  1 +
 include/linux/wait_bit.h             |  1 +
 6 files changed, 79 insertions(+), 67 deletions(-)
 create mode 100644 include/linux/might_sleep.h
crypto/asymmetric_keys/pkcs7_trust.c +2 -1
index 61af3c4d82ccf..9a3f0c3cafa27 100644
@@ -6,8 +6,9 @@
  */
 
 #define pr_fmt(fmt) "PKCS7: "fmt
-#include <linux/kernel.h>
 #include <linux/export.h>
+#include <linux/might_sleep.h>
+#include <linux/printk.h>
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/asn1.h>
include/linux/kernel.h +1 -66

79 lines not on this page · raw message

include/linux/might_sleep.h new file +73 -0

73 lines not on this page · raw message

include/linux/percpu-rwsem.h +1 -0
index 5e033fe1ff4e9..504cb587cf7ea 100644
@@ -3,6 +3,7 @@
 #define _LINUX_PERCPU_RWSEM_H
 
 #include <linux/atomic.h>
+#include <linux/might_sleep.h>
 #include <linux/percpu.h>
 #include <linux/rcuwait.h>
 #include <linux/wait.h>
include/linux/sched.h +1 -0
index 36306c7d2afcc..7acc5a2df398e 100644
@@ -15,6 +15,7 @@
 #include <linux/sem.h>
 #include <linux/shm.h>
 #include <linux/kcov.h>
+#include <linux/might_sleep.h>
 #include <linux/mutex.h>
 #include <linux/plist.h>
 #include <linux/hrtimer.h>
include/linux/wait_bit.h +1 -0
index 7dec36aecbd9f..324cdbf5b4a49 100644
@@ -5,6 +5,7 @@
 /*
  * Linux wait-bit related types and methods:
  */
+#include <linux/might_sleep.h>
 #include <linux/wait.h>
 
 struct wait_bit_key {
Signature · 1 line
2.26.1
#2 lore raw

PATCH v4 3/7 kernel.h: Move oops_in_progress to printk.h

In reply to Andy Shevchenko

The oops_in_progress is defined in printk.c, so it's logical to move oops_in_progress to printk.h.

---
v4: new patch

 include/linux/debug_locks.h | 2 +-
 include/linux/kernel.h      | 1 -
 include/linux/printk.h      | 2 ++
 3 files changed, 3 insertions(+), 2 deletions(-)
include/linux/debug_locks.h +1 -1
index 257ab3c92cb8a..e5ffbc25475a0 100644
@@ -2,9 +2,9 @@
 #ifndef __LINUX_DEBUG_LOCKING_H
 #define __LINUX_DEBUG_LOCKING_H
 
-#include <linux/kernel.h>
 #include <linux/atomic.h>
 #include <linux/bug.h>
+#include <linux/printk.h>
 
 struct task_struct;
 
include/linux/kernel.h +0 -1
index 04a5885cec1b4..899302e2b7554 100644
@@ -527,7 +527,6 @@ extern unsigned int sysctl_oops_all_cpu_backtrace;
 #endif /* CONFIG_SMP */
 
 extern void bust_spinlocks(int yes);
-extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern unsigned long panic_print;
 extern int panic_on_oops;
include/linux/printk.h +2 -0
index 768ac6bc637df..c59fdf688d36c 100644
@@ -11,6 +11,8 @@
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
 
+extern int oops_in_progress;	/* If set, an oops, panic(), BUG() or die() is in progress */
+
 #define PRINTK_MAX_SINGLE_HEADER_LEN 2
 
 static inline int printk_get_level(const char *buffer)
Signature · 1 line
2.26.1
#1 lore raw

PATCH v4 2/7 kernel.h: Drop unneeded <linux/kernel.h> inclusion from other headers

In reply to Andy Shevchenko

There is no evidence we need kernel.h inclusion in certain headers. Drop unneeded <linux/kernel.h> inclusion from other headers.

---
v4: new patch

 include/linux/rwsem.h    | 1 -
 include/linux/spinlock.h | 1 -
 2 files changed, 2 deletions(-)
include/linux/rwsem.h +0 -1
index 7e5b2a4eb5606..03637adbd8b59 100644
@@ -11,7 +11,6 @@
 #include <linux/linkage.h>
 
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
include/linux/spinlock.h +0 -1
index d3770b3f9d9a9..6c3789686bab8 100644
@@ -53,7 +53,6 @@
 #include <linux/compiler.h>
 #include <linux/irqflags.h>
 #include <linux/thread_info.h>
-#include <linux/kernel.h>
 #include <linux/stringify.h>
 #include <linux/bottom_half.h>
 #include <asm/barrier.h>
Signature · 1 line
2.26.1
#4 lore raw

Re: [PATCH v4 4/7] kernel.h: Split out min()/max() et al helpers

In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

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 min()/max() et al helpers.

While adding organization into kernel.h by splitting out various bits into separate files is a fine idea, I believe removing the generic #include <linux/kernel.h> from various files and substituting the sub-includes is not a good idea.

Quoted 3 lines

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.

Yeah, that's the difficult bit and it could make using precompiled headers very cumbersome.

I'd rather make #include <linux/kernel.h>" _more_ common or even used as the mandatory first #include for all kernel .c files.

That would also ensure that common kernel facilities are not duplicated or have naming conflicts with other files.

#5 lore raw

Re: [PATCH v4 4/7] kernel.h: Split out min()/max() et al helpers

Quoted 10 lines · Joe Perches
Quoted 3 lines · Andy Shevchenko

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 min()/max() et al helpers.

While adding organization into kernel.h by splitting out various bits into separate files is a fine idea, I believe removing the generic #include <linux/kernel.h> from various files and substituting the sub-includes is not a good idea.

Are you sure?

Quoted 10 lines
Quoted 3 lines

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.

Yeah, that's the difficult bit and it could make using precompiled headers very cumbersome.

I'd rather make #include <linux/kernel.h>" _more_ common or even used as the mandatory first #include for all kernel .c files.

Huh?

Perhaps we may just cat include/linux/* > include/linux/kernel.h?

Quoted 3 lines

That would also ensure that common kernel facilities are not duplicated or have naming conflicts with other files.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Re: [PATCH v4 4/7] kernel.h: Split out min()/max() et al helpers

Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Joe Perches
Quoted 3 lines · Andy Shevchenko

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 min()/max() et al helpers.

Quoted 7 lines
Quoted 5 lines

While adding organization into kernel.h by splitting out various bits into separate files is a fine idea, I believe removing the generic #include <linux/kernel.h> from various files and substituting the sub-includes is not a good idea.

Are you sure?

Yes.

Quoted 1 line

Perhaps we may just cat include/linux/* > include/linux/kernel.h?

Silly argument, There's a real argument to be made to tmove many of the files in include/linux to separate directories or out of include/ altogether to subsystem specific locations.

#7 lore raw

Re: [PATCH v4 4/7] kernel.h: Split out min()/max() et al helpers

In reply to Joe Perches
Quoted 8 lines · Joe Perches
Quoted 3 lines · Andy Shevchenko

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.

Yeah, that's the difficult bit and it could make using precompiled headers very cumbersome.

You mentioned precompiled headers last time as well, but you haven't demonstrated that using those is either feasible or advantageous - and if at some distant future time it turns out that they are a good idea, it's not really any more difficult at that time to do a linux/kitchen_sink.h that includes whatever common set of headers seems to provide a reasonable speedup.

Meanwhile, the sheer size of the headers that gets pulled into each and every TU currently slows down the build:

https://wildmoose.dk/header-bloat/

so anything that reduces the size of common headers like kernel.h will improve build times (the slowdown is "death by a thousand cuts", hence so will any individual improvement be hard or impossible to measure by itself - that doesn't mean it's not worth doing them). Of course, the include of minmax.h (et al) from kernel.h must be removed, but that's the kind of thing that can easily take a couple of cycles to get done, unlike the damage that adding #include <linux/foo.h> to bar.h immediately causes.

Quoted 3 lines

I'd rather make #include <linux/kernel.h>" _more_ common or even used as the mandatory first #include for all kernel .c files.

No. Please no.

Quoted 3 lines

That would also ensure that common kernel facilities are not duplicated or have naming conflicts with other files.

What? People duplicate functionality because they're not aware it already exists, forcing an #include of a declaration of some function doesn't make any developer know about it.

Rasmus

#13 lore raw

Re: [PATCH v4 7/7] kernel.h: Split out might_sleep() and friends

In reply to Andy Shevchenko
I love your patch! Yet something to improve:

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: mips-malta_kvm_guest_defconfig (attached as .config)
compiler: mipsel-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=mips

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from include/linux/cpumask.h:12,
from arch/mips/include/asm/processor.h:15, from arch/mips/include/asm/thread_info.h:16, from include/linux/thread_info.h:39, from include/asm-generic/current.h:5, from ./arch/mips/include/generated/asm/current.h:1, from include/linux/might_sleep.h:6,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/preempt.h:11,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/compat.h:10,
from arch/mips/kernel/asm-offsets.c:12:
include/linux/bitmap.h: In function 'bitmap_equal':

>> include/linux/bitmap.h:339:6: error: implicit declaration of function 'IS_ALIGNED' [-Werror=implicit-function-declaration]
     339 |      IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
         |      ^~~~~~~~~~

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:100: arch/mips/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1142: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:180: sub-make] Error 2

vim +/IS_ALIGNED +339 include/linux/bitmap.h

21035965f60b050 Omar Sandoval      2018-04-02  332  
^1da177e4c3f415 Linus Torvalds     2005-04-16  333  static inline int bitmap_equal(const unsigned long *src1,
3d6684f4e6a46f3 Rasmus Villemoes   2014-08-06  334  			const unsigned long *src2, unsigned int nbits)
^1da177e4c3f415 Linus Torvalds     2005-04-16  335  {
4b0bc0bca83f3fb Rusty Russell      2008-12-30  336  	if (small_const_nbits(nbits))
^1da177e4c3f415 Linus Torvalds     2005-04-16  337  		return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
21035965f60b050 Omar Sandoval      2018-04-02  338  	if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
21035965f60b050 Omar Sandoval      2018-04-02 @339  	    IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
7dd968163f7c12b Martin Schwidefsky 2016-05-25  340  		return !memcmp(src1, src2, nbits / 8);
^1da177e4c3f415 Linus Torvalds     2005-04-16  341  	return __bitmap_equal(src1, src2, nbits);
^1da177e4c3f415 Linus Torvalds     2005-04-16  342  }
^1da177e4c3f415 Linus Torvalds     2005-04-16  343  

:::::: The code at line 339 was first introduced by commit
:::::: 21035965f60b0502fc6537b232839389bb4ce664 bitmap: fix memset optimization on big-endian systems

:::::: TO: Omar Sandoval <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

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

#10 lore raw

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

In reply to Andy Shevchenko
I love your patch! Yet something to improve:

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

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/kbuild-all(a)lists.01.org

#11 lore raw

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

In reply to Andy Shevchenko
I love your patch! Yet something to improve:

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

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/kbuild-all(a)lists.01.org

#14 lore raw

Re: [PATCH v4 7/7] kernel.h: Split out might_sleep() and friends

In reply to Andy Shevchenko
I love your patch! Yet something to improve:

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: parisc-allnoconfig (attached as .config)
compiler: hppa-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=parisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from include/asm-generic/current.h:5,
from ./arch/parisc/include/generated/asm/current.h:1, from include/linux/might_sleep.h:6,
from include/linux/kernel.h:14,
from arch/parisc/include/asm/bug.h:5, from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/thread_info.h: In function 'copy_overflow':

>> include/linux/thread_info.h:135:2: error: implicit declaration of function 'WARN' [-Werror=implicit-function-declaration]
     135 |  WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
         |  ^~~~
   include/linux/thread_info.h: In function 'check_copy_size':
>> include/linux/thread_info.h:151:6: error: implicit declaration of function 'WARN_ON_ONCE' [-Werror=implicit-function-declaration]
     151 |  if (WARN_ON_ONCE(bytes > INT_MAX))
         |      ^~~~~~~~~~~~

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:100: kernel/bounds.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [Makefile:1142: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:180: sub-make] Error 2

vim +/WARN +135 include/linux/thread_info.h

b0377fedb65280 Al Viro   2017-06-29  132  
b0377fedb65280 Al Viro   2017-06-29  133  static inline void copy_overflow(int size, unsigned long count)
b0377fedb65280 Al Viro   2017-06-29  134  {
b0377fedb65280 Al Viro   2017-06-29 @135  	WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
b0377fedb65280 Al Viro   2017-06-29  136  }
b0377fedb65280 Al Viro   2017-06-29  137  
9dd819a15162f8 Kees Cook 2019-09-25  138  static __always_inline __must_check bool
b0377fedb65280 Al Viro   2017-06-29  139  check_copy_size(const void *addr, size_t bytes, bool is_source)
b0377fedb65280 Al Viro   2017-06-29  140  {
b0377fedb65280 Al Viro   2017-06-29  141  	int sz = __compiletime_object_size(addr);
b0377fedb65280 Al Viro   2017-06-29  142  	if (unlikely(sz >= 0 && sz < bytes)) {
b0377fedb65280 Al Viro   2017-06-29  143  		if (!__builtin_constant_p(bytes))
b0377fedb65280 Al Viro   2017-06-29  144  			copy_overflow(sz, bytes);
b0377fedb65280 Al Viro   2017-06-29  145  		else if (is_source)
b0377fedb65280 Al Viro   2017-06-29  146  			__bad_copy_from();
b0377fedb65280 Al Viro   2017-06-29  147  		else
b0377fedb65280 Al Viro   2017-06-29  148  			__bad_copy_to();
b0377fedb65280 Al Viro   2017-06-29  149  		return false;
b0377fedb65280 Al Viro   2017-06-29  150  	}
6d13de1489b6bf Kees Cook 2019-12-04 @151  	if (WARN_ON_ONCE(bytes > INT_MAX))
6d13de1489b6bf Kees Cook 2019-12-04  152  		return false;
b0377fedb65280 Al Viro   2017-06-29  153  	check_object_size(addr, bytes, is_source);
b0377fedb65280 Al Viro   2017-06-29  154  	return true;
b0377fedb65280 Al Viro   2017-06-29  155  }

b0377fedb65280 Al Viro 2017-06-29 156

:::::: The code at line 135 was first introduced by commit
:::::: b0377fedb6528087ed319b0d054d6ed82240372c copy_{to,from}_user(): consolidate object size checks

:::::: TO: Al Viro <[email protected]>
:::::: CC: Al Viro <[email protected]>

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