On Thursday 31 August 2006 20:00, John Zavgren wrote:
> Greetings:
>
> I'm trying to create a pause after each packet transmission in
> arch/um/drivers/net_kern.c so that I can model packet tranmsission
> times.
>
> I'm using a call to:
> schedule_timeout_interruptible(msecs_to_jiffies(125));
>
> When I boot up my UML host... it complains:
>
> BUG: scheduling while atomic: avahi-daemon/0x00000100/1981
> 0f43b81c:  [<080580f4>] dump_stack+0x1c/0x20
> 0f43b834:  [<081955c3>] schedule+0x49/0x467
> 0f43b87c:  [<08196106>] schedule_timeout+0x7b/0x9c
> 0f43b8b4:  [<08196148>] schedule_timeout_interruptible+0x21/0x23
> 0f43b8c0:  [<0805df6c>] uml_net_start_xmit+0x5c/0xae
The warning is legitimate.
You cannot sleep in interrupt context or while holding a spinlock, because the 
scheduler could sleep to another thread which then disables preemption and 
requests that spinlock: it would never obtain it, leading to deadlock. You 
could use msleep but it consumes CPU power (i.e. during msleep() the CPU is 
used in a empty loop to waste time).

To avoid it you should schedule before getting or after releasing the involved 
spinlocks, probably by adding that call in dev_queue_xmit() after spin_unlock 
(there are different sending paths, patch all of them).

This is better explained in kernel hacking texts (like 
Documentation/DocBook/kernel-{hacking,locking}.tmpl, which you can compile to 
get pdf or html), or in Linux Device Drivers which can be freely downloaded.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to