Skip to contentSkip to conversation

correct mis-conversion set_bit() -> __cpumask_set_cpu() by 4aaca0e9cd

PATCH Superseded Jan Beulich 4 participants 7 messages Feb 23, 2015 – Feb 27, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 correct mis-conversion set_bit() -> __cpumask_set_cpu() by 4aaca0e9cd

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
 void cpu_raise_softirq_batch_begin(void)

correct mis-conversion set_bit() -> __cpumask_set_cpu() by 4aaca0e9cd

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
 void cpu_raise_softirq_batch_begin(void)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 10 lines · you

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c void cpu_raise_softirq(unsigned int cpu, · line 112

Quoted 8 lines
xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
 void cpu_raise_softirq_batch_begin(void)

Thanks !

--
Sander

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 6 lines · Jan Beulich

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

Insofar as this clearly corrects the identified regression,

However, I am still not convinced that the resulting code is actually correct.

batch_mask is a cpumask_t and used properly as a cpumask in cpumask_raise_softirq(). It is wrong to be putting softirq indices into it here.

Quoted 17 lines
xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
 void cpu_raise_softirq_batch_begin(void)
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 23.02.15 at 13:01, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

Insofar as this clearly corrects the identified regression,

Quoted 8 lines

However, I am still not convinced that the resulting code is actually correct.

batch_mask is a cpumask_t and used properly as a cpumask in cpumask_raise_softirq(). It is wrong to be putting softirq indices into it here.

Ah, now I see (somehow I didn't pay close enough attention to what you said in the morning) - the code was wrong even before that change. In that case - yes, let's not fix it the wrong way.

Jan

#4 lore raw
In reply to Jan Beulich
Quoted 10 lines · you

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c void cpu_raise_softirq(unsigned int cpu, · line 112

Quoted 8 lines
xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
 void cpu_raise_softirq_batch_begin(void)

Hi Jan,

Any reason this wasn't applied to staging yet ?

--
Sander

#5 lore raw
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 26.02.15 at 17:53, <[email protected]> wrote:
Quoted 17 lines · you

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
Quoted 5 lines

xen/common/softirq.c void cpu_raise_softirq(unsigned int cpu, · line 112

Quoted 1 line
xen/common/softirq.c +0 -0
 void cpu_raise_softirq_batch_begin(void)

Hi Jan,

Any reason this wasn't applied to staging yet ?

It didn't get ack-ed so far (and it was a little too early still to ping it - I try to allow a week before doing so).

Jan

Acked-by
#6 lore raw
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 26.02.15 at 17:53, <[email protected]> wrote:
Quoted 17 lines · you

I have no idea how I came to use __cpumask_set_cpu() there, the conversion should have been set_bit() -> __set_bit(). The wrong construct results in problems on systems with relatively few CPUs.

xen/common/softirq.c +1 -1
@@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
     if ( !per_cpu(batching, this_cpu) || in_irq() )
         smp_send_event_check_cpu(cpu);
     else
-        __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
+        __set_bit(nr, &per_cpu(batch_mask, this_cpu));
 }
 
Quoted 7 lines
Quoted 5 lines

xen/common/softirq.c void cpu_raise_softirq(unsigned int cpu, · line 112

Quoted 1 line
xen/common/softirq.c +0 -0
 void cpu_raise_softirq_batch_begin(void)

Hi Jan,

Any reason this wasn't applied to staging yet ?

It didn't get ack-ed

Sorry, I thought this was an x86 patch for some reason and therefore that Andrew's ack was sufficient.

For v2 of the patch (<[email protected]>, using __cpumask_set_cpu(cpu, ...):