Skip to contentSkip to conversation

Jan Kiszka : Fix historic msleep wrapping

Xenomai-core Gilles Chanteperdrix 2 participants 3 messages Apr 14, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 25 lines · GIT version control
Module: xenomai-jki
Branch: queues/proc
Commit: f14c48e888b7f811f4c040b3b7ff0783fe115978
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=f14c48e888b7f811f4c040b3b7ff0783fe115978
Author: Jan Kiszka <[email protected]>
Date:   Mon Apr  5 17:25:29 2010 +0200

Fix historic msleep wrapping

Probably only an academic exercise: Fix the rounding bug in msleep wrapper for kernels < 2.4.28.

---

 include/asm-generic/wrappers.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/wrappers.h +0 -0
index 15d9837..64ec43f 100644

include/asm-generic/wrappers.h do { \ · line 202

Quoted 7 lines
include/asm-generic/wrappers.h +1 -1
@@ -197,7 +197,7 @@ do {									\
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,28)
 #define msleep(x) do {				 \
 	set_current_state(TASK_UNINTERRUPTIBLE); \
-	schedule_timeout((x)*(HZ/1000));         \
+	schedule_timeout(((x)*HZ)/1000);         \
 } while(0)
 #endif

Mmm... changing that code again? What about replacing it with the close patch we discussed?

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 21 lines · Gilles Chanteperdrix
Quoted 20 lines · GIT version control
Module: xenomai-jki
Branch: queues/proc
Commit: f14c48e888b7f811f4c040b3b7ff0783fe115978
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=f14c48e888b7f811f4c040b3b7ff0783fe115978
Author: Jan Kiszka <[email protected]>
Date:   Mon Apr  5 17:25:29 2010 +0200

Fix historic msleep wrapping

Probably only an academic exercise: Fix the rounding bug in msleep wrapper for kernels < 2.4.28.

---

 include/asm-generic/wrappers.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

include/asm-generic/wrappers.h do { \ · line 202

Quoted 12 lines
include/asm-generic/wrappers.h +1 -1
index 15d9837..64ec43f 100644
@@ -197,7 +197,7 @@ do {									\
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,28)
 #define msleep(x) do {				 \
 	set_current_state(TASK_UNINTERRUPTIBLE); \
-	schedule_timeout((x)*(HZ/1000));         \
+	schedule_timeout(((x)*HZ)/1000);         \
 } while(0)
 #endif

Mmm... changing that code again? What about replacing it with the close patch we discussed?

The close patch (actually a rewrite of it) will only avoid polling on the context reference count. Other polling is part of the RTDM API and cannot be easily removed.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 37 lines · Jan Kiszka
Quoted 21 lines · Gilles Chanteperdrix
Quoted 20 lines · GIT version control
Module: xenomai-jki
Branch: queues/proc
Commit: f14c48e888b7f811f4c040b3b7ff0783fe115978
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=f14c48e888b7f811f4c040b3b7ff0783fe115978
Author: Jan Kiszka <[email protected]>
Date:   Mon Apr  5 17:25:29 2010 +0200

Fix historic msleep wrapping

Probably only an academic exercise: Fix the rounding bug in msleep wrapper for kernels < 2.4.28.

---

 include/asm-generic/wrappers.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 14 lines

include/asm-generic/wrappers.h do { \ · line 202

Quoted 12 lines
include/asm-generic/wrappers.h +1 -1
index 15d9837..64ec43f 100644
@@ -197,7 +197,7 @@ do {									\
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,28)
 #define msleep(x) do {				 \
 	set_current_state(TASK_UNINTERRUPTIBLE); \
-	schedule_timeout((x)*(HZ/1000));         \
+	schedule_timeout(((x)*HZ)/1000);         \
 } while(0)
 #endif

Mmm... changing that code again? What about replacing it with the close patch we discussed?

Quoted 3 lines

The close patch (actually a rewrite of it) will only avoid polling on the context reference count. Other polling is part of the RTDM API and cannot be easily removed.

Yes sorry. I thought this was the msleep used by the close syscall. I hated that msleep and that loop, in debugging phases of RTDM drivers, this also explains why I am so much in favour of the close patch...

Signature · 1 line
					    Gilles.