All of lore.kernel.org
 help / color / mirror / Atom feed
* [Adeos-main] [PATCH] improve ipipe_check_context instrumentation
@ 2008-01-21 10:31 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2008-01-21 10:31 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: adeos-main

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

Working on kgdb for I-pipe, I noticed that we miss add/sub_preempt_count
with our ipipe_check_context tests. Here is an improved instrumentation
(which also removes some over-instrumentations).

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

[-- Attachment #2: refactor-preempt-context-check.patch --]
[-- Type: text/x-patch, Size: 2775 bytes --]

---
 include/linux/preempt.h |   21 ++++++++++++---------
 kernel/sched.c          |    4 ++--
 2 files changed, 14 insertions(+), 11 deletions(-)

Index: linux-2.6.24-rc8-xeno_64/include/linux/preempt.h
===================================================================
--- linux-2.6.24-rc8-xeno_64.orig/include/linux/preempt.h
+++ linux-2.6.24-rc8-xeno_64/include/linux/preempt.h
@@ -15,8 +15,14 @@
   extern void fastcall add_preempt_count(int val);
   extern void fastcall sub_preempt_count(int val);
 #else
-# define add_preempt_count(val)	do { preempt_count() += (val); } while (0)
-# define sub_preempt_count(val)	do { preempt_count() -= (val); } while (0)
+# define add_preempt_count(val)	do { \
+	ipipe_check_context(ipipe_root_domain); \
+	preempt_count() += (val); \
+  } while (0)
+# define sub_preempt_count(val)	do { \
+	ipipe_check_context(ipipe_root_domain); \
+	preempt_count() -= (val); \
+  } while (0)
 #endif
 
 #define inc_preempt_count() add_preempt_count(1)
@@ -30,21 +36,18 @@ asmlinkage void preempt_schedule(void);
 
 #define preempt_disable() \
 do { \
-	ipipe_check_context(ipipe_root_domain); \
 	inc_preempt_count(); \
 	barrier(); \
 } while (0)
 
 #define preempt_enable_no_resched() \
 do { \
-	ipipe_check_context(ipipe_root_domain); \
 	barrier(); \
 	dec_preempt_count(); \
 } while (0)
 
 #define preempt_check_resched() \
 do { \
-	ipipe_check_context(ipipe_root_domain); \
 	if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
 		preempt_schedule(); \
 } while (0)
@@ -58,10 +61,10 @@ do { \
 
 #else
 
-#define preempt_disable()		ipipe_check_context(ipipe_root_domain)
-#define preempt_enable_no_resched()	ipipe_check_context(ipipe_root_domain)
-#define preempt_enable()		ipipe_check_context(ipipe_root_domain)
-#define preempt_check_resched()		ipipe_check_context(ipipe_root_domain)
+#define preempt_disable()		do { } while (0)
+#define preempt_enable_no_resched()	do { } while (0)
+#define preempt_enable()		do { } while (0)
+#define preempt_check_resched()		do { } while (0)
 
 #endif
 
Index: linux-2.6.24-rc8-xeno_64/kernel/sched.c
===================================================================
--- linux-2.6.24-rc8-xeno_64.orig/kernel/sched.c
+++ linux-2.6.24-rc8-xeno_64/kernel/sched.c
@@ -3510,6 +3510,7 @@ void scheduler_tick(void)
 
 void fastcall add_preempt_count(int val)
 {
+	ipipe_check_context(ipipe_root_domain);
 	/*
 	 * Underflow?
 	 */
@@ -3526,6 +3527,7 @@ EXPORT_SYMBOL(add_preempt_count);
 
 void fastcall sub_preempt_count(int val)
 {
+	ipipe_check_context(ipipe_root_domain);
 	/*
 	 * Underflow?
 	 */
@@ -3630,8 +3632,6 @@ asmlinkage void __sched schedule(void)
 	struct rq *rq;
 	int cpu;
 
-	ipipe_check_context(ipipe_root_domain);
-
 need_resched:
 	preempt_disable();
 	cpu = smp_processor_id();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-21 10:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 10:31 [Adeos-main] [PATCH] improve ipipe_check_context instrumentation Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.