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.
Best regards,
Sameer.