
delleceste at gmail
Dec 13, 2005, 12:04 AM
Post #3 of 5
(410 views)
Permalink
|
|
Re: execution context in netfilter hooks.
[In reply to]
|
|
A last question: you said LOCAL_OUT is on behalf of process, so it is in process context -> can be interrupted by timer -> the reason why code crashed! If so, the question would be finally clear! LOCAL_INPUT instead should be softirq, shouldn't it? Just like FORWARD... so timers don't cause interruption.. Thanks a lot very much! Giacomo. 2005/12/12, Harald Welte <laforge [at] netfilter>: > On Sun, Dec 11, 2005 at 09:39:16PM +0100, Giacomo wrote: > > Good morning, i would like to know exactly the context of execution > > of code registered with netfilter hooks. > > > As far as I understood, the context is that of a softirq, inside a > > bottom half. Correct me if i'm wrong.. > > 'bottom half' context doesn't really exist anymore in 2.6.x, so it's > softirq. But that's only true for forwarded packets. locally-generated > packets at LOCAL_OUT are in 'kernel on behalf of process' context. > > > But is it concerned with tasklets? > > what do you mean by "is it concerned" ? > > > Is execution serialized? In other words, if packet A fr instance is > > received from the net, and then packet B immediately, is packet A > > processed entirely before packet B? Or code can be executed in > > parallel for packet A and B? > > on multiple cpu's it's fully parallel, so yes, packet A will execute the > same netfilter hook (plus attached code) on CPU1 where packet B will run > on CPU2. > > On a single CPU, Packet B will be put onto a queue (by the hardirq > handler of the network driver) until packet A's softirq processing has > finished. Then packet B will enter softirq context and pulled from that > queue. > > > Moreover: interrupts are enabled in such context, aren't they? And that > > means that also a software timer can interrupt a routine being > > executed in bottom half. > > software timers dont interrupt softirq context. (neither did the > interrupt bottom half context, when it still existed). you seem to be > confused about the kernel contexts and their interaction. > > > But software timers run with sw interrupts disabled, so a timeout > > handler for instance cannot be interrupted by a routine managing > > reception of a packet arrived on the wire. > > I think you should read some general information on how softirq and > hardirq processing work. This is not really netfilter related. > > -- > - Harald Welte <laforge [at] netfilter> http://netfilter.org/ > ============================================================================ > "Fragmentation is like classful addressing -- an interesting early > architectural error that shows how much experimentation was going > on while IP was being designed." -- Paul Vixie > > > -- Giacomo S. http://www.giacomos.it - - - - - - - - - - - - - - - - - - - - - - Running `IPFIRE-wall` on debian GNU/Linux http://www.giacomos.it/ipfire http://www.debian.org mailto: delleceste [at] gmail giacomo.strangolino [at] elettra jacum [at] libero - - - - - - - - - - - - - - - - - - - - - -
|