aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-06-03 16:50:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-04 16:25:09 -0400
commit4c738480d21a190e3d99c7ce985ab9484f373a3c (patch)
tree9a9fefe07e4d56d59777e27b4ee71dae221337c1
parente44a45ae7b7f7c7a4ebd6aa39b703bf2b97fe848 (diff)
mtrr atomicity fix
Rafael gets this on an SMP box with kernel preemption enabled, during hibernation and restore (100% of the time): Enabling non-boot CPUs ... BUG: using smp_processor_id() in preemptible [00000001] code: bash/4514 caller is mtrr_save_state+0x9/0x40 Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 1cf466df330a..7202b98aac4f 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -734,10 +734,13 @@ void mtrr_ap_init(void)
734 */ 734 */
735void mtrr_save_state(void) 735void mtrr_save_state(void)
736{ 736{
737 if (smp_processor_id() == 0) 737 int cpu = get_cpu();
738
739 if (cpu == 0)
738 mtrr_save_fixed_ranges(NULL); 740 mtrr_save_fixed_ranges(NULL);
739 else 741 else
740 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1); 742 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
743 put_cpu();
741} 744}
742 745
743static int __init mtrr_init_finialize(void) 746static int __init mtrr_init_finialize(void)