This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: Add RTEMS Specific sys/cpuset.h


On 11/26/2013 4:46 AM, Sebastian Huber wrote:
> Hello Joel,
> 
> On 2013-11-14 16:53, Joel Sherrill wrote:
>> +#ifndef_SYS_CPUSET_H_
>> +#define_SYS_CPUSET_H_
>> +
>> +#include <sys/types.h>
>> +#include <sys/param.h>
>> +#include <stdint.h>
>> +
>> +/* RTEMS supports a maximum of 32 CPU cores */
>> +#ifndef CPU_SETSIZE
>> +#define CPU_SETSIZE 32
>> +#endif
>> +
>> +/* word in the cpu set */
>> +typedef uint32_t cpu_set_word_t;
>> +
>> +/* Number of bits per cpu_set_t element */
>> +#define _NCPUBITS  (sizeof(cpu_set_word_t) * NBBY) /* bits per mask */
>> +/* Number of words in the cpu_set_t array */
>> +#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
> 
> the file you checked in into the Newlib repository has not the same content as 
> the file posted to the list.  In Newlib we have now:
> 
> #ifndef _SYS_CPUSET_H_
> #define _SYS_CPUSET_H_
> 
> #if 0
> #include <sys/types.h>
> #endif
> #include <stdint.h>
> 
> /* RTEMS supports a maximum of 32 CPU cores */
> #ifndef CPU_SETSIZE
> #define CPU_SETSIZE 32
> #endif
> 
> /* word in the cpu set */
> typedef uint32_t cpu_set_word_t;
> 
> /* Number of bits per cpu_set_t element */
> #define _NCPUBITS  (sizeof(cpu_set_word_t) * NBBY) /* bits per mask */
> 
> /* Number of words in the cpu_set_t array */
> /* NOTE: Can't use howmany() because of circular dependency */
> #define _NCPUWORDS   (((CPU_SETSIZE)+((_NCPUBITS)-1))/(_NCPUBITS))
> 
> You didn't solve this circular dependency problem completely and it would have 
> been nice to inform the list about this issue.  We still use NBBY which is 
> defined in <sys/types.h>.  We also use size_t.  For this we can include 
> <stddef.h>.  We want to use <sys/cpuset.h> in <sys/types.h> to add the affinity 
> set to pthread_attr_t.
> 

I thought the circular dependency issue was solved. The pthread.h patch
we have builds fine with <sys/cpuset.h> included in <sys/types.h>

It is work in progress. I will commit your changes as soon as we
confirm Jennifer's existing cpu set tests pass.

Other than that, I am sorry if it caused you any problems. We
tested it initially in isolation and it is only when you mix
in using cpu_set_t in pthread_attr_t that they appear. Just
couldn't find the circular dependencies in that mode. :(

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]