Skip to contentSkip to conversation

concurrency problems in a netfilter target extension?

DISCUSSION Tobias Koeck 2 participants 4 messages Jul 31, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

I´m writing on a netfilter target extension.

Are there some possible concurrency problems (means is it possible that my target extension modules is loaded several times or could it be used with several cpu cores simultaniously)?

If yes what is the best solution for that (which locking functions)?

Greetings and thanks
Tobias

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 5 lines · Tobias Koeck

I´m writing on a netfilter target extension.

Are there some possible concurrency problems (means is it possible that my target extension modules is loaded several times or could it be used with several cpu cores simultaniously)?

Yes, see "Writing your own Netfilter modules" at
http://jengelh.medozas.de/ , chapter "tricks and traps"
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

I've read that. But does it solve the problem in a target extension module? Will the modules only be cloned so that you have different data structures? Or is only one instance in the memory and if one processor changes something every other threads will use the changed values?

Quoted 11 lines · Jan Engelhardt
Quoted 5 lines · Tobias Koeck

I´m writing on a netfilter target extension.

Are there some possible concurrency problems (means is it possible that my target extension modules is loaded several times or could it be used with several cpu cores simultaniously)?

Yes, see "Writing your own Netfilter modules" at
http://jengelh.medozas.de/ , chapter "tricks and traps"

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 3 lines · Tobias Koeck

I've read that. But does it solve the problem in a target extension module? Will the modules only be cloned so that you have different data structures?

Which is why you allocate a separate structure, then let Netfilter clone it (shallow only) for percpu, so that in the end, you have one shared structure regardless of the cloning operation.

Quoted 3 lines

Or is only one instance in the memory and if one processor changes something every other threads will use the changed values?

Using this shared structure is then easy.