[oe-commits] Jesse Zhang : rt-tests: fix error check in hackbench

git at git.openembedded.org git at git.openembedded.org
Tue Jun 25 16:38:01 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: 7538a9cd0c6f0216ef95956ad86e2f88ebd4c8ea
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=7538a9cd0c6f0216ef95956ad86e2f88ebd4c8ea

Author: Jesse Zhang <sen.zhang at windriver.com>
Date:   Mon Jun 17 16:49:13 2013 +0800

rt-tests: fix error check in hackbench

Add a patch to fix when an unsigned number is taken as a negative error
code.

Signed-off-by: Jesse Zhang <sen.zhang at windriver.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 .../rt-tests/files/hackbench-fix-error-check.patch |   41 ++++++++++++++++++++
 meta/recipes-rt/rt-tests/rt-tests.inc              |    1 +
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/meta/recipes-rt/rt-tests/files/hackbench-fix-error-check.patch b/meta/recipes-rt/rt-tests/files/hackbench-fix-error-check.patch
new file mode 100644
index 0000000..d17fdff
--- /dev/null
+++ b/meta/recipes-rt/rt-tests/files/hackbench-fix-error-check.patch
@@ -0,0 +1,41 @@
+childinfo_t is a union that contains both signed (error) and unsigned
+(threadid) members. Thus a large threadid could appear as a negative error
+value, which will cause unexpected failures.
+
+childinfo_t should be changed to a struct, but it could potentially affect the
+performance. So we keep it as a union but only check error against -1. There is
+still a chance of false alarm but it's small.
+
+Upstream-Status: Pending
+
+Signed-off-by: Song.Li <Song.Li at windriver.com>
+Signed-off-by: Jesse Zhang <sen.zhang at windriver.com>
+---
+ src/hackbench/hackbench.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
+index 8baeb23..dc0de8f 100644
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -317,7 +317,7 @@ static unsigned int group(childinfo_t *child,
+ 		ctx->wakefd = wakefd;
+ 
+ 		child[tab_offset+i] = create_worker(ctx, (void *)(void *)receiver);
+-		if( child[tab_offset+i].error < 0 ) {
++		if( child[tab_offset+i].error == -1 ) {
+ 			return (i > 0 ? i-1 : 0);
+ 		}
+ 		snd_ctx->out_fds[i] = fds[1];
+@@ -332,7 +332,7 @@ static unsigned int group(childinfo_t *child,
+ 		snd_ctx->num_fds = num_fds;
+ 
+ 		child[tab_offset+num_fds+i] = create_worker(snd_ctx, (void *)(void *)sender);
+-		if( child[tab_offset+num_fds+i].error < 0 ) {
++		if( child[tab_offset+num_fds+i].error == -1 ) {
+ 			return (num_fds+i)-1;
+ 		}
+ 	}
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-rt/rt-tests/rt-tests.inc b/meta/recipes-rt/rt-tests/rt-tests.inc
index 3ae7602..91e5028 100644
--- a/meta/recipes-rt/rt-tests/rt-tests.inc
+++ b/meta/recipes-rt/rt-tests/rt-tests.inc
@@ -8,6 +8,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git
            file://0002-rt-tests-Break-out-install_hwlatdetect.patch \
            file://added-missing-dependencies.patch \
            file://cyclictest-finish-removal-of-1-second-first-loops.patch \
+           file://hackbench-fix-error-check.patch \
 "
 
 INC_PR = "r2"



More information about the Openembedded-commits mailing list