2008-11-21 10:39:17

by Rusty Russell

[permalink] [raw]
Subject: [PATCH 1/3] percpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r

Impact: CPU iterator bugfixes

Percpu areas are only allocated for possible cpus. In general, you
shouldn't access random cpu's percpu areas.

Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Mike Travis <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
---
arch/m32r/kernel/smpboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- test-compile.orig/arch/m32r/kernel/smpboot.c
+++ test-compile/arch/m32r/kernel/smpboot.c
@@ -598,7 +598,7 @@ int setup_profiling_timer(unsigned int m
* accounting. At that time they also adjust their APIC timers
* accordingly.
*/
- for (i = 0; i < NR_CPUS; ++i)
+ for_each_possible_cpu(i)
per_cpu(prof_multiplier, i) = multiplier;

return 0;


2008-11-27 18:22:42

by Hirokazu Takata

[permalink] [raw]
Subject: Re: [PATCH 1/3] percpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r

Acked-by: Hirokazu Takata <[email protected]>

At Fri, 21 Nov 2008 21:09:01 +1030, Rusty Russell wrote:
>
> Impact: CPU iterator bugfixes
>
> Percpu areas are only allocated for possible cpus. In general, you
> shouldn't access random cpu's percpu areas.
>
> Signed-off-by: Rusty Russell <[email protected]>
> Signed-off-by: Mike Travis <[email protected]>
> Acked-by: Ingo Molnar <[email protected]>
> ---
> arch/m32r/kernel/smpboot.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- test-compile.orig/arch/m32r/kernel/smpboot.c
> +++ test-compile/arch/m32r/kernel/smpboot.c
> @@ -598,7 +598,7 @@ int setup_profiling_timer(unsigned int m
> * accounting. At that time they also adjust their APIC timers
> * accordingly.
> */
> - for (i = 0; i < NR_CPUS; ++i)
> + for_each_possible_cpu(i)
> per_cpu(prof_multiplier, i) = multiplier;
>
> return 0;
>
>