Skip to contentSkip to conversation

Unexpected CPU assignment on iMX6Q

Xenomai Javier Martínez Cantos 2 participants 3 messages Feb 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi everybody,

I'm currently working on Toradex Apalis iMX6Q (4 cores) with Xenomai 2.6.4. The system runs fine.

However, I'm playing around with rt_task_create and T_CPU obtaining the following results:

- T_CPU(0-3) leads to task creation on expected core, i.e. 1 to 4,

- while T_CPU(>3) leads to task creation always on first core.

Affinity is configured as follows:

cat /proc/xenomai/affinity
0000000f

I expect rt_task_create to return an EINVAL error or something like that when T_CPU is higher than RTHAL_NR_CPUS - 1.

Could RTHAL_NR_CPUS has a value higher than 4? How can I check this? I have already checked that CONFIG_NR_CPUS is 4.

On runtime, how can I query the "task to core assignment" through Xenomai API?

Thanks in advance.

Signature · 62 lines
Javier Martínez Cantos

Sistemas embarcados



	

Julián Camarillo, 21 B, 3ª Planta 28037 Madrid, España

	

(+34) 91 440 18 33

	

[email protected]

	

http://www.ixion.es <http://www.ixion.es/>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/This message is intended solely for its addressee. It may contain privileged and/or confidential information, whose disclosure is prohibited by law. If you have received this message in error, please do not read, copy or distribute it and notify the dispatcher immediately./

/
Este correo electrónico está dirigido exclusivamente a su destinatario y puede contener información sujeta a reserva y/o confidencial, cuya revelación está prohibida por ley. Si Ud. ha recibido este mensaje por error, le rogamos que no lo lea, copie o distribuya y que lo notifique de inmediato a su remitente./



-- 


Javier Martínez Cantos

Sistemas embarcados



	

Julián Camarillo, 21 B, 3ª Planta 28037 Madrid, España

	

(+34) 91 440 18 33

	

[email protected] <.////172.20.31.5/datos/IXION/Info_public/Logos/Nueva%2520imagen%2520corporativa/Plantillas/[email protected]%2520>

	

http://www.ixion.es <http://www.ixion.es/>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/This message is intended solely for its addressee. It may contain privileged and/or confidential information, whose disclosure is prohibited by law. If you have received this message in error, please do not read, copy or distribute it and notify the dispatcher immediately./

/
Este correo electrónico está dirigido exclusivamente a su destinatario y puede contener información sujeta a reserva y/o confidencial, cuya revelación está prohibida por ley. Si Ud. ha recibido este mensaje por error, le rogamos que no lo lea, copie o distribuya y que lo notifique de inmediato a su remitente./
#1 lore raw
Quoted 12 lines · Javier Martínez Cantos

Hi everybody,

I'm currently working on Toradex Apalis iMX6Q (4 cores) with Xenomai 2.6.4. The system runs fine.

However, I'm playing around with rt_task_create and T_CPU obtaining the following results:

- T_CPU(0-3) leads to task creation on expected core, i.e. 1 to 4,

- while T_CPU(>3) leads to task creation always on first core.

Quoted 7 lines

Affinity is configured as follows:

cat /proc/xenomai/affinity
0000000f

I expect rt_task_create to return an EINVAL error or something like that when T_CPU is higher than RTHAL_NR_CPUS - 1.

The affinity is used when starting the task with rt_task_start, not when creating it. And indeed, rt_task_start should return -EINVAL if no cpu is found for running the task.

Quoted 3 lines

Could RTHAL_NR_CPUS has a value higher than 4? How can I check this? I have already checked that CONFIG_NR_CPUS is 4.

NR_CPUS does not matter, xnpod_start_thread does a "bitwise and" with cpu_online_mask.

Quoted 3 lines

On runtime, how can I query the "task to core assignment" through Xenomai API?

I am not sure there is a way. You can check /proc/xenomai/sched or /proc/xenomai/stat though.

Signature · 2 lines
					    Gilles.
https://click-hack.org
#2 lore raw
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Javier Martínez Cantos

Hi everybody,

I'm currently working on Toradex Apalis iMX6Q (4 cores) with Xenomai 2.6.4. The system runs fine.

However, I'm playing around with rt_task_create and T_CPU obtaining the following results:

- T_CPU(0-3) leads to task creation on expected core, i.e. 1 to 4,

- while T_CPU(>3) leads to task creation always on first core.

Affinity is configured as follows:

Quoted 8 lines
Quoted 5 lines

cat /proc/xenomai/affinity
0000000f

I expect rt_task_create to return an EINVAL error or something like that when T_CPU is higher than RTHAL_NR_CPUS - 1.

The affinity is used when starting the task with rt_task_start, not when creating it. And indeed, rt_task_start should return -EINVAL if no cpu is found for running the task.

Ok, I misunderstood. Anyway it is unexpected.

Once rt_task_create is called with -say- T_CPU(20), rt_task_start returns 0 (success) and the target task is launched on first core (index 0).

What's wrong?

Quoted 4 lines
Quoted 2 lines

Could RTHAL_NR_CPUS has a value higher than 4? How can I check this? I have already checked that CONFIG_NR_CPUS is 4.

NR_CPUS does not matter, xnpod_start_thread does a "bitwise and" with cpu_online_mask.

I'll explore this path.

Quoted 5 lines
Quoted 2 lines

On runtime, how can I query the "task to core assignment" through Xenomai API?

I am not sure there is a way. You can check /proc/xenomai/sched or /proc/xenomai/stat though.

Thank you Gilles.

Signature · 28 lines
Javier Martínez Cantos

Sistemas embarcados



	

Julián Camarillo, 21 B, 3ª Planta 28037 Madrid, España

	

(+34) 91 440 18 33

	

[email protected] <.////172.20.31.5/datos/IXION/Info_public/Logos/Nueva%2520imagen%2520corporativa/Plantillas/[email protected]%2520>

	

http://www.ixion.es <http://www.ixion.es/>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/This message is intended solely for its addressee. It may contain privileged and/or confidential information, whose disclosure is prohibited by law. If you have received this message in error, please do not read, copy or distribute it and notify the dispatcher immediately./

/
Este correo electrónico está dirigido exclusivamente a su destinatario y puede contener información sujeta a reserva y/o confidencial, cuya revelación está prohibida por ley. Si Ud. ha recibido este mensaje por error, le rogamos que no lo lea, copie o distribuya y que lo notifique de inmediato a su remitente./