From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 11 Dec 2023 08:20:59 +0000
Subject: [PATCH] kernel_5.10 no rt

---
 kernel/include/linux/local_lock_internal.h |  111 ++++---------------------------------------------------
 1 files changed, 8 insertions(+), 103 deletions(-)

diff --git a/kernel/include/linux/local_lock_internal.h b/kernel/include/linux/local_lock_internal.h
index 1b8ae03..3f02b81 100644
--- a/kernel/include/linux/local_lock_internal.h
+++ b/kernel/include/linux/local_lock_internal.h
@@ -7,39 +7,13 @@
 #include <linux/lockdep.h>
 
 typedef struct {
-#ifdef CONFIG_PREEMPT_RT
-	spinlock_t              lock;
-	struct task_struct      *owner;
-	int                     nestcnt;
-
-#elif defined(CONFIG_DEBUG_LOCK_ALLOC)
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
 	struct lockdep_map	dep_map;
 	struct task_struct	*owner;
 #endif
 } local_lock_t;
 
-#ifdef CONFIG_PREEMPT_RT
-
-#define INIT_LOCAL_LOCK(lockname)	{	\
-	__SPIN_LOCK_UNLOCKED((lockname).lock),	\
-	.owner		= NULL,			\
-	.nestcnt	= 0,			\
-	}
-
-static inline void ___local_lock_init(local_lock_t *l)
-{
-	l->owner = NULL;
-	l->nestcnt = 0;
-}
-
-#define __local_lock_init(l)					\
-do {								\
-	spin_lock_init(&(l)->lock);				\
-	___local_lock_init(l);					\
-} while (0)
-
-#elif defined(CONFIG_DEBUG_LOCK_ALLOC)
-
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define LOCAL_LOCK_DEBUG_INIT(lockname)		\
 	.dep_map = {					\
 		.name = #lockname,			\
@@ -47,33 +21,7 @@
 		.lock_type = LD_LOCK_PERCPU,		\
 	},						\
 	.owner = NULL,
-#endif
 
-#ifdef CONFIG_PREEMPT_RT
-
-static inline void local_lock_acquire(local_lock_t *l)
-{
-	if (l->owner != current) {
-		spin_lock(&l->lock);
-		DEBUG_LOCKS_WARN_ON(l->owner);
-		DEBUG_LOCKS_WARN_ON(l->nestcnt);
-		l->owner = current;
-	}
-	l->nestcnt++;
-}
-
-static inline void local_lock_release(local_lock_t *l)
-{
-	DEBUG_LOCKS_WARN_ON(l->nestcnt == 0);
-	DEBUG_LOCKS_WARN_ON(l->owner != current);
-	if (--l->nestcnt)
-		return;
-
-	l->owner = NULL;
-	spin_unlock(&l->lock);
-}
-
-#elif defined(CONFIG_DEBUG_LOCK_ALLOC)
 static inline void local_lock_acquire(local_lock_t *l)
 {
 	lock_map_acquire(&l->dep_map);
@@ -99,47 +47,6 @@
 static inline void local_lock_debug_init(local_lock_t *l) { }
 #endif /* !CONFIG_DEBUG_LOCK_ALLOC */
 
-#ifdef CONFIG_PREEMPT_RT
-
-#define __local_lock(lock)					\
-	do {							\
-		migrate_disable();				\
-		local_lock_acquire(this_cpu_ptr(lock));		\
-	} while (0)
-
-#define __local_unlock(lock)					\
-	do {							\
-		local_lock_release(this_cpu_ptr(lock));		\
-		migrate_enable();				\
-	} while (0)
-
-#define __local_lock_irq(lock)					\
-	do {							\
-		migrate_disable();				\
-		local_lock_acquire(this_cpu_ptr(lock));		\
-	} while (0)
-
-#define __local_lock_irqsave(lock, flags)			\
-	do {							\
-		migrate_disable();				\
-		flags = 0;					\
-		local_lock_acquire(this_cpu_ptr(lock));		\
-	} while (0)
-
-#define __local_unlock_irq(lock)				\
-	do {							\
-		local_lock_release(this_cpu_ptr(lock));		\
-		migrate_enable();				\
-	} while (0)
-
-#define __local_unlock_irqrestore(lock, flags)			\
-	do {							\
-		local_lock_release(this_cpu_ptr(lock));		\
-		migrate_enable();				\
-	} while (0)
-
-#else
-
 #define INIT_LOCAL_LOCK(lockname)	{ LOCAL_LOCK_DEBUG_INIT(lockname) }
 
 #define __local_lock_init(lock)					\
@@ -159,12 +66,6 @@
 		local_lock_acquire(this_cpu_ptr(lock));		\
 	} while (0)
 
-#define __local_unlock(lock)					\
-	do {							\
-		local_lock_release(this_cpu_ptr(lock));		\
-		preempt_enable();				\
-	} while (0)
-
 #define __local_lock_irq(lock)					\
 	do {							\
 		local_irq_disable();				\
@@ -175,6 +76,12 @@
 	do {							\
 		local_irq_save(flags);				\
 		local_lock_acquire(this_cpu_ptr(lock));		\
+	} while (0)
+
+#define __local_unlock(lock)					\
+	do {							\
+		local_lock_release(this_cpu_ptr(lock));		\
+		preempt_enable();				\
 	} while (0)
 
 #define __local_unlock_irq(lock)				\
@@ -188,5 +95,3 @@
 		local_lock_release(this_cpu_ptr(lock));		\
 		local_irq_restore(flags);			\
 	} while (0)
-
-#endif

--
Gitblit v1.6.2