mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] rt-tests: fix runtime problem of hackbench on (at least) arm and armhf
Date: Thu,  4 Jul 2013 09:40:37 +0200	[thread overview]
Message-ID: <1372923637-18697-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)

The original report only talked about armhf, but the issue was seen on an
arm9, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 ...bench-init-child-s-struct-before-using-it.patch | 57 ++++++++++++++++++++++
 patches/rt-tests-0.73/series                       |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 patches/rt-tests-0.73/hackbench-init-child-s-struct-before-using-it.patch

diff --git a/patches/rt-tests-0.73/hackbench-init-child-s-struct-before-using-it.patch b/patches/rt-tests-0.73/hackbench-init-child-s-struct-before-using-it.patch
new file mode 100644
index 0000000..aaa90df
--- /dev/null
+++ b/patches/rt-tests-0.73/hackbench-init-child-s-struct-before-using-it.patch
@@ -0,0 +1,57 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Thu, 11 Apr 2013 15:20:05 +0200
+Subject: [PATCH] hackbench: init child's struct before using it
+
+Commit ad27df7 ("Reimplement better child tracking and improve error
+handling") changed the way of reporting pid/error after creating a
+child. It will return an union which is a mix pid_t, pthread_t and a
+signed long long for errors.
+Now on 32bit x86 both pid_t and pthread_t are four byte in size and are
+stored in the first 4 bytes. Now if the most significant bit of the long
+long variable happens to be set by chance (because nobody really
+initializes the variable here) then error variable will be negative. On
+little endian machines the assignment of pid or threadid won't reset the
+sign bit and you see this:
+
+| Running in process mode with 10 groups using 40 file descriptors each (== 400 tasks)
+| Each sender will pass 100 messages of 100 bytes
+| 0 children started.  Expected 40
+| sending SIGTERM to all child processes
+| signaling 0 worker threads to terminate
+| Creating workers (error: Success)
+
+A machine with proper endian handlig (that is big endian) would reset
+the sign bit during the assignment of pid and I would not have to make
+this patch :)
+
+While here, I make create_worker() since it is not used outside of this
+file.
+
+Cc: David Sommerseth <davids@redhat.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Signed-off-by: Clark Williams <clark.williams@gmail.com>
+Origin: upstream, commit:dd6ae1155dc7fbee79426ae5952d48b4151c1cd7
+---
+ src/hackbench/hackbench.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
+index 03b74b0..6a7f8a3 100644
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -184,13 +184,14 @@ again:
+ 	return NULL;
+ }
+ 
+-childinfo_t create_worker(void *ctx, void *(*func)(void *))
++static childinfo_t create_worker(void *ctx, void *(*func)(void *))
+ {
+ 	pthread_attr_t attr;
+ 	int err;
+ 	childinfo_t child;
+ 	pid_t childpid;
+ 
++	memset(&child, 0, sizeof(child));
+ 	switch (process_mode) {
+ 	case 1: /* process mode */
+ 		/* Fork the sender/receiver child. */
diff --git a/patches/rt-tests-0.73/series b/patches/rt-tests-0.73/series
index caf1a74..8bf10ce 100644
--- a/patches/rt-tests-0.73/series
+++ b/patches/rt-tests-0.73/series
@@ -1,2 +1,3 @@
 fix_3_0_issue.diff
 add-extra-cflags.patch
+hackbench-init-child-s-struct-before-using-it.patch
-- 
1.8.3.1


-- 
ptxdist mailing list
ptxdist@pengutronix.de

                 reply	other threads:[~2013-07-04  7:40 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=1372923637-18697-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox