summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/common.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-06-01 22:55:31 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2012-06-01 22:55:31 (GMT)
commit40b46a7d2938589a5abab132a7824fd17ae18f62 (patch)
tree2bdf9d2449b6f3437675f1398698e170aebb37cb /arch/x86/kernel/cpu/common.c
parentbad1a753d4d4deb09d4bc0bac1dd4fc3298502e9 (diff)
parent5963e317b1e9d2a4511503916d8fd664bb8fa8fb (diff)
downloadlinux-fsl-qoriq-40b46a7d2938589a5abab132a7824fd17ae18f62.tar.xz
Merge remote-tracking branch 'rostedt/tip/perf/urgent-2' into x86-urgent-for-linus
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r--arch/x86/kernel/cpu/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 82f29e7..6b9333b 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -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 */