On Tue, 24 Aug 2010 11:03:32 +0530 Sameer Tamsekar <stamsekar@xxxxxxxxx> wrote: > On Mon, Aug 23, 2010 at 11:39 PM, Michael Griepentrog > <griepent@xxxxxxxxxxx>wrote: > > > Hi, > > > > I'm trying to send UDP packets from the kernel using sock_sendmsg(), > > but it is possible for this to eventually call schedule(). The part of > > the kernel I am working in expects to be executed atomically, so > > calling sock_sendmsg() usually generates the error: "BUG: scheduling > > while atomic". Is there any way to call sock_sendmsg() such that it > > executes atomically (i.e., doesn't relinquish the CPU to the > > scheduler)? It is not necessary to wait until the transmission is > > complete, and setting the flag MSG_DONTWAIT does not solve this issue. > > I tried looking for where the network stack returns -EIOCBQUEUED and > > got as far as udp_sendmsg(), but it then becomes difficult to follow > > the execution path (there's four goto labels in this function). Any > > help would be appreciated. > > > > Hi Michael, > > I believe you are trying to use sockets inside interrupt context,which is > not > possible. You can make use of bottom-halves(Work Queue, Tasklets etc..) > of ISR to get the job done. You can't schedule from a tasklet. -- Guillaume Knispel -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ