Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / x86 / kernel / cpu / common.c
index 82f29e70d05833b7b3b6e0b7789a46ef9a75c4b8..5bbc082c47ad8d1fef9950c5dda873f1fdd5975c 100644 (file)
@@ -947,7 +947,7 @@ static void __cpuinit __print_cpu_msr(void)
                index_max = msr_range_array[i].max;
 
                for (index = index_min; index < index_max; index++) {
-                       if (rdmsrl_amd_safe(index, &val))
+                       if (rdmsrl_safe(index, &val))
                                continue;
                        printk(KERN_INFO " MSR%08x: %016llx\n", index, val);
                }
@@ -1101,14 +1101,20 @@ int is_debug_stack(unsigned long addr)
                 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
 }
 
+static DEFINE_PER_CPU(u32, debug_stack_use_ctr);
+
 void debug_stack_set_zero(void)
 {
+       this_cpu_inc(debug_stack_use_ctr);
        load_idt((const struct desc_ptr *)&nmi_idt_descr);
 }
 
 void debug_stack_reset(void)
 {
-       load_idt((const struct desc_ptr *)&idt_descr);
+       if (WARN_ON(!this_cpu_read(debug_stack_use_ctr)))
+               return;
+       if (this_cpu_dec_return(debug_stack_use_ctr) == 0)
+               load_idt((const struct desc_ptr *)&idt_descr);
 }
 
 #else  /* CONFIG_X86_64 */
This page took 0.107396 seconds and 5 git commands to generate.