aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2009-08-19 21:05:36 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-08-21 19:25:55 -0400
commitd0af9eed5aa91b6b7b5049cae69e5ea956fd85c3 (patch)
treeb9214db00ba734e5b943165082c30336f7a8425a /kernel
parent269c861baa2fe7c114c3bc7831292758d29eb336 (diff)
x86, pat/mtrr: Rendezvous all the cpus for MTRR/PAT init
SDM Vol 3a section titled "MTRR considerations in MP systems" specifies the need for synchronizing the logical cpu's while initializing/updating MTRR. Currently Linux kernel does the synchronization of all cpu's only when a single MTRR register is programmed/updated. During an AP online (during boot/cpu-online/resume) where we initialize all the MTRR/PAT registers, we don't follow this synchronization algorithm. This can lead to scenarios where during a dynamic cpu online, that logical cpu is initializing MTRR/PAT with cache disabled (cr0.cd=1) etc while other logical HT sibling continue to run (also with cache disabled because of cr0.cd=1 on its sibling). Starting from Westmere, VMX transitions with cr0.cd=1 don't work properly (because of some VMX performance optimizations) and the above scenario (with one logical cpu doing VMX activity and another logical cpu coming online) can result in system crash. Fix the MTRR initialization by doing rendezvous of all the cpus. During boot and resume, we delay the MTRR/PAT init for APs till all the logical cpu's come online and the rendezvous process at the end of AP's bringup, will initialize the MTRR/PAT for all AP's. For dynamic single cpu online, we synchronize all the logical cpus and do the MTRR/PAT init on the AP that is coming online. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8ce10043e4ac..f5f9485b8c0f 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -413,6 +413,14 @@ int disable_nonboot_cpus(void)
413 return error; 413 return error;
414} 414}
415 415
416void __weak arch_enable_nonboot_cpus_begin(void)
417{
418}
419
420void __weak arch_enable_nonboot_cpus_end(void)
421{
422}
423
416void __ref enable_nonboot_cpus(void) 424void __ref enable_nonboot_cpus(void)
417{ 425{
418 int cpu, error; 426 int cpu, error;
@@ -424,6 +432,9 @@ void __ref enable_nonboot_cpus(void)
424 goto out; 432 goto out;
425 433
426 printk("Enabling non-boot CPUs ...\n"); 434 printk("Enabling non-boot CPUs ...\n");
435
436 arch_enable_nonboot_cpus_begin();
437
427 for_each_cpu(cpu, frozen_cpus) { 438 for_each_cpu(cpu, frozen_cpus) {
428 error = _cpu_up(cpu, 1); 439 error = _cpu_up(cpu, 1);
429 if (!error) { 440 if (!error) {
@@ -432,6 +443,9 @@ void __ref enable_nonboot_cpus(void)
432 } 443 }
433 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error); 444 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
434 } 445 }
446
447 arch_enable_nonboot_cpus_end();
448
435 cpumask_clear(frozen_cpus); 449 cpumask_clear(frozen_cpus);
436out: 450out:
437 cpu_maps_update_done(); 451 cpu_maps_update_done();