All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frank.rowand@am.sony.com>
To: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	"williams@redhat.com" <williams@redhat.com>
Cc: "jkacur@redhat.com" <jkacur@redhat.com>,
	"dvhart@linux.intel.com" <dvhart@linux.intel.com>
Subject: [PATCH 2/4] rt-tests: cyclictest segfault with '-a'
Date: Tue, 1 May 2012 19:44:17 -0700	[thread overview]
Message-ID: <4FA09F81.3000506@am.sony.com> (raw)
In-Reply-To: <4FA09D6A.2050101@am.sony.com>

This fixes a segfault on ARM when the '-a' option is used.

man sched_setaffinity says to use pthread_setaffinity_np() when using the
POSIX threads API.

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
---
 src/cyclictest/cyclictest.c |    4 	3 +	1 -	0 !
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/src/cyclictest/cyclictest.c
===================================================================
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -612,6 +612,7 @@ void *timerthread(void *param)
 	struct thread_stat *stat = par->stats;
 	int stopped = 0;
 	cpu_set_t mask;
+	pthread_t thread;
 
 	/* if we're running in numa mode, set our memory node */
 	if (par->node != -1)
@@ -620,7 +621,8 @@ void *timerthread(void *param)
 	if (par->cpu != -1) {
 		CPU_ZERO(&mask);
 		CPU_SET(par->cpu, &mask);
-		if(sched_setaffinity(0, sizeof(mask), &mask) == -1)
+		thread = pthread_self();
+		if(pthread_setaffinity_np(thread, sizeof(mask), &mask) == -1)
 			warn("Could not set CPU affinity to CPU #%d\n", par->cpu);
 	}
 


  reply	other threads:[~2012-05-02  2:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
2012-05-02  2:44 ` Frank Rowand [this message]
2012-05-02 20:37   ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Darren Hart
2012-05-02  2:45 ` [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning Frank Rowand
2012-05-02 20:38   ` Darren Hart
2012-05-02  2:45 ` [PATCH 4/4] rt-tests: cyclictest warn of interaction between '-a', '--smp', and '--numa' Frank Rowand
2012-05-02 20:41   ` Darren Hart
2012-05-02 20:36 ` [PATCH 1/4] rt-tests: printf format compile warning Darren Hart

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=4FA09F81.3000506@am.sony.com \
    --to=frank.rowand@am.sony.com \
    --cc=dvhart@linux.intel.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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.