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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue,  5 Oct 2010 15:35:46 +0200
From:	Jiri Slaby <jslaby@...e.cz>
To:	mingo@...e.hu
Cc:	akpm@...ux-foundation.org, jirislaby@...il.com,
	linux-kernel@...r.kernel.org, x86@...nel.org,
	Jiri Slaby <jslaby@...e.cz>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH 1/1] softirq: cleanup preempt check

The preempt debugging check in the softirq code is ugly. The print is
lenghty and spread over several lines which makes the code difficult
to read. This was also the reason for the wrong spacing in the message.

So move the check into a separate inlined function and make the print
text a one-liner for easier grepping.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
---
 kernel/softirq.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 2bf4cd5..4366370 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -177,6 +177,17 @@ void local_bh_enable_ip(unsigned long ip)
 }
 EXPORT_SYMBOL(local_bh_enable_ip);
 
+static inline void softirq_preempt_check(struct softirq_action *h,
+		int prev_count)
+{
+	if (unlikely(prev_count != preempt_count())) {
+		printk(KERN_ERR "huh, entered softirq %td %s %pf with preempt_count %08x, exited with %08x?\n",
+			h - softirq_vec, softirq_to_name[h - softirq_vec],
+			h->action, prev_count, preempt_count());
+		preempt_count() = prev_count;
+	}
+}
+
 /*
  * We restart softirq processing MAX_SOFTIRQ_RESTART times,
  * and we fall back to softirqd after that.
@@ -218,14 +229,8 @@ restart:
 			trace_softirq_entry(h, softirq_vec);
 			h->action(h);
 			trace_softirq_exit(h, softirq_vec);
-			if (unlikely(prev_count != preempt_count())) {
-				printk(KERN_ERR "huh, entered softirq %td %s "
-				       "%pf with preempt_count %08x,"
-				       " exited with %08x?\n", h - softirq_vec,
-				       softirq_to_name[h - softirq_vec],
-				       h->action, prev_count, preempt_count());
-				preempt_count() = prev_count;
-			}
+
+			softirq_preempt_check(h, prev_count);
 
 			rcu_bh_qs(cpu);
 		}
-- 
1.7.3.1

--
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