mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build
@ 2020-08-04 13:17 Anatoly Pugachev
  2020-08-04 13:34 ` peterz
  0 siblings, 1 reply; 5+ messages in thread
From: Anatoly Pugachev @ 2020-08-04 13:17 UTC (permalink / raw)
  To: Sparc kernel list; +Cc: Linux Kernel list, Peter Zijlstra

Hello!

Linus git master sources:

$ git desc
v5.8-2483-gc0842fbc1b18

If built without "kernel debugging" option CONFIG_PROVE_LOCKING
enabled, builds successfully.

If I enable
CONFIG_PROVE_LOCKING=y

it does not build:

linux-2.6$ make  arch/sparc
scripts/kconfig/conf  --syncconfig Kconfig

WARNING: unmet direct dependencies detected for FRAME_POINTER
  Depends on [n]: DEBUG_KERNEL [=y] && (M68K || UML || SUPERH) ||
ARCH_WANT_FRAME_POINTERS [=n] || MCOUNT [=n]
  Selected by [y]:
  - LOCKDEP [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
&& !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86

WARNING: unmet direct dependencies detected for FRAME_POINTER
  Depends on [n]: DEBUG_KERNEL [=y] && (M68K || UML || SUPERH) ||
ARCH_WANT_FRAME_POINTERS [=n] || MCOUNT [=n]
  Selected by [y]:
  - LOCKDEP [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
&& !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86

WARNING: unmet direct dependencies detected for FRAME_POINTER
  Depends on [n]: DEBUG_KERNEL [=y] && (M68K || UML || SUPERH) ||
ARCH_WANT_FRAME_POINTERS [=n] || MCOUNT [=n]
  Selected by [y]:
  - LOCKDEP [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
&& !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86

  CALL    scripts/checksyscalls.sh
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
  CALL    scripts/atomic/check-atomics.sh
  CC      arch/sparc/vdso/vclock_gettime.o
In file included from ./arch/sparc/include/asm/bug.h:25,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/thread_info.h:12,
                 from ./include/asm-generic/preempt.h:5,
                 from ./arch/sparc/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:78,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:15,
                 from ./include/linux/time.h:6,
                 from arch/sparc/vdso/vclock_gettime.c:16:
./include/linux/seqlock.h: In function ‘write_seqcount_begin_nested’:
./arch/sparc/include/asm/percpu_64.h:19:25: error:
‘__local_per_cpu_offset’ undeclared (first use in this function); did
you mean ‘per_cpu_offset’?
   19 | #define __my_cpu_offset __local_per_cpu_offset
      |                         ^~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:145:27: note: in definition of macro ‘WARN_ON_ONCE’
  145 |  int __ret_warn_once = !!(condition);   \
      |                           ^~~~~~~~~
././include/linux/compiler_types.h:301:2: note: in expansion of macro
‘__compiletime_assert’
  301 |  __compiletime_assert(condition, msg, prefix, suffix)
      |  ^~~~~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:313:2: note: in expansion of macro
‘_compiletime_assert’
  313 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:2: note: in expansion of macro
‘compiletime_assert’
   36 |  compiletime_assert(__native_word(t) || sizeof(t) ==
sizeof(long long), \
      |  ^~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:21: note: in expansion of macro
‘__native_word’
   36 |  compiletime_assert(__native_word(t) || sizeof(t) ==
sizeof(long long), \
      |                     ^~~~~~~~~~~~~
./include/asm-generic/rwonce.h:49:2: note: in expansion of macro
‘compiletime_assert_rwonce_type’
   49 |  compiletime_assert_rwonce_type(x);    \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:119:10: note: in expansion of macro ‘READ_ONCE’
  119 |  __ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));   \
      |          ^~~~~~~~~
./include/linux/percpu-defs.h:231:2: note: in expansion of macro ‘RELOC_HIDE’
  231 |  RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
      |  ^~~~~~~~~~
./include/asm-generic/percpu.h:44:31: note: in expansion of macro
‘SHIFT_PERCPU_PTR’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                               ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:44:53: note: in expansion of macro
‘__my_cpu_offset’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                                                     ^~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:242:2: note: in expansion of macro
‘arch_raw_cpu_ptr’
  242 |  arch_raw_cpu_ptr(ptr);      \
      |  ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:119:21: note: in expansion of macro ‘raw_cpu_ptr’
  119 |  __ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));   \
      |                     ^~~~~~~~~~~
./include/asm-generic/percpu.h:138:11: note: in expansion of macro
‘__this_cpu_generic_read_nopreempt’
  138 |   __ret = __this_cpu_generic_read_nopreempt(pcp);  \
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:320:31: note: in expansion of macro
‘this_cpu_generic_read’
  320 | #define this_cpu_read_1(pcp)  this_cpu_generic_read(pcp)
      |                               ^~~~~~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:321:23: note: in expansion of macro
‘this_cpu_read_1’
  321 |  case 1: pscr_ret__ = stem##1(variable); break;   \
      |                       ^~~~
./include/linux/percpu-defs.h:507:29: note: in expansion of macro
‘__pcpu_size_call_return’
  507 | #define this_cpu_read(pcp)  __pcpu_size_call_return(this_cpu_read_, pcp)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/lockdep.h:565:9: note: in expansion of macro ‘this_cpu_read’
  565 |         this_cpu_read(hardirqs_enabled)));  \
      |         ^~~~~~~~~~~~~
./include/linux/seqlock.h:285:2: note: in expansion of macro
‘lockdep_assert_preemption_disabled’
  285 |  lockdep_assert_preemption_disabled();
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./arch/sparc/include/asm/percpu_64.h:19:25: note: each undeclared
identifier is reported only once for each function it appears in
   19 | #define __my_cpu_offset __local_per_cpu_offset
      |                         ^~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:145:27: note: in definition of macro ‘WARN_ON_ONCE’
  145 |  int __ret_warn_once = !!(condition);   \
      |                           ^~~~~~~~~
././include/linux/compiler_types.h:301:2: note: in expansion of macro
‘__compiletime_assert’
  301 |  __compiletime_assert(condition, msg, prefix, suffix)
      |  ^~~~~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:313:2: note: in expansion of macro
‘_compiletime_assert’
  313 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:2: note: in expansion of macro
‘compiletime_assert’
   36 |  compiletime_assert(__native_word(t) || sizeof(t) ==
sizeof(long long), \
      |  ^~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:21: note: in expansion of macro
‘__native_word’
   36 |  compiletime_assert(__native_word(t) || sizeof(t) ==
sizeof(long long), \
      |                     ^~~~~~~~~~~~~
./include/asm-generic/rwonce.h:49:2: note: in expansion of macro
‘compiletime_assert_rwonce_type’
   49 |  compiletime_assert_rwonce_type(x);    \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:119:10: note: in expansion of macro ‘READ_ONCE’
  119 |  __ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));   \
      |          ^~~~~~~~~
./include/linux/percpu-defs.h:231:2: note: in expansion of macro ‘RELOC_HIDE’
  231 |  RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
      |  ^~~~~~~~~~
./include/asm-generic/percpu.h:44:31: note: in expansion of macro
‘SHIFT_PERCPU_PTR’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                               ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:44:53: note: in expansion of macro
‘__my_cpu_offset’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                                                     ^~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:242:2: note: in expansion of macro
‘arch_raw_cpu_ptr’
  242 |  arch_raw_cpu_ptr(ptr);      \
      |  ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:119:21: note: in expansion of macro ‘raw_cpu_ptr’
  119 |  __ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));   \
      |                     ^~~~~~~~~~~
./include/asm-generic/percpu.h:138:11: note: in expansion of macro
‘__this_cpu_generic_read_nopreempt’
  138 |   __ret = __this_cpu_generic_read_nopreempt(pcp);  \
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:320:31: note: in expansion of macro
‘this_cpu_generic_read’
  320 | #define this_cpu_read_1(pcp)  this_cpu_generic_read(pcp)
      |                               ^~~~~~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:321:23: note: in expansion of macro
‘this_cpu_read_1’
  321 |  case 1: pscr_ret__ = stem##1(variable); break;   \
      |                       ^~~~
./include/linux/percpu-defs.h:507:29: note: in expansion of macro
‘__pcpu_size_call_return’
  507 | #define this_cpu_read(pcp)  __pcpu_size_call_return(this_cpu_read_, pcp)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/lockdep.h:565:9: note: in expansion of macro ‘this_cpu_read’
  565 |         this_cpu_read(hardirqs_enabled)));  \
      |         ^~~~~~~~~~~~~
./include/linux/seqlock.h:285:2: note: in expansion of macro
‘lockdep_assert_preemption_disabled’
  285 |  lockdep_assert_preemption_disabled();
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:281:
arch/sparc/vdso/vclock_gettime.o] Error 1
make[1]: *** [scripts/Makefile.build:497: arch/sparc/vdso] Error 2
make: *** [Makefile:1757: arch/sparc] Error 2


PS: previously reported build error with v5.8 (
https://lkml.org/lkml/2020/8/3/222 ) is fixed with
48017e5481ce85ba52c4cff082cad5f021c4b413

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build
  2020-08-04 13:17 [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
@ 2020-08-04 13:34 ` peterz
  2020-08-06 23:38   ` [tip: locking/urgent] locking/seqlock, headers: Untangle the spaghetti monster tip-bot2 for Peter Zijlstra
  2020-08-10  9:23   ` [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
  0 siblings, 2 replies; 5+ messages in thread
From: peterz @ 2020-08-04 13:34 UTC (permalink / raw)
  To: Anatoly Pugachev; +Cc: Sparc kernel list, Linux Kernel list, Ingo Molnar

On Tue, Aug 04, 2020 at 04:17:16PM +0300, Anatoly Pugachev wrote:
> Hello!
> 
> Linus git master sources:
> 
> $ git desc
> v5.8-2483-gc0842fbc1b18
> 

Ooh, it looks like that series wasn't cut back far enough :/

859247d39fb0 ("seqlock: lockdep assert non-preemptibility on seqcount_t
write") does indeed also introduce problems.

I've been working on untangling the header mess for the full series and
the below patch is what I currently have.

---
Subject: seqlock,headers: Untangle the spaghetti monster
From: Peter Zijlstra <peterz@infradead.org>
Date: Thu Jul 30 13:20:47 CEST 2020

By using lockdep_assert_*() from seqlock.h, the spaghetti monster
attacked.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/ia64/include/asm/smp.h          |   35 --------------------------
 arch/ia64/include/asm/xtp.h          |   46 +++++++++++++++++++++++++++++++++++
 arch/ia64/kernel/iosapic.c           |    1 
 arch/ia64/kernel/irq.c               |    1 
 arch/ia64/kernel/process.c           |    1 
 arch/ia64/kernel/sal.c               |    1 
 arch/ia64/kernel/setup.c             |    1 
 arch/ia64/kernel/smp.c               |    1 
 arch/parisc/include/asm/timex.h      |    1 
 arch/sh/include/asm/io.h             |    1 
 arch/sh/kernel/machvec.c             |    1 
 arch/sparc/include/asm/timer_64.h    |    1 
 arch/sparc/include/asm/vvar.h        |    3 +-
 arch/sparc/kernel/vdso.c             |    1 
 arch/x86/include/asm/fixmap.h        |    2 -
 arch/x86/kernel/apic/apic_noop.c     |    1 
 arch/x86/kernel/apic/hw_nmi.c        |    1 
 arch/x86/kernel/apic/probe_64.c      |    1 
 arch/x86/kernel/cpu/amd.c            |    1 
 arch/x86/kernel/cpu/common.c         |    1 
 arch/x86/kernel/cpu/hygon.c          |    1 
 arch/x86/kernel/cpu/intel.c          |    1 
 arch/x86/kernel/jailhouse.c          |    1 
 arch/x86/kernel/tsc_msr.c            |    1 
 arch/x86/mm/init_32.c                |    1 
 arch/x86/xen/apic.c                  |    1 
 arch/x86/xen/smp_hvm.c               |    1 
 arch/x86/xen/suspend_pv.c            |    4 +--
 include/linux/dynamic_queue_limits.h |    2 +
 include/linux/hrtimer.h              |    1 
 include/linux/ktime.h                |    1 
 include/linux/lockdep.h              |    1 
 include/linux/mutex.h                |   11 ++++++++
 include/linux/sched.h                |    1 
 include/linux/seqlock.h              |    1 
 include/linux/time.h                 |    1 
 include/linux/videodev2.h            |    1 
 include/linux/ww_mutex.h             |    8 ------
 38 files changed, 91 insertions(+), 50 deletions(-)

--- a/arch/ia64/include/asm/smp.h
+++ b/arch/ia64/include/asm/smp.h
@@ -18,7 +18,6 @@
 #include <linux/bitops.h>
 #include <linux/irqreturn.h>
 
-#include <asm/io.h>
 #include <asm/param.h>
 #include <asm/processor.h>
 #include <asm/ptrace.h>
@@ -44,11 +43,6 @@ ia64_get_lid (void)
 
 #ifdef CONFIG_SMP
 
-#define XTP_OFFSET		0x1e0008
-
-#define SMP_IRQ_REDIRECTION	(1 << 0)
-#define SMP_IPI_REDIRECTION	(1 << 1)
-
 #define raw_smp_processor_id() (current_thread_info()->cpu)
 
 extern struct smp_boot_data {
@@ -62,7 +56,6 @@ extern cpumask_t cpu_core_map[NR_CPUS];
 DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
 extern int smp_num_siblings;
 extern void __iomem *ipi_base_addr;
-extern unsigned char smp_int_redirect;
 
 extern volatile int ia64_cpu_to_sapicid[];
 #define cpu_physical_id(i)	ia64_cpu_to_sapicid[i]
@@ -84,34 +77,6 @@ cpu_logical_id (int cpuid)
 	return i;
 }
 
-/*
- * XTP control functions:
- *	min_xtp   : route all interrupts to this CPU
- *	normal_xtp: nominal XTP value
- *	max_xtp   : never deliver interrupts to this CPU.
- */
-
-static inline void
-min_xtp (void)
-{
-	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
-		writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
-}
-
-static inline void
-normal_xtp (void)
-{
-	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
-		writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
-}
-
-static inline void
-max_xtp (void)
-{
-	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
-		writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
-}
-
 /* Upping and downing of CPUs */
 extern int __cpu_disable (void);
 extern void __cpu_die (unsigned int cpu);
--- /dev/null
+++ b/arch/ia64/include/asm/xtp.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_IA64_XTP_H
+#define _ASM_IA64_XTP_H
+
+#include <asm/io.h>
+
+#ifdef CONFIG_SMP
+
+#define XTP_OFFSET		0x1e0008
+
+#define SMP_IRQ_REDIRECTION	(1 << 0)
+#define SMP_IPI_REDIRECTION	(1 << 1)
+
+extern unsigned char smp_int_redirect;
+
+/*
+ * XTP control functions:
+ *	min_xtp   : route all interrupts to this CPU
+ *	normal_xtp: nominal XTP value
+ *	max_xtp   : never deliver interrupts to this CPU.
+ */
+
+static inline void
+min_xtp (void)
+{
+	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
+		writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
+}
+
+static inline void
+normal_xtp (void)
+{
+	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
+		writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
+}
+
+static inline void
+max_xtp (void)
+{
+	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
+		writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
+}
+
+#endif /* CONFIG_SMP */
+
+#endif /* _ASM_IA64_XTP_Hy */
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -95,6 +95,7 @@
 #include <asm/iosapic.h>
 #include <asm/processor.h>
 #include <asm/ptrace.h>
+#include <asm/xtp.h>
 
 #undef DEBUG_INTERRUPT_ROUTING
 
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -25,6 +25,7 @@
 #include <linux/kernel_stat.h>
 
 #include <asm/mca.h>
+#include <asm/xtp.h>
 
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -48,6 +48,7 @@
 #include <linux/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
+#include <asm/xtp.h>
 
 #include "entry.h"
 
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -18,6 +18,7 @@
 #include <asm/page.h>
 #include <asm/sal.h>
 #include <asm/pal.h>
+#include <asm/xtp.h>
 
  __cacheline_aligned DEFINE_SPINLOCK(sal_lock);
 unsigned long sal_platform_features;
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -65,6 +65,7 @@
 #include <asm/tlbflush.h>
 #include <asm/unistd.h>
 #include <asm/uv/uv.h>
+#include <asm/xtp.h>
 
 #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
 # error "struct cpuinfo_ia64 too big!"
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -46,6 +46,7 @@
 #include <asm/tlbflush.h>
 #include <asm/unistd.h>
 #include <asm/mca.h>
+#include <asm/xtp.h>
 
 /*
  * Note: alignment of 4 entries/cacheline was empirically determined
--- a/arch/parisc/include/asm/timex.h
+++ b/arch/parisc/include/asm/timex.h
@@ -7,6 +7,7 @@
 #ifndef _ASMPARISC_TIMEX_H
 #define _ASMPARISC_TIMEX_H
 
+#include <asm/special_insns.h>
 
 #define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
 
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -17,6 +17,7 @@
 #include <asm/cache.h>
 #include <asm/addrspace.h>
 #include <asm/machvec.h>
+#include <asm/page.h>
 #include <linux/pgtable.h>
 #include <asm-generic/iomap.h>
 
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -15,6 +15,7 @@
 #include <asm/setup.h>
 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/processor.h>
 
 #define MV_NAME_SIZE 32
 
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -7,6 +7,7 @@
 #ifndef _SPARC64_TIMER_H
 #define _SPARC64_TIMER_H
 
+#include <uapi/asm/asi.h>
 #include <linux/types.h>
 #include <linux/init.h>
 
--- a/arch/sparc/include/asm/vvar.h
+++ b/arch/sparc/include/asm/vvar.h
@@ -6,7 +6,8 @@
 #define _ASM_SPARC_VVAR_DATA_H
 
 #include <asm/clocksource.h>
-#include <linux/seqlock.h>
+#include <asm/processor.h>
+#include <asm/barrier.h>
 #include <linux/time.h>
 #include <linux/types.h>
 
--- a/arch/sparc/kernel/vdso.c
+++ b/arch/sparc/kernel/vdso.c
@@ -7,7 +7,6 @@
  *  a different vsyscall implementation for Linux/IA32 and for the name.
  */
 
-#include <linux/seqlock.h>
 #include <linux/time.h>
 #include <linux/timekeeper_internal.h>
 
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -26,9 +26,9 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
-#include <asm/acpi.h>
 #include <asm/apicdef.h>
 #include <asm/page.h>
+#include <asm/pgtable_types.h>
 #ifdef CONFIG_X86_32
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -10,6 +10,7 @@
  * like self-ipi, etc...
  */
 #include <linux/cpumask.h>
+#include <linux/thread_info.h>
 
 #include <asm/apic.h>
 
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -9,6 +9,7 @@
  *  Bits copied from original nmi.c file
  *
  */
+#include <linux/thread_info.h>
 #include <asm/apic.h>
 #include <asm/nmi.h>
 
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -8,6 +8,7 @@
  * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
  * James Cleverdon.
  */
+#include <linux/thread_info.h>
 #include <asm/apic.h>
 
 #include "local.h"
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -15,6 +15,7 @@
 #include <asm/cpu.h>
 #include <asm/spec-ctrl.h>
 #include <asm/smp.h>
+#include <asm/numa.h>
 #include <asm/pci-direct.h>
 #include <asm/delay.h>
 #include <asm/debugreg.h>
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -45,6 +45,7 @@
 #include <asm/mtrr.h>
 #include <asm/hwcap2.h>
 #include <linux/numa.h>
+#include <asm/numa.h>
 #include <asm/asm.h>
 #include <asm/bugs.h>
 #include <asm/cpu.h>
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -10,6 +10,7 @@
 
 #include <asm/cpu.h>
 #include <asm/smp.h>
+#include <asm/numa.h>
 #include <asm/cacheinfo.h>
 #include <asm/spec-ctrl.h>
 #include <asm/delay.h>
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -23,6 +23,7 @@
 #include <asm/cmdline.h>
 #include <asm/traps.h>
 #include <asm/resctrl.h>
+#include <asm/numa.h>
 
 #ifdef CONFIG_X86_64
 #include <linux/topology.h>
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -13,6 +13,7 @@
 #include <linux/reboot.h>
 #include <linux/serial_8250.h>
 #include <asm/apic.h>
+#include <asm/acpi.h>
 #include <asm/cpu.h>
 #include <asm/hypervisor.h>
 #include <asm/i8259.h>
--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/thread_info.h>
 
 #include <asm/apic.h>
 #include <asm/cpu_device_id.h>
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -52,6 +52,7 @@
 #include <asm/cpu_entry_area.h>
 #include <asm/init.h>
 #include <asm/pgtable_areas.h>
+#include <asm/numa.h>
 
 #include "mm_internal.h"
 
--- a/arch/x86/xen/apic.c
+++ b/arch/x86/xen/apic.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/init.h>
+#include <linux/thread_info.h>
 
 #include <asm/x86_init.h>
 #include <asm/apic.h>
--- a/arch/x86/xen/smp_hvm.c
+++ b/arch/x86/xen/smp_hvm.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <linux/thread_info.h>
 #include <asm/smp.h>
 
 #include <xen/events.h>
--- a/arch/x86/xen/suspend_pv.c
+++ b/arch/x86/xen/suspend_pv.c
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
 
-#include <asm/fixmap.h>
-
 #include <asm/xen/hypercall.h>
 #include <asm/xen/page.h>
 
+#include <asm/fixmap.h>
+
 #include "xen-ops.h"
 
 void xen_pv_pre_suspend(void)
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -38,6 +38,8 @@
 
 #ifdef __KERNEL__
 
+#include <asm/bug.h>
+
 struct dql {
 	/* Fields accessed in enqueue path (dql_queued) */
 	unsigned int	num_queued;		/* Total ever queued */
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/percpu.h>
+#include <linux/seqlock.h>
 #include <linux/timer.h>
 #include <linux/timerqueue.h>
 
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -23,6 +23,7 @@
 
 #include <linux/time.h>
 #include <linux/jiffies.h>
+#include <asm/bug.h>
 
 /* Nanosecond scalar representation for kernel time values */
 typedef s64	ktime_t;
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -11,6 +11,7 @@
 #define __LINUX_LOCKDEP_H
 
 #include <linux/lockdep_types.h>
+#include <linux/smp.h>
 #include <asm/percpu.h>
 
 struct task_struct;
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -65,6 +65,17 @@ struct mutex {
 #endif
 };
 
+struct ww_class;
+struct ww_acquire_ctx;
+
+struct ww_mutex {
+	struct mutex base;
+	struct ww_acquire_ctx *ctx;
+#ifdef CONFIG_DEBUG_MUTEXES
+	struct ww_class *ww_class;
+#endif
+};
+
 /*
  * This is the control structure for tasks blocked on mutex,
  * which resides on the blocked task's kernel stack:
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -32,6 +32,7 @@
 #include <linux/task_io_accounting.h>
 #include <linux/posix-timers.h>
 #include <linux/rseq.h>
+#include <linux/seqlock.h>
 #include <linux/kcsan.h>
 
 /* task_struct member predeclarations (sorted alphabetically): */
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -19,7 +19,6 @@
 #include <linux/mutex.h>
 #include <linux/preempt.h>
 #include <linux/spinlock.h>
-#include <linux/ww_mutex.h>
 
 #include <asm/processor.h>
 
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -3,7 +3,6 @@
 #define _LINUX_TIME_H
 
 # include <linux/cache.h>
-# include <linux/seqlock.h>
 # include <linux/math64.h>
 # include <linux/time64.h>
 
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -57,6 +57,7 @@
 #define __LINUX_VIDEODEV2_H
 
 #include <linux/time.h>     /* need struct timeval */
+#include <linux/kernel.h>
 #include <uapi/linux/videodev2.h>
 
 #endif /* __LINUX_VIDEODEV2_H */
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -48,14 +48,6 @@ struct ww_acquire_ctx {
 #endif
 };
 
-struct ww_mutex {
-	struct mutex base;
-	struct ww_acquire_ctx *ctx;
-#ifdef CONFIG_DEBUG_MUTEXES
-	struct ww_class *ww_class;
-#endif
-};
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __WW_CLASS_MUTEX_INITIALIZER(lockname, class) \
 		, .ww_class = class

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: locking/urgent] locking/seqlock, headers: Untangle the spaghetti monster
  2020-08-04 13:34 ` peterz
@ 2020-08-06 23:38   ` tip-bot2 for Peter Zijlstra
  2020-08-10  9:23   ` [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Peter Zijlstra @ 2020-08-06 23:38 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Peter Zijlstra (Intel), Ingo Molnar, x86, LKML

The following commit has been merged into the locking/urgent branch of tip:

Commit-ID:     0cd39f4600ed4de859383018eb10f0f724900e1b
Gitweb:        https://git.kernel.org/tip/0cd39f4600ed4de859383018eb10f0f724900e1b
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Thu, 06 Aug 2020 14:35:11 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 06 Aug 2020 16:13:13 +02:00

locking/seqlock, headers: Untangle the spaghetti monster

By using lockdep_assert_*() from seqlock.h, the spaghetti monster
attacked.

Attack back by reducing seqlock.h dependencies from two key high level headers:

 - <linux/seqlock.h>:               -Remove <linux/ww_mutex.h>
 - <linux/time.h>:                  -Remove <linux/seqlock.h>
 - <linux/sched.h>:                 +Add    <linux/seqlock.h>

The price was to add it to sched.h ...

Core header fallout, we add direct header dependencies instead of gaining them
parasitically from higher level headers:

 - <linux/dynamic_queue_limits.h>:  +Add <asm/bug.h>
 - <linux/hrtimer.h>:               +Add <linux/seqlock.h>
 - <linux/ktime.h>:                 +Add <asm/bug.h>
 - <linux/lockdep.h>:               +Add <linux/smp.h>
 - <linux/sched.h>:                 +Add <linux/seqlock.h>
 - <linux/videodev2.h>:             +Add <linux/kernel.h>

Arch headers fallout:

 - PARISC: <asm/timex.h>:           +Add <asm/special_insns.h>
 - SH:     <asm/io.h>:              +Add <asm/page.h>
 - SPARC:  <asm/timer_64.h>:        +Add <uapi/asm/asi.h>
 - SPARC:  <asm/vvar.h>:            +Add <asm/processor.h>, <asm/barrier.h>
                                    -Remove <linux/seqlock.h>
 - X86:    <asm/fixmap.h>:          +Add <asm/pgtable_types.h>
                                    -Remove <asm/acpi.h>

There's also a bunch of parasitic header dependency fallout in .c files, not listed
separately.

[ mingo: Extended the changelog, split up & fixed the original patch. ]

Co-developed-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200804133438.GK2674@hirez.programming.kicks-ass.net
---
 arch/sh/include/asm/io.h             |  1 +
 arch/sh/kernel/machvec.c             |  1 +
 arch/sparc/include/asm/timer_64.h    |  1 +
 arch/sparc/include/asm/vvar.h        |  3 ++-
 arch/sparc/kernel/vdso.c             |  1 -
 arch/x86/include/asm/fixmap.h        |  2 +-
 arch/x86/kernel/apic/apic_noop.c     |  1 +
 arch/x86/kernel/apic/hw_nmi.c        |  1 +
 arch/x86/kernel/apic/probe_64.c      |  1 +
 arch/x86/kernel/cpu/amd.c            |  1 +
 arch/x86/kernel/cpu/common.c         |  1 +
 arch/x86/kernel/cpu/hygon.c          |  1 +
 arch/x86/kernel/cpu/intel.c          |  1 +
 arch/x86/kernel/jailhouse.c          |  1 +
 arch/x86/kernel/tsc_msr.c            |  1 +
 arch/x86/mm/init_32.c                |  1 +
 arch/x86/xen/apic.c                  |  1 +
 arch/x86/xen/smp_hvm.c               |  1 +
 arch/x86/xen/suspend_pv.c            |  4 ++--
 include/linux/dynamic_queue_limits.h |  2 ++
 include/linux/hrtimer.h              |  1 +
 include/linux/ktime.h                |  1 +
 include/linux/lockdep.h              |  1 +
 include/linux/mutex.h                | 11 +++++++++++
 include/linux/sched.h                |  1 +
 include/linux/seqlock.h              |  1 -
 include/linux/time.h                 |  1 -
 include/linux/videodev2.h            |  1 +
 include/linux/ww_mutex.h             |  8 --------
 29 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 26f0f9b..ec587b5 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -17,6 +17,7 @@
 #include <asm/cache.h>
 #include <asm/addrspace.h>
 #include <asm/machvec.h>
+#include <asm/page.h>
 #include <linux/pgtable.h>
 #include <asm-generic/iomap.h>
 
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index beadbbd..76bd895 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -15,6 +15,7 @@
 #include <asm/setup.h>
 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/processor.h>
 
 #define MV_NAME_SIZE 32
 
diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h
index c7e4fb6..dcfad46 100644
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -7,6 +7,7 @@
 #ifndef _SPARC64_TIMER_H
 #define _SPARC64_TIMER_H
 
+#include <uapi/asm/asi.h>
 #include <linux/types.h>
 #include <linux/init.h>
 
diff --git a/arch/sparc/include/asm/vvar.h b/arch/sparc/include/asm/vvar.h
index 0289503..6eaf5cf 100644
--- a/arch/sparc/include/asm/vvar.h
+++ b/arch/sparc/include/asm/vvar.h
@@ -6,7 +6,8 @@
 #define _ASM_SPARC_VVAR_DATA_H
 
 #include <asm/clocksource.h>
-#include <linux/seqlock.h>
+#include <asm/processor.h>
+#include <asm/barrier.h>
 #include <linux/time.h>
 #include <linux/types.h>
 
diff --git a/arch/sparc/kernel/vdso.c b/arch/sparc/kernel/vdso.c
index 5888066..0e27437 100644
--- a/arch/sparc/kernel/vdso.c
+++ b/arch/sparc/kernel/vdso.c
@@ -7,7 +7,6 @@
  *  a different vsyscall implementation for Linux/IA32 and for the name.
  */
 
-#include <linux/seqlock.h>
 #include <linux/time.h>
 #include <linux/timekeeper_internal.h>
 
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index b9527a5..0f0dd64 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -26,9 +26,9 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
-#include <asm/acpi.h>
 #include <asm/apicdef.h>
 #include <asm/page.h>
+#include <asm/pgtable_types.h>
 #ifdef CONFIG_X86_32
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 98c9bb7..780c702 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -10,6 +10,7 @@
  * like self-ipi, etc...
  */
 #include <linux/cpumask.h>
+#include <linux/thread_info.h>
 
 #include <asm/apic.h>
 
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index d1fc62a..34a992e 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -9,6 +9,7 @@
  *  Bits copied from original nmi.c file
  *
  */
+#include <linux/thread_info.h>
 #include <asm/apic.h>
 #include <asm/nmi.h>
 
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 29f0e09..bd3835d 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -8,6 +8,7 @@
  * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
  * James Cleverdon.
  */
+#include <linux/thread_info.h>
 #include <asm/apic.h>
 
 #include "local.h"
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index d4806ea..dcc3d94 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -15,6 +15,7 @@
 #include <asm/cpu.h>
 #include <asm/spec-ctrl.h>
 #include <asm/smp.h>
+#include <asm/numa.h>
 #include <asm/pci-direct.h>
 #include <asm/delay.h>
 #include <asm/debugreg.h>
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 95c090a..52b5650 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -45,6 +45,7 @@
 #include <asm/mtrr.h>
 #include <asm/hwcap2.h>
 #include <linux/numa.h>
+#include <asm/numa.h>
 #include <asm/asm.h>
 #include <asm/bugs.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
index 4e28c1f..ac6c30e 100644
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -10,6 +10,7 @@
 
 #include <asm/cpu.h>
 #include <asm/smp.h>
+#include <asm/numa.h>
 #include <asm/cacheinfo.h>
 #include <asm/spec-ctrl.h>
 #include <asm/delay.h>
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 0ab48f1..6eb42d7 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -23,6 +23,7 @@
 #include <asm/cmdline.h>
 #include <asm/traps.h>
 #include <asm/resctrl.h>
+#include <asm/numa.h>
 
 #ifdef CONFIG_X86_64
 #include <linux/topology.h>
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index 2caf5b9..4eb8f2d 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -14,6 +14,7 @@
 #include <linux/serial_8250.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/acpi.h>
 #include <asm/cpu.h>
 #include <asm/hypervisor.h>
 #include <asm/i8259.h>
diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c
index 4fec6f3..46c72f2 100644
--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/thread_info.h>
 
 #include <asm/apic.h>
 #include <asm/cpu_device_id.h>
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 8b4afad..d46a5cf 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -52,6 +52,7 @@
 #include <asm/cpu_entry_area.h>
 #include <asm/init.h>
 #include <asm/pgtable_areas.h>
+#include <asm/numa.h>
 
 #include "mm_internal.h"
 
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
index 2df7d08..1aff4ae 100644
--- a/arch/x86/xen/apic.c
+++ b/arch/x86/xen/apic.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/init.h>
+#include <linux/thread_info.h>
 
 #include <asm/x86_init.h>
 #include <asm/apic.h>
diff --git a/arch/x86/xen/smp_hvm.c b/arch/x86/xen/smp_hvm.c
index f8d3944..f5e7db4 100644
--- a/arch/x86/xen/smp_hvm.c
+++ b/arch/x86/xen/smp_hvm.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <linux/thread_info.h>
 #include <asm/smp.h>
 
 #include <xen/events.h>
diff --git a/arch/x86/xen/suspend_pv.c b/arch/x86/xen/suspend_pv.c
index 8303b58..cae9660 100644
--- a/arch/x86/xen/suspend_pv.c
+++ b/arch/x86/xen/suspend_pv.c
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
 
-#include <asm/fixmap.h>
-
 #include <asm/xen/hypercall.h>
 #include <asm/xen/page.h>
 
+#include <asm/fixmap.h>
+
 #include "xen-ops.h"
 
 void xen_pv_pre_suspend(void)
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 99fc06f..407c2f2 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -38,6 +38,8 @@
 
 #ifdef __KERNEL__
 
+#include <asm/bug.h>
+
 struct dql {
 	/* Fields accessed in enqueue path (dql_queued) */
 	unsigned int	num_queued;		/* Total ever queued */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 25993b8..107cedd 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/percpu.h>
+#include <linux/seqlock.h>
 #include <linux/timer.h>
 #include <linux/timerqueue.h>
 
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 42d2e6a..a12b552 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -23,6 +23,7 @@
 
 #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/lockdep.h b/include/linux/lockdep.h
index 39a3569..62a382d 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -11,6 +11,7 @@
 #define __LINUX_LOCKDEP_H
 
 #include <linux/lockdep_types.h>
+#include <linux/smp.h>
 #include <asm/percpu.h>
 
 struct task_struct;
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index ae197cc..dcd185c 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -65,6 +65,17 @@ struct mutex {
 #endif
 };
 
+struct ww_class;
+struct ww_acquire_ctx;
+
+struct ww_mutex {
+	struct mutex base;
+	struct ww_acquire_ctx *ctx;
+#ifdef CONFIG_DEBUG_MUTEXES
+	struct ww_class *ww_class;
+#endif
+};
+
 /*
  * This is the control structure for tasks blocked on mutex,
  * which resides on the blocked task's kernel stack:
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9a9d826..7c7a949 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -31,6 +31,7 @@
 #include <linux/task_io_accounting.h>
 #include <linux/posix-timers.h>
 #include <linux/rseq.h>
+#include <linux/seqlock.h>
 #include <linux/kcsan.h>
 
 /* task_struct member predeclarations (sorted alphabetically): */
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index a076f78..962d976 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -19,7 +19,6 @@
 #include <linux/mutex.h>
 #include <linux/preempt.h>
 #include <linux/spinlock.h>
-#include <linux/ww_mutex.h>
 
 #include <asm/processor.h>
 
diff --git a/include/linux/time.h b/include/linux/time.h
index 4c325bf..b142cb5 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -3,7 +3,6 @@
 #define _LINUX_TIME_H
 
 # include <linux/cache.h>
-# include <linux/seqlock.h>
 # include <linux/math64.h>
 # include <linux/time64.h>
 
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 16c0ed6..219037f 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -57,6 +57,7 @@
 #define __LINUX_VIDEODEV2_H
 
 #include <linux/time.h>     /* need struct timeval */
+#include <linux/kernel.h>
 #include <uapi/linux/videodev2.h>
 
 #endif /* __LINUX_VIDEODEV2_H */
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index d755425..850424e 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -48,14 +48,6 @@ struct ww_acquire_ctx {
 #endif
 };
 
-struct ww_mutex {
-	struct mutex base;
-	struct ww_acquire_ctx *ctx;
-#ifdef CONFIG_DEBUG_MUTEXES
-	struct ww_class *ww_class;
-#endif
-};
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __WW_CLASS_MUTEX_INITIALIZER(lockname, class) \
 		, .ww_class = class

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build
  2020-08-04 13:34 ` peterz
  2020-08-06 23:38   ` [tip: locking/urgent] locking/seqlock, headers: Untangle the spaghetti monster tip-bot2 for Peter Zijlstra
@ 2020-08-10  9:23   ` Anatoly Pugachev
  2020-08-10 11:16     ` peterz
  1 sibling, 1 reply; 5+ messages in thread
From: Anatoly Pugachev @ 2020-08-10  9:23 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Sparc kernel list, Linux Kernel list, Ingo Molnar

On Tue, Aug 4, 2020 at 4:34 PM <peterz@infradead.org> wrote:
>
> On Tue, Aug 04, 2020 at 04:17:16PM +0300, Anatoly Pugachev wrote:
> > Hello!
> >
> > Linus git master sources:
> >
> > $ git desc
> > v5.8-2483-gc0842fbc1b18
> >
>
> Ooh, it looks like that series wasn't cut back far enough :/
>
> 859247d39fb0 ("seqlock: lockdep assert non-preemptibility on seqcount_t
> write") does indeed also introduce problems.
>
> I've been working on untangling the header mess for the full series and
> the below patch is what I currently have.
>
> ---
> Subject: seqlock,headers: Untangle the spaghetti monster
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Thu Jul 30 13:20:47 CEST 2020
>
> By using lockdep_assert_*() from seqlock.h, the spaghetti monster
> attacked.

Thanks Peter!

It doesn't apply cleanly over master git, but it least makes kernel
compilable / bootable on sparc64:

linux-2.6$ git desc
v5.8-11991-gfc80c51fd4b2

linux-2.6$ patch -p1 < ~/headers.patch
patching file arch/ia64/include/asm/smp.h
patching file arch/ia64/include/asm/xtp.h
patching file arch/ia64/kernel/iosapic.c
patching file arch/ia64/kernel/irq.c
patching file arch/ia64/kernel/process.c
Hunk #1 succeeded at 47 (offset -1 lines).
patching file arch/ia64/kernel/sal.c
patching file arch/ia64/kernel/setup.c
patching file arch/ia64/kernel/smp.c
Hunk #1 succeeded at 45 (offset -1 lines).
patching file arch/parisc/include/asm/timex.h
patching file arch/sh/include/asm/io.h
patching file arch/sh/kernel/machvec.c
patching file arch/sparc/include/asm/timer_64.h
patching file arch/sparc/include/asm/vvar.h
patching file arch/sparc/kernel/vdso.c
patching file arch/x86/include/asm/fixmap.h
patching file arch/x86/kernel/apic/apic_noop.c
patching file arch/x86/kernel/apic/hw_nmi.c
patching file arch/x86/kernel/apic/probe_64.c
patching file arch/x86/kernel/cpu/amd.c
patching file arch/x86/kernel/cpu/common.c
patching file arch/x86/kernel/cpu/hygon.c
patching file arch/x86/kernel/cpu/intel.c
patching file arch/x86/kernel/jailhouse.c
patching file arch/x86/kernel/tsc_msr.c
patching file arch/x86/mm/init_32.c
patching file arch/x86/xen/apic.c
patching file arch/x86/xen/smp_hvm.c
patching file arch/x86/xen/suspend_pv.c
patching file include/linux/dynamic_queue_limits.h
patching file include/linux/hrtimer.h
patching file include/linux/ktime.h
patching file include/linux/lockdep.h
patching file include/linux/mutex.h
patching file include/linux/sched.h
patching file include/linux/seqlock.h
Hunk #1 FAILED at 19.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/seqlock.h.rej
patching file include/linux/time.h
patching file include/linux/videodev2.h
patching file include/linux/ww_mutex.h
mator@ttip:~/linux-2.6$ make -j arch/sparc
  UPD     include/config/kernel.release
  UPD     include/generated/utsrelease.h
  CALL    scripts/atomic/check-atomics.sh
  CC      arch/sparc/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
  CC      arch/sparc/math-emu/math_64.o
  CC      arch/sparc/net/bpf_jit_comp_64.o
  CC      arch/sparc/mm/tlb.o
  CC      arch/sparc/mm/tsb.o
  CC      arch/sparc/vdso/vclock_gettime.o
  CC      arch/sparc/mm/fault_64.o
  CC      arch/sparc/mm/init_64.o
  CC      arch/sparc/mm/hugetlbpage.o
  CC      arch/sparc/vdso/vma.o
  CC      arch/sparc/vdso/vdso32/vclock_gettime.o
  CC      arch/sparc/crypto/aes_glue.o
  CC      arch/sparc/crypto/des_glue.o
  CC      arch/sparc/crypto/camellia_glue.o
  CC [M]  arch/sparc/crypto/sha1_glue.o
  CC [M]  arch/sparc/crypto/sha256_glue.o
  CC [M]  arch/sparc/crypto/sha512_glue.o
  CC [M]  arch/sparc/crypto/md5_glue.o
  CC [M]  arch/sparc/crypto/crc32c_glue.o
  VDSO    arch/sparc/vdso/vdso64.so.dbg
  CC      arch/sparc/kernel/traps_64.o
  CC      arch/sparc/kernel/irq_64.o
  CC      arch/sparc/kernel/process_64.o
  CC      arch/sparc/kernel/process.o
  CC      arch/sparc/kernel/signal_64.o
  CC      arch/sparc/kernel/sigutil_64.o
  OBJCOPY arch/sparc/vdso/vdso64.so
  CC      arch/sparc/kernel/setup_64.o
  CC      arch/sparc/kernel/idprom.o
  CC      arch/sparc/kernel/sys_sparc_64.o
  VDSO2C  arch/sparc/vdso/vdso-image-64.c
  CC      arch/sparc/kernel/time_64.o
  CC      arch/sparc/kernel/cpu.o
  CC      arch/sparc/kernel/vdso.o
  CC      arch/sparc/vdso/vdso-image-64.o
  CC      arch/sparc/kernel/ptrace_64.o
  CC      arch/sparc/kernel/unaligned_64.o
  CC      arch/sparc/kernel/prom_common.o
  CC      arch/sparc/kernel/prom_64.o
  CC      arch/sparc/kernel/of_device_common.o
  CC      arch/sparc/kernel/of_device_64.o
  CC      arch/sparc/kernel/prom_irqtrans.o
  CC      arch/sparc/kernel/reboot.o
  CC      arch/sparc/kernel/sysfs.o
  CC      arch/sparc/kernel/iommu.o
  CC      arch/sparc/kernel/iommu-common.o
  CC      arch/sparc/kernel/central.o
  CC      arch/sparc/kernel/starfire.o
  CC      arch/sparc/kernel/power.o
  CC      arch/sparc/kernel/sbus.o
  CC      arch/sparc/kernel/ebus.o
  CC      arch/sparc/kernel/visemul.o
  CC      arch/sparc/kernel/hvapi.o
  CC      arch/sparc/kernel/sstate.o
  CC      arch/sparc/kernel/mdesc.o
  CC      arch/sparc/kernel/adi_64.o
  CC      arch/sparc/kernel/pcr.o
  VDSO    arch/sparc/vdso/vdso32.so.dbg
  CC      arch/sparc/kernel/nmi.o
  CC      arch/sparc/kernel/cpumap.o
  CC      arch/sparc/kernel/smp_64.o
  CC      arch/sparc/kernel/auxio_64.o
  CC      arch/sparc/kernel/module.o
  OBJCOPY arch/sparc/vdso/vdso32.so
  CC      arch/sparc/kernel/kgdb_64.o
  CC      arch/sparc/kernel/ftrace.o
  VDSO2C  arch/sparc/vdso/vdso-image-32.c
  CC      arch/sparc/kernel/btext.o
  CC      arch/sparc/kernel/stacktrace.o
  CC      arch/sparc/vdso/vdso-image-32.o
  CC      arch/sparc/kernel/sys_sparc32.o
  CC      arch/sparc/kernel/signal32.o
  CC      arch/sparc/kernel/kprobes.o
  CC      arch/sparc/kernel/ldc.o
  CC      arch/sparc/kernel/vio.o
  CC      arch/sparc/kernel/viohs.o
  CC      arch/sparc/kernel/ds.o
  CC      arch/sparc/kernel/audit.o
  CC      arch/sparc/kernel/compat_audit.o
  CC      arch/sparc/kernel/perf_event.o
  CC      arch/sparc/kernel/jump_label.o
  CC [M]  arch/sparc/kernel/chmc.o
  AR      arch/sparc/vdso/built-in.a
  LD [M]  arch/sparc/crypto/sha1-sparc64.o
  LD [M]  arch/sparc/crypto/md5-sparc64.o
  LD [M]  arch/sparc/crypto/sha256-sparc64.o
  LD [M]  arch/sparc/crypto/crc32c-sparc64.o
  LD [M]  arch/sparc/crypto/sha512-sparc64.o
  AR      arch/sparc/crypto/built-in.a
  AR      arch/sparc/net/built-in.a
  AR      arch/sparc/kernel/built-in.a
  AR      arch/sparc/mm/built-in.a
  AR      arch/sparc/math-emu/built-in.a
  AR      arch/sparc/built-in.a

...
$ reboot
...
$ uname -a
Linux ttip 5.8.0-11991-gfc80c51fd4b2-dirty #23 SMP Mon Aug 10 12:17:12
MSK 2020 sparc64 GNU/Linux

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build
  2020-08-10  9:23   ` [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
@ 2020-08-10 11:16     ` peterz
  0 siblings, 0 replies; 5+ messages in thread
From: peterz @ 2020-08-10 11:16 UTC (permalink / raw)
  To: Anatoly Pugachev; +Cc: Sparc kernel list, Linux Kernel list, Ingo Molnar

On Mon, Aug 10, 2020 at 12:23:48PM +0300, Anatoly Pugachev wrote:
> On Tue, Aug 4, 2020 at 4:34 PM <peterz@infradead.org> wrote:
> >
> > On Tue, Aug 04, 2020 at 04:17:16PM +0300, Anatoly Pugachev wrote:
> > > Hello!
> > >
> > > Linus git master sources:
> > >
> > > $ git desc
> > > v5.8-2483-gc0842fbc1b18
> > >
> >
> > Ooh, it looks like that series wasn't cut back far enough :/
> >
> > 859247d39fb0 ("seqlock: lockdep assert non-preemptibility on seqcount_t
> > write") does indeed also introduce problems.
> >
> > I've been working on untangling the header mess for the full series and
> > the below patch is what I currently have.
> >
> > ---
> > Subject: seqlock,headers: Untangle the spaghetti monster
> > From: Peter Zijlstra <peterz@infradead.org>
> > Date: Thu Jul 30 13:20:47 CEST 2020
> >
> > By using lockdep_assert_*() from seqlock.h, the spaghetti monster
> > attacked.
> 
> Thanks Peter!
> 
> It doesn't apply cleanly over master git, but it least makes kernel
> compilable / bootable on sparc64:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/urgent

Should contain an updated version.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-10 11:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 13:17 [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
2020-08-04 13:34 ` peterz
2020-08-06 23:38   ` [tip: locking/urgent] locking/seqlock, headers: Untangle the spaghetti monster tip-bot2 for Peter Zijlstra
2020-08-10  9:23   ` [sparc64] enabling CONFIG_PROVE_LOCKING makes kernel unable to build Anatoly Pugachev
2020-08-10 11:16     ` peterz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®