Skip to contentSkip to conversation

2.6.15-rc2-mm1 problems (get_cpu / NUMA optimizations)

DISCUSSION Harald Welte 3 participants 3 messages Nov 24, 2005 – Nov 25, 2005 1 message not in the archive netfilter

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · David S. Miller

I've seen this reported multiple times.

It seems that module load is attempted by IP-tables while some locks are held, or similar.

yes, this was introduced by the recent NUMA patches that introduced get_cpu() / put_cpu() all over the place.

Seems like I only now realize the implications that this has all over the code, and to be honest, I'm not confident that there is a short-term fix since a lot of code needs to be audited.

Also, apart from just the iptables core, we actually call the checkentry() and destroy() functions of the match/target extensions under get_cpu() now. Plugin authors always assumed that they'd be able to do stuff like kmalloc(GFP_KERNEL) since they are guaranteed to always only be called from userspace context under the ipt_mutex.

I'm further analyzing our options, but we might have to pull out that NUMA change, especially since I'm heading for FOSS.in/linux-bangalore in a couple of days.

Signature · 5 lines
- Harald Welte <[email protected]>                 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
#2 lore raw
Quoted 12 lines · Harald Welte
Quoted 4 lines · David S. Miller

I've seen this reported multiple times.

It seems that module load is attempted by IP-tables while some locks are held, or similar.

yes, this was introduced by the recent NUMA patches that introduced get_cpu() / put_cpu() all over the place.

Hum... I was not aware that disabling preemption (in get_cpu()) had this effect (ie not allowing to sleep). I was using get_cpu() to bind the thread to the current cpu, maybe there is something better ?

If not, we can zap get_cpu()/pu_cpu() and use raw_smp_processor_id() as a hint only, (and dont care of preemption/cpu migration), as the value is only used as a hint to speedup operations in do_replace(), do_add_counters(), ipt_unregister_table(), translate_table()...

Eric

#3 lore raw
Quoted 1 line · Eric Dumazet

Hum... I was not aware that disabling preemption (in get_cpu()) had this effect (ie not allowing to sleep). I was using get_cpu() to bind the thread to the current cpu, maybe there is something better ?

set_cpus_allowed() might work.

Quoted 1 line

If not, we can zap get_cpu()/pu_cpu() and use raw_smp_processor_id() as a hint only, (and dont care of preemption/cpu migration), as the value is only used as a hint to speedup operations in do_replace(), do_add_counters(), ipt_unregister_table(), translate_table()...

That sounds like a good way. iptables ruleset replacement is and will always be slow anyway.