Re: [PATCH 2/4] rt-tests: cyclictest segfault with '-a'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>

> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux