From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [PATCH] improve ipipe_check_context instrumentation
Date: Mon, 21 Jan 2008 11:31:50 +0100 [thread overview]
Message-ID: <47947496.70005@domain.hid> (raw)
[-- 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();
reply other threads:[~2008-01-21 10:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47947496.70005@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.