Skip to contentSkip to conversation

modules fix incorrect percpu usage

PATCH In review Mathieu Desnoyers 4 participants 8 messages Mar 30, 2010 – Apr 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modules fix incorrect percpu usage

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

CC Randy Dunlap <[email protected]>
CC Eric Dumazet <[email protected]>
CC Rusty Russell <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Tejun Heo <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
CC Steven Rostedt <[email protected]>
CC stable <[email protected]>
---
 kernel/module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module.c +1 -1
Index: linux-2.6-lttng/kernel/module.c
===================================================================
@@ -412,7 +412,7 @@ static void percpu_modcopy(void *pcpudes
 	int cpu;
 
 	for_each_possible_cpu(cpu)
-		memcpy(pcpudest + per_cpu_offset(cpu), from, size);
+		memcpy(per_cpu_ptr(pcpudest, cpu), from, size);
 }
 
 #else /* ... !CONFIG_SMP */
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#1 lore raw
Quoted 10 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

It's actually needed for mainline too (2.6.34-rc2).

Thanks,

Mathieu

Quoted 36 lines
CC Randy Dunlap <[email protected]>
CC Eric Dumazet <[email protected]>
CC Rusty Russell <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Tejun Heo <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
CC Steven Rostedt <[email protected]>
CC stable <[email protected]>
---
 kernel/module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-lttng/kernel/module.c
===================================================================

kernel/module.c +1 -1
@@ -412,7 +412,7 @@ static void percpu_modcopy(void *pcpudes
 	int cpu;
 
 	for_each_possible_cpu(cpu)
-		memcpy(pcpudest + per_cpu_offset(cpu), from, size);
+		memcpy(per_cpu_ptr(pcpudest, cpu), from, size);
 }
 
 #else /* ... !CONFIG_SMP */
Signature · 5 lines
-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#2 lore raw
Quoted 6 lines · Mathieu Desnoyers
Quoted 5 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

Quoted 7 lines
Quoted 5 lines

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

It's actually needed for mainline too (2.6.34-rc2).

Then all you need to do is submit it for mainline with a "Cc: [email protected]" as you did below. It will then automatically be added to the stable queue when Linus pulls it.

-- Steve

Quoted 23 lines

Thanks,

Mathieu

Quoted 18 lines
CC Randy Dunlap <[email protected]>
CC Eric Dumazet <[email protected]>
CC Rusty Russell <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Tejun Heo <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
CC Steven Rostedt <[email protected]>
CC stable <[email protected]>
---
 kernel/module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw
Quoted 13 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 12 lines · Mathieu Desnoyers
Quoted 10 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

Quoted 5 lines
Quoted 1 line

It's actually needed for mainline too (2.6.34-rc2).

Then all you need to do is submit it for mainline with a "Cc: [email protected]" as you did below. It will then automatically be added to the stable queue when Linus pulls it.

OK, thanks for the info.

Mathieu

Quoted 27 lines

-- Steve

Quoted 23 lines

Thanks,

Mathieu

Quoted 18 lines
CC Randy Dunlap <[email protected]>
CC Eric Dumazet <[email protected]>
CC Rusty Russell <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Tejun Heo <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
CC Steven Rostedt <[email protected]>
CC stable <[email protected]>
---
 kernel/module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#4 lore raw
Quoted 14 lines · Mathieu Desnoyers
Quoted 13 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 12 lines · Mathieu Desnoyers
Quoted 10 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It's actually needed for mainline too (2.6.34-rc2).

Then all you need to do is submit it for mainline with a "Cc: [email protected]" as you did below. It will then automatically be added to the stable queue when Linus pulls it.

OK, thanks for the info.

And I need to wait until it goes into Linus's tree before it can be applied to the stable tree. This hasn't happened yet, right?

thanks,

greg k-h

#5 lore raw
Quoted 21 lines · * Greg KH ([email protected]) wrote:
Quoted 20 lines · Mathieu Desnoyers
Quoted 18 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 6 lines · Mathieu Desnoyers
Quoted 5 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

Quoted 7 lines
Quoted 5 lines

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

It's actually needed for mainline too (2.6.34-rc2).

Then all you need to do is submit it for mainline with a "Cc: [email protected]" as you did below. It will then automatically be added to the stable queue when Linus pulls it.

Quoted 8 lines
Quoted 1 line

OK, thanks for the info.

And I need to wait until it goes into Linus's tree before it can be applied to the stable tree. This hasn't happened yet, right?

thanks,

greg k-h

Same here, for module.c fix. Feel free to choose between this fix or the corresponding refactoring from Tejun.

modules fix incorrect percpu usage

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x. (tested on 2.6.33.1 x86_64)

Mainline does not need this fix, as commit 259354deaaf03d49a02dbb9975d6ec2a54675672 fixed the problem by refactoring.

CC Randy Dunlap <[email protected]>
CC Eric Dumazet <[email protected]>
CC Rusty Russell <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Tejun Heo <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
CC Steven Rostedt <[email protected]>
CC stable <[email protected]>
---
 kernel/module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module.c +1 -1
Index: linux.trees.git/kernel/module.c
===================================================================
@@ -405,7 +405,7 @@ static void percpu_modcopy(void *pcpudes
 	int cpu;
 
 	for_each_possible_cpu(cpu)
-		memcpy(pcpudest + per_cpu_offset(cpu), from, size);
+		memcpy(per_cpu_ptr(pcpudest, cpu), from, size);
 }
 
 #else /* ... !CONFIG_SMP */
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#6 lore raw
Quoted 27 lines · Mathieu Desnoyers
Quoted 26 lines · * Greg KH ([email protected]) wrote:
Quoted 14 lines · Mathieu Desnoyers
Quoted 13 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 12 lines · Mathieu Desnoyers
Quoted 10 lines · * Mathieu Desnoyers ([email protected]) wrote:

Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).

Introduced by commit:

module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3

This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x.
(tested on 2.6.33.1 x86_64)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It's actually needed for mainline too (2.6.34-rc2).

Then all you need to do is submit it for mainline with a "Cc: [email protected]" as you did below. It will then automatically be added to the stable queue when Linus pulls it.

OK, thanks for the info.

And I need to wait until it goes into Linus's tree before it can be applied to the stable tree. This hasn't happened yet, right?

Quoted 6 lines
Quoted 3 lines

thanks,

greg k-h

Same here, for module.c fix. Feel free to choose between this fix or the corresponding refactoring from Tejun.

Thanks, I took this one.

greg k-h

#7 lore raw
In reply to Mathieu Desnoyers

Hello,

Quoted 2 lines · Mathieu Desnoyers

Same here, for module.c fix. Feel free to choose between this fix or the corresponding refactoring from Tejun.

Please take this one for -stable. I don't think the percpu refactoring is worthwhile to backport to -stable. It only affects debug feature and the worst outcome is spurious warning messages.

Thanks.

Signature · 1 line
tejun