summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch')
-rw-r--r--debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch b/debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch
new file mode 100644
index 000000000..294550c8d
--- /dev/null
+++ b/debian/patches-rt/locking-Detect-includes-rwlock.h-outside-of-spinlock.patch
@@ -0,0 +1,105 @@
+From: Michael S. Tsirkin <mst@redhat.com>
+Date: Thu, 25 Aug 2022 17:30:49 +0200
+Subject: [PATCH] locking: Detect includes rwlock.h outside of spinlock.h
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.0/older/patches-6.0-rt11.tar.xz
+
+The check for __LINUX_SPINLOCK_H within rwlock.h (and other files)
+detects the direct include of the header file if it is at the very
+beginning of the include section.
+If it is listed later then chances are high that spinlock.h was already
+included (including rwlock.h) and the additional listing of rwlock.h
+will not cause any failure.
+
+On PREEMPT_RT this additional rwlock.h will lead to compile failures
+since it uses a different rwlock implementation.
+
+Add __LINUX_INSIDE_SPINLOCK_H to spinlock.h and check for this instead
+of __LINUX_SPINLOCK_H to detect wrong includes. This will help detect
+direct includes of rwlock.h with without PREEMPT_RT enabled.
+
+[ bigeasy: add remaining __LINUX_SPINLOCK_H user and rewrite
+ commit description. ]
+
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Link: https://lkml.kernel.org/r/YweemHxJx7O8rjBx@linutronix.de
+---
+ include/linux/rwlock.h | 2 +-
+ include/linux/spinlock.h | 2 ++
+ include/linux/spinlock_api_smp.h | 2 +-
+ include/linux/spinlock_api_up.h | 2 +-
+ include/linux/spinlock_rt.h | 2 +-
+ include/linux/spinlock_up.h | 2 +-
+ 6 files changed, 7 insertions(+), 5 deletions(-)
+
+--- a/include/linux/rwlock.h
++++ b/include/linux/rwlock.h
+@@ -1,7 +1,7 @@
+ #ifndef __LINUX_RWLOCK_H
+ #define __LINUX_RWLOCK_H
+
+-#ifndef __LINUX_SPINLOCK_H
++#ifndef __LINUX_INSIDE_SPINLOCK_H
+ # error "please don't include this file directly"
+ #endif
+
+--- a/include/linux/spinlock.h
++++ b/include/linux/spinlock.h
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
+ #ifndef __LINUX_SPINLOCK_H
+ #define __LINUX_SPINLOCK_H
++#define __LINUX_INSIDE_SPINLOCK_H
+
+ /*
+ * include/linux/spinlock.h - generic spinlock/rwlock declarations
+@@ -492,4 +493,5 @@ int __alloc_bucket_spinlocks(spinlock_t
+
+ void free_bucket_spinlocks(spinlock_t *locks);
+
++#undef __LINUX_INSIDE_SPINLOCK_H
+ #endif /* __LINUX_SPINLOCK_H */
+--- a/include/linux/spinlock_api_smp.h
++++ b/include/linux/spinlock_api_smp.h
+@@ -1,7 +1,7 @@
+ #ifndef __LINUX_SPINLOCK_API_SMP_H
+ #define __LINUX_SPINLOCK_API_SMP_H
+
+-#ifndef __LINUX_SPINLOCK_H
++#ifndef __LINUX_INSIDE_SPINLOCK_H
+ # error "please don't include this file directly"
+ #endif
+
+--- a/include/linux/spinlock_api_up.h
++++ b/include/linux/spinlock_api_up.h
+@@ -1,7 +1,7 @@
+ #ifndef __LINUX_SPINLOCK_API_UP_H
+ #define __LINUX_SPINLOCK_API_UP_H
+
+-#ifndef __LINUX_SPINLOCK_H
++#ifndef __LINUX_INSIDE_SPINLOCK_H
+ # error "please don't include this file directly"
+ #endif
+
+--- a/include/linux/spinlock_rt.h
++++ b/include/linux/spinlock_rt.h
+@@ -2,7 +2,7 @@
+ #ifndef __LINUX_SPINLOCK_RT_H
+ #define __LINUX_SPINLOCK_RT_H
+
+-#ifndef __LINUX_SPINLOCK_H
++#ifndef __LINUX_INSIDE_SPINLOCK_H
+ #error Do not include directly. Use spinlock.h
+ #endif
+
+--- a/include/linux/spinlock_up.h
++++ b/include/linux/spinlock_up.h
+@@ -1,7 +1,7 @@
+ #ifndef __LINUX_SPINLOCK_UP_H
+ #define __LINUX_SPINLOCK_UP_H
+
+-#ifndef __LINUX_SPINLOCK_H
++#ifndef __LINUX_INSIDE_SPINLOCK_H
+ # error "please don't include this file directly"
+ #endif
+