linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] rt-tests: printf format compile warning
@ 2012-05-02  2:35 Frank Rowand
  2012-05-02  2:44 ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Frank Rowand
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Frank Rowand @ 2012-05-02  2:35 UTC (permalink / raw)
  To: linux-rt-users@vger.kernel.org, williams; +Cc: jkacur, dvhart


Fix printf format string to allow for 32 bit and 64 bit word size.

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

Index: b/src/cyclictest/cyclictest.c
===================================================================
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -24,6 +24,7 @@
 #include <time.h>
 #include <errno.h>
 #include <limits.h>
+#include <inttypes.h>
 #include <linux/unistd.h>
 
 #include <sys/prctl.h>
@@ -1575,7 +1576,7 @@ int main(int argc, char **argv)
 		print_tids(parameters, num_threads);
 		if (break_thread_id) {
 			printf("# Break thread: %d\n", break_thread_id);
-			printf("# Break value: %lu\n", break_thread_value);
+			printf("# Break value: %" PRIu64 "\n", break_thread_value);
 		}
 	}
 	


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/4] rt-tests: cyclictest segfault with '-a'
  2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
@ 2012-05-02  2:44 ` Frank Rowand
  2012-05-02 20:37   ` Darren Hart
  2012-05-02  2:45 ` [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning Frank Rowand
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Frank Rowand @ 2012-05-02  2:44 UTC (permalink / raw)
  To: linux-rt-users@vger.kernel.org, williams@redhat.com
  Cc: jkacur@redhat.com, dvhart@linux.intel.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);
 	}
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning
  2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
  2012-05-02  2:44 ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Frank Rowand
@ 2012-05-02  2:45 ` 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:36 ` [PATCH 1/4] rt-tests: printf format compile warning Darren Hart
  3 siblings, 1 reply; 8+ messages in thread
From: Frank Rowand @ 2012-05-02  2:45 UTC (permalink / raw)
  To: linux-rt-users@vger.kernel.org, williams@redhat.com
  Cc: jkacur@redhat.com, dvhart@linux.intel.com

Avoid annoying warning message when tracing is not requested and the debug
file system is not available. 

The same test already protects against calling event_enable_all().

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

Index: b/src/cyclictest/cyclictest.c
===================================================================
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1605,8 +1605,9 @@ int main(int argc, char **argv)
 	if (trace_fd >= 0)
 		close(trace_fd);
 
-	/* turn off all events */
-	event_disable_all();
+	if (enable_events)
+		/* turn off all events */
+		event_disable_all();
 
 	/* turn off the function tracer */
 	fileprefix = procfileprefix;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] rt-tests: cyclictest warn of interaction between '-a', '--smp', and '--numa'
  2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
  2012-05-02  2:44 ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Frank Rowand
  2012-05-02  2:45 ` [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning Frank Rowand
@ 2012-05-02  2:45 ` 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
  3 siblings, 1 reply; 8+ messages in thread
From: Frank Rowand @ 2012-05-02  2:45 UTC (permalink / raw)
  To: linux-rt-users@vger.kernel.org, williams@redhat.com
  Cc: jkacur@redhat.com, dvhart@linux.intel.com

The '-a' option is always ignored if --smp or --numa is specified.  Fix the
warning message to not depend on --smp or --numa occuring first.

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

Index: b/src/cyclictest/cyclictest.c
===================================================================
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -949,6 +949,7 @@ static char *policyname(int policy)
 static void process_options (int argc, char *argv[])
 {
 	int error = 0;
+	int option_affinity = 0;
 	int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
 	struct rlimit rlim;
 
@@ -1000,10 +1001,9 @@ static void process_options (int argc, c
 			break;
 		switch (c) {
 		case 'a':
-			if (smp) {
-				warn("-a ignored due to --smp\n");
+			option_affinity = 1;
+			if (smp || numa)
 				break;
-			}
 			if (optarg != NULL) {
 				affinity = atoi(optarg);
 				setaffinity = AFFINITY_SPECIFIED;
@@ -1112,6 +1112,14 @@ static void process_options (int argc, c
 		}
 	}
 
+	if (option_affinity) {
+		if (smp) {
+			warn("-a ignored due to --smp\n");
+		} else if (numa) {
+			warn("-a ignored due to --numa\n");
+		}
+	}
+
 	if (setaffinity == AFFINITY_SPECIFIED) {
 		if (affinity < 0)
 			error = 1;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] rt-tests: printf format compile warning
  2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
                   ` (2 preceding siblings ...)
  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:36 ` Darren Hart
  3 siblings, 0 replies; 8+ messages in thread
From: Darren Hart @ 2012-05-02 20:36 UTC (permalink / raw)
  To: frank.rowand; +Cc: linux-rt-users@vger.kernel.org, williams, jkacur



On 05/01/2012 07:35 PM, Frank Rowand wrote:
> 
> Fix printf format string to allow for 32 bit and 64 bit word size.
> 
> Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>

Tested cross-compilation for ARM, no warnings for this section.

Tested-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  src/cyclictest/cyclictest.c |    3 	2 +	1 -	0 !
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: b/src/cyclictest/cyclictest.c
> ===================================================================
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -24,6 +24,7 @@
>  #include <time.h>
>  #include <errno.h>
>  #include <limits.h>
> +#include <inttypes.h>
>  #include <linux/unistd.h>
>  
>  #include <sys/prctl.h>
> @@ -1575,7 +1576,7 @@ int main(int argc, char **argv)
>  		print_tids(parameters, num_threads);
>  		if (break_thread_id) {
>  			printf("# Break thread: %d\n", break_thread_id);
> -			printf("# Break value: %lu\n", break_thread_value);
> +			printf("# Break value: %" PRIu64 "\n", break_thread_value);
>  		}
>  	}
>  	
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] rt-tests: cyclictest segfault with '-a'
  2012-05-02  2:44 ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Frank Rowand
@ 2012-05-02 20:37   ` Darren Hart
  0 siblings, 0 replies; 8+ messages in thread
From: Darren Hart @ 2012-05-02 20:37 UTC (permalink / raw)
  To: frank.rowand
  Cc: linux-rt-users@vger.kernel.org, williams@redhat.com,
	jkacur@redhat.com



On 05/01/2012 07:44 PM, Frank Rowand wrote:
> 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>

Compile tested and tried "-a 0", but my ARM kernel/emulation is UP, so
not sure this is of much value.

Tested-by: Darren Hart <dvhart@linux.intel.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);
>  	}
>  
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning
  2012-05-02  2:45 ` [PATCH 3/4] rt-tests: cyclictest avoid unneeded warning Frank Rowand
@ 2012-05-02 20:38   ` Darren Hart
  0 siblings, 0 replies; 8+ messages in thread
From: Darren Hart @ 2012-05-02 20:38 UTC (permalink / raw)
  To: frank.rowand
  Cc: linux-rt-users@vger.kernel.org, williams@redhat.com,
	jkacur@redhat.com



On 05/01/2012 07:45 PM, Frank Rowand wrote:
> Avoid annoying warning message when tracing is not requested and the debug
> file system is not available. 
> 
> The same test already protects against calling event_enable_all().
> 
> Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>

Cross-compile tested for ARM. Visually inspected, looks sane.

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  src/cyclictest/cyclictest.c |    5 	3 +	2 -	0 !
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: b/src/cyclictest/cyclictest.c
> ===================================================================
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1605,8 +1605,9 @@ int main(int argc, char **argv)
>  	if (trace_fd >= 0)
>  		close(trace_fd);
>  
> -	/* turn off all events */
> -	event_disable_all();
> +	if (enable_events)
> +		/* turn off all events */
> +		event_disable_all();
>  
>  	/* turn off the function tracer */
>  	fileprefix = procfileprefix;
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] rt-tests: cyclictest warn of interaction between '-a', '--smp', and '--numa'
  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
  0 siblings, 0 replies; 8+ messages in thread
From: Darren Hart @ 2012-05-02 20:41 UTC (permalink / raw)
  To: frank.rowand
  Cc: linux-rt-users@vger.kernel.org, williams@redhat.com,
	jkacur@redhat.com

On 05/01/2012 07:45 PM, Frank Rowand wrote:
> The '-a' option is always ignored if --smp or --numa is specified.  Fix the
> warning message to not depend on --smp or --numa occuring first.
> 
> Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>

Compiled and tested on qemuarm UP. Behaved as expected with --smp --numa
(not built-in) and -a alone.

Tested-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  src/cyclictest/cyclictest.c |   14 	11 +	3 -	0 !
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> Index: b/src/cyclictest/cyclictest.c
> ===================================================================
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -949,6 +949,7 @@ static char *policyname(int policy)
>  static void process_options (int argc, char *argv[])
>  {
>  	int error = 0;
> +	int option_affinity = 0;
>  	int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
>  	struct rlimit rlim;
>  
> @@ -1000,10 +1001,9 @@ static void process_options (int argc, c
>  			break;
>  		switch (c) {
>  		case 'a':
> -			if (smp) {
> -				warn("-a ignored due to --smp\n");
> +			option_affinity = 1;
> +			if (smp || numa)
>  				break;
> -			}
>  			if (optarg != NULL) {
>  				affinity = atoi(optarg);
>  				setaffinity = AFFINITY_SPECIFIED;
> @@ -1112,6 +1112,14 @@ static void process_options (int argc, c
>  		}
>  	}
>  
> +	if (option_affinity) {
> +		if (smp) {
> +			warn("-a ignored due to --smp\n");
> +		} else if (numa) {
> +			warn("-a ignored due to --numa\n");
> +		}
> +	}
> +
>  	if (setaffinity == AFFINITY_SPECIFIED) {
>  		if (affinity < 0)
>  			error = 1;
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-05-02 20:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02  2:35 [PATCH 1/4] rt-tests: printf format compile warning Frank Rowand
2012-05-02  2:44 ` [PATCH 2/4] rt-tests: cyclictest segfault with '-a' Frank Rowand
2012-05-02 20:37   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).