Skip to contentSkip to conversation

About Xenomai questions

Adeos-main Josh Zhao 2 participants 5 messages Apr 15, 2008 – Apr 17, 2008

lore
Share & tools
lore

Josh Zhao

author
#0 lore raw

Hi ,
After reading Xenomai code, I have some questions:
1. usespace--> rt_task_create -->pthread_create-->__native_task_create

So why xenomai use pthread to invoke __native_task_create ?

2. usespace-->rt_task_start(RT_TASK *task, void (*entry) (void
*cookie), void *cookie)-->
kernel space --> __rt_task_start(struct task_struct *curr, struct pt_regs
*regs)-->
rt_task_start(task,

                 (void (*)(void *))__xn_reg_arg2(regs),
                 (void *)__xn_reg_arg3(regs));


     I can't understand that the entry paramter is address of function in

user space ,why it can be passed into kernel space by syscall?

3. the xnthread_t struct and pod sechedule algorithm looks very complex,
is there any papers taking about it?

thanks very much!!!!

author
#1 lore raw

Hi ,
After reading Xenomai code, I have some questions:
1. usespace--> rt_task_create -->pthread_create-->__native_task_create

So why xenomai use pthread to invoke __native_task_create ?

2. usespace-->rt_task_start(RT_TASK *task, void (*entry) (void
*cookie), void *cookie)-->
kernel space --> __rt_task_start(struct task_struct *curr, struct pt_regs
*regs)-->
rt_task_start(task,

                 (void (*)(void *))__xn_reg_arg2(regs),
                 (void *)__xn_reg_arg3(regs));


     I can't understand that the entry paramter is address of function in

user space ,why it can be passed into kernel space by syscall?

3. the xnthread_t struct and pod sechedule algorithm looks very complex,
is there any papers taking about it?

thanks very much!!!!

#2 lore raw
Quoted 4 lines · Josh Zhao

Hi ,
After reading Xenomai code, I have some questions:

This is the wrong list to ask them. This answer is the last I will make to you on this list for Xenomai questions.

Quoted 2 lines

1. usespace--> rt_task_create -->pthread_create-->__native_task_create
So why xenomai use pthread to invoke __native_task_create ?

pthread_create creates a Linux thread, __native_task_create creates the Xenomai thread (sometimes called shadow thread) associated with Linux thread. The association happens in xnshadow_map.

Quoted 6 lines

2. usespace-->rt_task_start(RT_TASK *task, void (*entry) (void
*cookie), void *cookie)-->
kernel space --> __rt_task_start(struct task_struct *curr, struct pt_regs
*regs)-->
rt_task_start(task,

Quoted 6 lines
                  (void (*)(void *))__xn_reg_arg2(regs),
                 (void *)__xn_reg_arg3(regs));


     I can't understand that the entry paramter is address of function in

user space ,why it can be passed into kernel space by syscall?

Well... why not ? It is not used in kernel-space, but passed again to user-space by xnshadow_wait_barrier.

Quoted 3 lines

3. the xnthread_t struct and pod sechedule algorithm looks very complex,
is there any papers taking about it?

Every member of the xnthread_t structure is commented in include/nucleus/thread.h. The pod schedule algorithm is not that
complicated: the scheduler priority queue is maintained by other functions (essentially xnpod_suspend and xnpod_resume), xnpod_schedule extracts the higher priority thread that is ready for the longest time and compares it with the current thread. If they are different, it switches to this new thread. That's all. I find xnpod_suspend for instance much more complicated.

Signature · 1 line
 Gilles
author
#3 lore raw

Hi Gilles, thanks a lot.

Quoted 2 lines

This is the wrong list to ask them. This answer is the last I will make to you on this list for Xenomai questions.

I m a beginner for Xenomai. Do you have any suggetions how to dig into the
xenomai code ?

2008/4/17, Gilles Chanteperdrix <[email protected]>:

Quoted 64 lines · Josh Zhao
Quoted 4 lines

Hi ,
After reading Xenomai code, I have some questions:

This is the wrong list to ask them. This answer is the last I will make to you on this list for Xenomai questions.

Quoted 1 line

1. usespace-->

rt_task_create -->pthread_create-->__native_task_create

Quoted 1 line

So why xenomai use pthread to invoke __native_task_create ?

pthread_create creates a Linux thread, __native_task_create creates the Xenomai thread (sometimes called shadow thread) associated with Linux thread. The association happens in xnshadow_map.

Quoted 4 lines

2. usespace-->rt_task_start(RT_TASK *task, void (*entry) (void
*cookie), void *cookie)-->
kernel space --> __rt_task_start(struct task_struct *curr, struct

pt_regs

Quoted 7 lines

*regs)-->
rt_task_start(task,

                  (void (*)(void *))__xn_reg_arg2(regs),
                 (void *)__xn_reg_arg3(regs));


     I can't understand that the entry paramter is address of function

in

Quoted 1 line

user space ,why it can be passed into kernel space by syscall?

Well... why not ? It is not used in kernel-space, but passed again to user-space by xnshadow_wait_barrier.

Quoted 1 line

3. the xnthread_t struct and pod sechedule algorithm looks very

complex,

Quoted 1 line

is there any papers taking about it?

Every member of the xnthread_t structure is commented in include/nucleus/thread.h. The pod schedule algorithm is not that
complicated: the scheduler priority queue is maintained by other functions (essentially xnpod_suspend and xnpod_resume), xnpod_schedule extracts the higher priority thread that is ready for the longest time and compares it with the current thread. If they are different, it switches to this new thread. That's all. I find xnpod_suspend for instance much more complicated.

--

Gilles

#4 lore raw
Quoted 6 lines · Josh Zhao

Hi Gilles, thanks a lot.

Quoted 2 lines

This is the wrong list to ask them. This answer is the last I will make to you on this list for Xenomai questions.

I m a beginner for Xenomai. Do you have any suggetions how to dig into the
xenomai code ?

You may use Xenomai cross reference:
http://www.rts.uni-hannover.de/xenomai/lxr/source

Also, the best way to know the nucleus, is to have to make some modification. An example of modification could be to make the scheduling policy of the nucleus configurable (to allow for instance to use EDF scheduling policy).

On the other hand, if you plan to simply use Xenomai, you probably do not have to know its internals.

Signature · 1 line
 Gilles