lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Jan 2010 22:26:45 +0100
From:	John Kacur <jkacur@...hat.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	lkml <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>
Cc:	Clark Williams <williams@...hat.com>,
	John Kacur <jkacur@...hat.com>
Subject: [PATCH 15/26] clocksource: Convert watchdog_lock to raw_spinlock

Convert locks that cannot sleep in preempt-rt to raw-spinlocks.

See also fea886ed3f18a93ab76fbeed13f1f73c97bd8982

Signed-off-by: John Kacur <jkacur@...hat.com>
---
 kernel/time/clocksource.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e85c234..ffcb48f 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -183,7 +183,7 @@ static LIST_HEAD(watchdog_list);
 static struct clocksource *watchdog;
 static struct timer_list watchdog_timer;
 static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
-static DEFINE_SPINLOCK(watchdog_lock);
+static DEFINE_RAW_SPINLOCK(watchdog_lock);
 static cycle_t watchdog_last;
 static int watchdog_running;
 
@@ -233,13 +233,13 @@ void clocksource_mark_unstable(struct clocksource *cs)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&watchdog_lock, flags);
+	raw_spin_lock_irqsave(&watchdog_lock, flags);
 	if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) {
 		if (list_empty(&cs->wd_list))
 			list_add(&cs->wd_list, &watchdog_list);
 		__clocksource_unstable(cs);
 	}
-	spin_unlock_irqrestore(&watchdog_lock, flags);
+	raw_spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
 static void clocksource_watchdog(unsigned long data)
@@ -249,7 +249,7 @@ static void clocksource_watchdog(unsigned long data)
 	int64_t wd_nsec, cs_nsec;
 	int next_cpu;
 
-	spin_lock(&watchdog_lock);
+	raw_spin_lock(&watchdog_lock);
 	if (!watchdog_running)
 		goto out;
 
@@ -308,7 +308,7 @@ static void clocksource_watchdog(unsigned long data)
 	watchdog_timer.expires += WATCHDOG_INTERVAL;
 	add_timer_on(&watchdog_timer, next_cpu);
 out:
-	spin_unlock(&watchdog_lock);
+	raw_spin_unlock(&watchdog_lock);
 }
 
 static inline void clocksource_start_watchdog(void)
@@ -343,16 +343,16 @@ static void clocksource_resume_watchdog(void)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&watchdog_lock, flags);
+	raw_spin_lock_irqsave(&watchdog_lock, flags);
 	clocksource_reset_watchdog();
-	spin_unlock_irqrestore(&watchdog_lock, flags);
+	raw_spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
 static void clocksource_enqueue_watchdog(struct clocksource *cs)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&watchdog_lock, flags);
+	raw_spin_lock_irqsave(&watchdog_lock, flags);
 	if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
 		/* cs is a clocksource to be watched. */
 		list_add(&cs->wd_list, &watchdog_list);
@@ -370,7 +370,7 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs)
 	}
 	/* Check if the watchdog timer needs to be started. */
 	clocksource_start_watchdog();
-	spin_unlock_irqrestore(&watchdog_lock, flags);
+	raw_spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
 static void clocksource_dequeue_watchdog(struct clocksource *cs)
@@ -378,7 +378,7 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
 	struct clocksource *tmp;
 	unsigned long flags;
 
-	spin_lock_irqsave(&watchdog_lock, flags);
+	raw_spin_lock_irqsave(&watchdog_lock, flags);
 	if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
 		/* cs is a watched clocksource. */
 		list_del_init(&cs->wd_list);
@@ -397,7 +397,7 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
 	cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
 	/* Check if the watchdog timer needs to be stopped. */
 	clocksource_stop_watchdog();
-	spin_unlock_irqrestore(&watchdog_lock, flags);
+	raw_spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
 static int clocksource_watchdog_kthread(void *data)
@@ -407,7 +407,7 @@ static int clocksource_watchdog_kthread(void *data)
 	LIST_HEAD(unstable);
 
 	mutex_lock(&clocksource_mutex);
-	spin_lock_irqsave(&watchdog_lock, flags);
+	raw_spin_lock_irqsave(&watchdog_lock, flags);
 	list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list)
 		if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
 			list_del_init(&cs->wd_list);
@@ -415,7 +415,7 @@ static int clocksource_watchdog_kthread(void *data)
 		}
 	/* Check if the watchdog timer needs to be stopped. */
 	clocksource_stop_watchdog();
-	spin_unlock_irqrestore(&watchdog_lock, flags);
+	raw_spin_unlock_irqrestore(&watchdog_lock, flags);
 
 	/* Needs to be done outside of watchdog lock */
 	list_for_each_entry_safe(cs, tmp, &unstable, wd_list) {
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ