rt_task_add_hook() doesnt work
Hi all !
I need to do some things when a new rt task starts. So that, i need to use the 'rt_task_add_hook()', defined in xenomai task management service. So, i have created a linux kernel module in which i call this service in init_module() function. After that, initialize the module and starts a RT Task.
But, the hook function isnt called. Does anybody have already faced this problem ?
--------- kernel module simple code -----
void hook(void *cookie) {
printk(KERN_INFO "hook().\n");
}
int init_module (void) {
rt_task_add_hook(T_HOOK_START, &hook);
return 0;
}--------- kernel module simple code -----
Signature · 3 lines
Thiago Lima Silva Graduando - Ciência da Computação UFBA Registered Linux user #466887
Quoted 11 lines · Thiago Lima
Hi all !
I need to do some things when a new rt task starts. So that, i need to use the '
rt_task_add_hook()', defined in xenomai task management service. So, i have created a linux kernel module in which i call this service ininit_module()function. After that, initialize the module and starts a RT Task.But, the hook function isnt called. Does anybody have already faced this problem ?
Start hooks are not fired for userland tasks.
Quoted 27 lines
--------- kernel module simple code -----
void hook(void *cookie) { printk(KERN_INFO "hook().\n"); }int init_module (void) { rt_task_add_hook(T_HOOK_START, &hook); return 0; }--------- kernel module simple code -----
Signature · 11 lines
Thiago Lima Silva Graduando - Ciência da Computação UFBA Registered Linux user #466887 ------------------------------------------------------------------------ _______________________________________________ Xenomai-help mailing list [email protected] https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.
Quoted 9 lines · Philippe Gerum
Quoted 8 lines · Thiago Lima
Hi all !
I need to do some things when a new rt task starts. So that, i need to use the '
rt_task_add_hook()', defined in xenomai task management service. So, i have created a linux kernel module in which i call this service ininit_module()function. After that, initialize the module and starts a RT Task.
Quoted 6 lines
Quoted 3 lines
But, the hook function isnt called. Does anybody have already faced this problem ?
Start hooks are not fired for userland tasks.
And there is no valid reason for this. This patch should plug the hole:
nucleus/pod.c +4 -3
@@ -844,8 +844,8 @@if (xnthread_test_state (thread,XNSHADOW )) {xnlock_put_irqrestore (&nklock, s);xnshadow_start (thread); -xnpod_schedule (); -return 0 ; +xnlock_get_irqsave (&nklock, s); + goto callout; }#endif /* CONFIG_XENO_OPT_PERVASIVE */
@@ -861,7 +861,8 @@ nkpod->schedhook (thread,XNREADY );#endif /* __XENO_SIM__ */ -if (!emptyq_p (&nkpod->tstartq) && !xnthread_test_state (thread,XNROOT )) { + callout: +if (!emptyq_p (&nkpod->tstartq)) {trace_mark (xn_nucleus_thread_callout,"thread %p thread_name %s hook %s" , thread,xnthread_name (thread),"START" );
Quoted 28 lines
Quoted 26 lines
--------- kernel module simple code -----
void hook(void *cookie) { printk(KERN_INFO "hook().\n"); }int init_module (void) { rt_task_add_hook(T_HOOK_START, &hook); return 0; }--------- kernel module simple code -----
Signature · 11 lines
Thiago Lima Silva Graduando - Ciência da Computação UFBA Registered Linux user #466887 ------------------------------------------------------------------------ _______________________________________________ Xenomai-help mailing list [email protected] https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.