RE: catch 22 - porting net driver from 2.2 to 2.4

From: Hen, Shmulik (
Date: Mon Nov 20 2000 - 11:13:21 EST

I tried using the kernel thread as demonstrated in your example and again it
failed (panic - scheduling in interrupt).
The difference is that your code executes the thread from within dev->open,
while my code tries to do that from dev->do_ioctl that has spinlocks around
the entire operation (which apparently sleeps).
If I comment out the spin_lock/unlock it will succeed, but then I can't be
sure I don't get any concurrent Tx/Rx/timer which is a bad idea while the
topology is still being created.

is there any way to do something like firing threads/timers atomically ?


-----Original Message-----
From: Jeff Garzik []
Sent: Monday, November 13, 2000 4:26 PM
To: Hen, Shmulik
Subject: Re: catch 22 - porting net driver from 2.2 to 2.4

"Hen, Shmulik" wrote:
> Where can I find info about that ?
> My first idea was to fire a timer and let the callback routine do the
> but I worry about synchronization and about passing the list of items for
> to handle.
> What is the accepted way of starting a kernel thread and how do I handle
> parameters and sync. ?

Attached is an example. My "8139too" ethernet driver uses a kernel
thread instead of a timer to perform media checking. It illustrates how
to start and stop a kernel thread.

Jeff Garzik             |
Building 1024           | The chief enemy of creativity is "good" sense
MandrakeSoft            |          -- Picasso

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 21:00:19 EST