Fusion 0.8 / VxWorks skin : problems using rt_intr_wait()

Philippe Gerum rpm at xenomai.org
Wed Jun 22 17:15:37 CEST 2005


Eddy, Paul wrote:
> Hello,
> 
> I've been trying to get a simple 2-task program running in userspace using
> Fusion 0.8 and the VxWorks skin.  At this point, the program does nothing
> useful, but is being used for my own purposes of learning how things work.
> 
> With the code shown below, I would expect to see the intrHandler task
> blocked, waiting for an interrupt (which will never occur, using this code).
> While intrHandler is blocked at rt_intr_wait(), the second task,
> intGenerator, should be doing xnprintf's every 500 ms.  The code is here:
> ============
> 
> #include <rtai/intr.h>
> #include <vxworks/vxworks.h>
> 
> static int intrHandler_tid;
> static int intrGenerator_tid;
> static RT_INTR intr_desc;
> 
> void cleanup (int dummy);
> void intrHandler (int a0, int a1, int a2, int a3, int a4,
>                   int a5, int a6, int a7, int a8, int a9);
> void intrGenerator (int a0, int a1, int a2, int a3, int a4,
>                     int a5, int a6, int a7, int a8, int a9);
> 
> int root_thread_init (void)
> {
>    int err;
> 
>    signal (SIGTERM, cleanup);
>    signal (SIGINT, cleanup);
>   
>    err = rt_intr_create (&intr_desc, 7, I_AUTOENA);
> 
>    intrHandler_tid = taskSpawn ("IntrHandler", 99, 0, 8192,
>                                 (FUNCPTR)&intrHandler,
>                                 0,0,0,0,0,0,0,0,0,0);
> 
>    intrGenerator_tid = taskSpawn ("IntrGenerator", 50, 0, 8192,
>                                   (FUNCPTR)&intrGenerator,
>                                   0,0,0,0,0,0,0,0,0,0);
> 
>    rt_intr_enable(&intr_desc);
>    return 0;
> }
> 
> void root_thread_exit (void)
> {
>    xnprintf ("root_thread_exit\n");
>    rt_intr_disable(&intr_desc);
>    rt_intr_delete(&intr_desc);
>    taskDelete(intrHandler_tid);
>    taskDelete(intrGenerator_tid);
>    exit(0);
> }
> 
> void cleanup (int dummy)
> {
>    root_thread_exit();
> }
> 
> void intrHandler (int a0, int a1, int a2, int a3, int a4,
>                   int a5, int a6, int a7, int a8, int a9)
> {
>    xnprintf ("Start intrHandler task\n");
>    
>    while (1)
>    {
>       int err;
>       
>       err = rt_intr_wait(&intr_desc, TM_INFINITE);
>       if (err > 0)
>          xnprintf ("RX Intr\n");
>    }
> }
> 
> void intrGenerator (int a0, int a1, int a2, int a3, int a4,
>                     int a5, int a6, int a7, int a8, int a9)
> {
>    xnprintf ("Start intrGenerator task\n");
>    
>    while (1)
>    {
>       taskDelay(500);
>       xnprintf ("Generate\n");
>    }
> }
> 
> =============
> 
> When I try running the code, I get the following console output:
> 
> =============
> RTAI/uvm: fusion core v0.8 (Time Machine) started.
> starting VxWorks services.
> Start intrHandler task
> Start intrGenerator task
> Generate
> <then it just sits here, until I press CTRL-C>
> <Press CTRL-C>
> root_thread_exit
> CPU  NAME           PRI  STATUS
>   0  ROOT           256  0x00280080 -- fpu
>   0  IntrGenerator   50  0x10008084 -- dly rrb
> Periodic timer is running [tickval=1000 us, elapsed=500]
> UVM fatal: zombie thread IntrHandler (0x80593bc) would not die...
> root_thread_exit
> root_thread_exit
> ===============
> 
> Am I doing something incorrect in regards to using/configuring the timers?
> I ran "satch" with no problems.  Things stopped working when I added the
> rt_intr_wait() call.
> 

Looking at the symptoms you described, it's likely that you hit the same 
bug than Marco did a while ago, and which has just been fixed in the 
CVS. In short, there was an issue in the UVM core code (i.e. not in the 
VxWorks emulation) which caused spurious scheduling sequences when 
suspending threads under corner case conditions; those conditions may 
well be triggered by your test code. IOW, the misbehaviour it's not your 
fault, but it's mine actually.

-- 

Philippe.




More information about the Rtai mailing list