Re: tq_immediate

Alan Cox (alan@lxorguk.ukuu.org.uk)
Mon, 22 Feb 1999 12:01:53 +0000 (GMT)


> I'm working on a network device driver which has a global data (very
> complex dynamic data structure actually) which is accessed for read

Thats generally a bad sign 8)

> and write from dev->hard_start_xmit and dev->do_ioctl and a third
> function, let's say foo(), which is not called directly but frequently
> queued as task on tq_immediate. Should the global data be protected by
> sema/spinlock or something?

You can be executing open and interrupt handlers together the moment
you don't have interrupts on.

You can be executing get_stats, do_ioctl, hard_start_xmit and the receive
irq in parallel if you have enough cpus. I think close as well, but I'd
have to check.

> The ioctl can not interrupt other functions, that's clear. I hope that
> hard_start_xmit can not either. But what about the queued task foo?

Its not just about interrupting. They can be running in parallel on
multiple processors

> BTW is that true that dev->hard_start_xmit call is always initiated
> by a user program (send/write call). Or is there any case when it is
> called by the kernel itself (for example from a queued task)?

It can be run from a bottom half (normally timer_bh or net_bh). The
transmit function itself won't be recursively re-entered and when
it is called bh handling is blocked (please dont rely on that for 2.3,
just rely on the drivers transmit function not being re-entered)

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/