Question about Reentrancy

Benjie Chen benjie at cag.lcs.mit.edu
Thu Mar 9 11:35:00 EST 2000


Hi

We have not really used (and tested) timers in kernel modules. We will
soon be doing that. But what you mentioned here definitely seems like
a reentrancy bug.

The timer abstraction for kernel modules will likely change soon. The
f->router()->driver() line will probably be changed to just wake up the
click thread. We will keep you updated.

Thanks

Benjie

> Hi. I was looking at the 1.01 source, and I have question regarding
> timers. Actually, this may be more of a question about Linux than about
> timers and reentrancy.
> 
> I notice that the driver runs as a linux kernel thread. It also appears to
> me that in Linux, timer callbacks are invoked from the bottom half handler,
> which is run at the end of IRQ handling. In lib/timer.cc:
> 
> 	Timer::element_timer(unsigned long thunk)
> 	{
> 	  Element *f = (Element *)thunk;
> 	  // don't do anything - just put it on the work list
> 	  f->join_scheduler();
> 	#ifdef __KERNEL__
> 	#ifndef HAVE_POLLING
> 	  // run work list
> 	  f->router()->driver();
> 	#endif
> 	#endif
> 
> Is there a possibility that a Click timer will expire while the driver
> thread is running, and that the callback will run on the return from the
> clock interrupt? Would this result in a reentrancy into the driver loop?
> 
> Sorry if this is just a question resulting from not understanding how Linux
> works, but I figure its a simple explantion for you folks.
> 
> Thanks!
> Lbs
> 
> ---------------------------------------------------------------------------
> Leigh B. Stoller                     Computer Science - Flux Research Group
> stoller at cs.utah.edu                  University of Utah
> http://www.cs.utah.edu/~stoller      Salt Lake City, Utah 84112
> Voice: (541) 929-2666                FAX: (801) 585-3743
> ---------------------------------------------------------------------------
> 


-- 
Benjie Chen
benjie at lcs.mit.edu



More information about the click mailing list