Blown Stack in ISR, i960

Gerwin Pfab pb at schenk.isar.de
Tue Jan 25 17:19:38 UTC 2000


Greetings,

we have problems with blown stacks under heavy interrupt load on our i960
bsp. As we try to find out what is going wrong, I have a idea what
happens, but it looks too severe that it wasn't seen from others, so
please correct me where I'm wrong:

1. Assume some tasks that called rtems_task_suspend().
2. Assume an interrupt handler function that calls rtems_task_resume() for
all these tasks. 

Inside the rtems interrupt handler, there is 
...
 _Thread_Dispatch_disable_level++;
...
 switch_to_Interrupt_stack;
...
 call(user_function)
...
 switch_back_to_User_stack;
 _Thread_Dispatch_disable_level--;
...
 if ( _Thread_Dispatch_disable_level == 0 )
    {
      if(( _Context_Switch_necessary) || (!_ISR_Signals_to_thread_executing))
	{
	  _ISR_Signals_to_thread_executing = FALSE;
	  _Thread_Dispatch();
	}
    }

I think, the intention of Thread_Dispatch_disable_level is to make shure
that the _Thread_Dispatch() (and the _Context_Switch()) never can occur
within the user_function (that means on the Interrupt Stack).

BUT: every call to rtems_task_resume() decrements
Thread_dispatch_disable_level and will (when 0 is reached) call
ThreadDispatch() (and _Context_Switch()) and therefore make the Context
Switch on the Interrupt stack. So the task that Context_Switch switches to
now runs with the Interrupt Stack????!

What is wrong with this scenario or is this really possible?

Regards

Gerwin

Gerwin Pfab <pb at schenk.isar.de>   Dr. Schenk Industriemesstechnik GmbH
Dipl. Ing.                        Einsteinstrasse 37 
Software Engineering              D-82152 Martinsried
                                  Tel: +49-89-85695-0
                                  Fax: +49-89-85695-200




More information about the users mailing list