Skip to contentSkip to conversation

xnsched_resched_p test in hisyscall

Xenomai-core In review Jan Kiszka 2 participants 4 messages Oct 18, 2007 – Nov 5, 2007 Generic include/asm header files

lore
Share & tools
lore
#1 lore raw
Quoted 9 lines · Jan Kiszka

Hi Philippe,

what's the point about

	if (xnsched_resched_p())
		xnpod_schedule();

at the beginning of do_hisyscall_event() [1]? Could you provide a comment for the background of this hunk? Or can we even remove it?

No, we can't. It's a Blackfin-specific thing in disguise actually, so we may make this code conditional through some arch-dependent wrapper though.
http://www.rts.uni-hannover.de/xenomai/lxr/source/include/asm-blackfin/bits/pod.h#141

Quoted 5 lines

Jan

[1]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/shadow.c?v=SVN-trunk#1870

Signature · 1 line
Philippe.
author
#2 lore raw

PATCH 1/1 avoid resched test on syscall entry (was: xnsched_resched_p test in hisyscall)

Quoted 8 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka

Hi Philippe,

what's the point about

	if (xnsched_resched_p())
		xnpod_schedule();
Quoted 8 lines
Quoted 2 lines

at the beginning of do_hisyscall_event() [1]? Could you provide a comment for the background of this hunk? Or can we even remove it?

No, we can't. It's a Blackfin-specific thing in disguise actually, so we may make this code conditional through some arch-dependent wrapper though.
http://www.rts.uni-hannover.de/xenomai/lxr/source/include/asm-blackfin/bits/pod.h#141

Something like the attached patch?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
---
 include/asm-blackfin/system.h |    7 +++++++
 include/asm-generic/system.h  |    4 ++++
 ksrc/nucleus/shadow.c         |    3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)
include/asm-blackfin/system.h +7 -0
Index: xenomai/include/asm-blackfin/system.h
===================================================================
@@ -95,6 +95,13 @@ static inline void xnarch_free_host_mem 
     kfree(chunk);
 }
 
+static inline void xnarch_hisyscall_entry(void)
+{
+	if (xnsched_resched_p())
+		xnpod_schedule();
+}
+#define xnarch_hisyscall_entry	xnarch_hisyscall_entry
+
 #ifdef __cplusplus
 }
 #endif
include/asm-generic/system.h +4 -0
Index: xenomai/include/asm-generic/system.h
===================================================================
@@ -410,6 +410,10 @@ static inline int xnarch_remap_io_page_r
     return wrap_remap_io_page_range(vma,from,to,size,prot);
 }
 
+#ifndef xnarch_hisyscall_entry
+static inline void xnarch_hisyscall_entry(void)	{ }
+#endif
+
 #ifdef __cplusplus
 }
 #endif
ksrc/nucleus/shadow.c +1 -2
Index: xenomai/ksrc/nucleus/shadow.c
===================================================================
@@ -1878,8 +1878,7 @@ static inline int do_hisyscall_event(uns
 	if (!xnpod_active_p())
 		goto no_skin;
 
-	if (xnsched_resched_p())
-		xnpod_schedule();
+	xnarch_hisyscall_entry();
 
 	p = current;
 	thread = xnshadow_thread(p);
author
#3 lore raw

Re: [Xenomai-core] [PATCH] avoid resched test on syscall entry

Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Philippe Gerum
Quoted 9 lines · Jan Kiszka

Hi Philippe,

what's the point about

	if (xnsched_resched_p())
		xnpod_schedule();

at the beginning of do_hisyscall_event() [1]? Could you provide a comment for the background of this hunk? Or can we even remove it?

Quoted 7 lines
Quoted 5 lines

No, we can't. It's a Blackfin-specific thing in disguise actually, so we may make this code conditional through some arch-dependent wrapper though.
http://www.rts.uni-hannover.de/xenomai/lxr/source/include/asm-blackfin/bits/pod.h#141

Something like the attached patch?

Because you pointed out that overloading functions names with macros can be problematic (with older compilers?), here comes a variant free of such a pattern.

Jan

---
 include/asm-blackfin/system.h |    7 +++++++
 include/asm-generic/system.h  |    4 ++++
 ksrc/nucleus/shadow.c         |    3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)
include/asm-blackfin/system.h +7 -0
Index: xenomai/include/asm-blackfin/system.h
===================================================================
@@ -95,6 +95,13 @@ static inline void xnarch_free_host_mem 
     kfree(chunk);
 }
 
+static inline void __xnarch_hisyscall_entry(void)
+{
+	if (xnsched_resched_p())
+		xnpod_schedule();
+}
+#define xnarch_hisyscall_entry	__xnarch_hisyscall_entry
+
 #ifdef __cplusplus
 }
 #endif
include/asm-generic/system.h +4 -0
Index: xenomai/include/asm-generic/system.h
===================================================================
@@ -410,6 +410,10 @@ static inline int xnarch_remap_io_page_r
     return wrap_remap_io_page_range(vma,from,to,size,prot);
 }
 
+#ifndef xnarch_hisyscall_entry
+static inline void xnarch_hisyscall_entry(void)	{ }
+#endif
+
 #ifdef __cplusplus
 }
 #endif
ksrc/nucleus/shadow.c +1 -2
Index: xenomai/ksrc/nucleus/shadow.c
===================================================================
@@ -1878,8 +1878,7 @@ static inline int do_hisyscall_event(uns
 	if (!xnpod_active_p())
 		goto no_skin;
 
-	if (xnsched_resched_p())
-		xnpod_schedule();
+	xnarch_hisyscall_entry();
 
 	p = current;
 	thread = xnshadow_thread(p);