Re: [PROBLEM] sleeping function called from invalid context at mm/slab.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 10 Jun 2007 13:53:44 +0300, Octavian Purdila <tavi@xxxxxxxxx> wrote:
> On Sunday 10 June 2007 13:03, Lukas Razik wrote:
>> Hello!
>>
>> I'm new to kernel programming and I try to develop a fake ethernet
> driver
>> for v2.6.21.3 which I really need based on netdev but I ran into the
>> following issue:
>> If the kernel calls the 'dev->hard_start_xmit' function of my driver
> then
>> this calls another one which try to create a socket in the following
>> "normal way":
>>
>> struct socket *ssock = NULL;
>> ...
>> sock_create(family, SOCK_STREAM, IPPROTO_TCP, &ssock);
>>
>> But at this point I get an error message from the kernel as appended
> below.
>> So what have I done wrong?
>>
> 
> Hi Lukas,
> 
> The hard_start_xmit function is running in interrupt context, thus you
> can't
> call any functions that might sleep (and sock_create is one of them
> because
> it probably allocates memory with GFP_KERNEL)
> 
> I'm not sure what is the purpose of you ethernet driver, but when you run
> into
> this types of problems, you need to deffer the work that might sleep and
> run
> it from process context. workqueues and kernel threads are the means for
> that.
> 
> 
> tavi
> 
>

Hi Tavi!

I think I've understood you.
In the future the hard_ximit_function won't create a socket. It will only send by the help of sock_sendmsg() through one which will be created before.
BTW do you know if I can use sock_sendmsg() in interrupt context?

Because this is only a test I'll try to work here with a kernel thread...

Regards and many thanks for your fast answer!
Lukas



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux