Commit 21ece08c authored by Thomas Gleixner's avatar Thomas Gleixner

net: fix the xtables smp_processor_id assumptions for -rt

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bf794775
......@@ -473,14 +473,14 @@ static inline void xt_info_rdlock_bh(void)
struct xt_info_lock *lock;
local_bh_disable();
lock = &__get_cpu_var(xt_info_locks);
lock = &__raw_get_cpu_var(xt_info_locks);
if (likely(!lock->readers++))
spin_lock(&lock->lock);
}
static inline void xt_info_rdunlock_bh(void)
{
struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks);
struct xt_info_lock *lock = &__raw_get_cpu_var(xt_info_locks);
if (likely(!--lock->readers))
spin_unlock(&lock->lock);
......
......@@ -709,7 +709,7 @@ static void get_counters(const struct xt_table_info *t,
{
unsigned int cpu;
unsigned int i;
unsigned int curcpu;
unsigned int curcpu = NR_CPUS;
/* Instead of clearing (by a previous call to memset())
* the counters and using adds, we set the counters
......@@ -719,6 +719,7 @@ static void get_counters(const struct xt_table_info *t,
* if new softirq were to run and call ipt_do_table
*/
local_bh_disable();
#ifndef CONFIG_PREEMPT_RT
curcpu = smp_processor_id();
i = 0;
......@@ -727,7 +728,7 @@ static void get_counters(const struct xt_table_info *t,
set_entry_to_counter,
counters,
&i);
#endif
for_each_possible_cpu(cpu) {
if (cpu == curcpu)
continue;
......
......@@ -348,7 +348,7 @@ ipt_do_table(struct sk_buff *skb,
IP_NF_ASSERT(table->valid_hooks & (1 << hook));
xt_info_rdlock_bh();
private = table->private;
table_base = private->entries[smp_processor_id()];
table_base = private->entries[raw_smp_processor_id()];
e = get_entry(table_base, private->hook_entry[hook]);
......@@ -892,7 +892,7 @@ get_counters(const struct xt_table_info *t,
{
unsigned int cpu;
unsigned int i;
unsigned int curcpu;
unsigned int curcpu = NR_CPUS;
/* Instead of clearing (by a previous call to memset())
* the counters and using adds, we set the counters
......@@ -902,6 +902,7 @@ get_counters(const struct xt_table_info *t,
* if new softirq were to run and call ipt_do_table
*/
local_bh_disable();
#ifndef CONFIG_PREEMPT_RT
curcpu = smp_processor_id();
i = 0;
......@@ -910,7 +911,7 @@ get_counters(const struct xt_table_info *t,
set_entry_to_counter,
counters,
&i);
#endif
for_each_possible_cpu(cpu) {
if (cpu == curcpu)
continue;
......@@ -1391,7 +1392,7 @@ do_add_counters(struct net *net, void __user *user, unsigned int len, int compat
i = 0;
/* Choose the copy that is on our node */
curcpu = smp_processor_id();
curcpu = raw_smp_processor_id();
loc_cpu_entry = private->entries[curcpu];
xt_info_wrlock(curcpu);
IPT_ENTRY_ITERATE(loc_cpu_entry,
......
......@@ -921,7 +921,7 @@ get_counters(const struct xt_table_info *t,
{
unsigned int cpu;
unsigned int i;
unsigned int curcpu;
unsigned int curcpu = NR_CPUS;
/* Instead of clearing (by a previous call to memset())
* the counters and using adds, we set the counters
......@@ -931,6 +931,8 @@ get_counters(const struct xt_table_info *t,
* if new softirq were to run and call ipt_do_table
*/
local_bh_disable();
#ifndef CONFIG_PREEMPT_RT
curcpu = smp_processor_id();
i = 0;
......@@ -939,7 +941,7 @@ get_counters(const struct xt_table_info *t,
set_entry_to_counter,
counters,
&i);
#endif
for_each_possible_cpu(cpu) {
if (cpu == curcpu)
continue;
......@@ -960,12 +962,13 @@ static struct xt_counters *alloc_counters(struct xt_table *table)
unsigned int countersize;
struct xt_counters *counters;
struct xt_table_info *private = table->private;
int node = cpu_to_node(raw_smp_processor_id());
/* We need atomic snapshot of counters: rest doesn't change
(other than comefrom, which userspace doesn't care
about). */
countersize = sizeof(struct xt_counters) * private->number;
counters = vmalloc_node(countersize, numa_node_id());
counters = vmalloc_node(countersize, node);
if (counters == NULL)
return ERR_PTR(-ENOMEM);
......@@ -1423,7 +1426,7 @@ do_add_counters(struct net *net, void __user *user, unsigned int len,
i = 0;
/* Choose the copy that is on our node */
curcpu = smp_processor_id();
curcpu = raw_smp_processor_id();
xt_info_wrlock(curcpu);
loc_cpu_entry = private->entries[curcpu];
IP6T_ENTRY_ITERATE(loc_cpu_entry,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment