static void __kprobes clear_btf(void)
 {
        if (test_thread_flag(TIF_DEBUGCTLMSR))
-               wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
+               update_debugctlmsr(0);
 }
 
 static void __kprobes restore_btf(void)
 {
        if (test_thread_flag(TIF_DEBUGCTLMSR))
-               wrmsrl(MSR_IA32_DEBUGCTLMSR, current->thread.debugctlmsr);
+               update_debugctlmsr(current->thread.debugctlmsr);
 }
 
 static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
 
                /* we clear debugctl to make sure DS
                 * is not in use when we change it */
                debugctl = 0;
-               wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
+               update_debugctlmsr(0);
                wrmsr(MSR_IA32_DS_AREA, next->ds_area_msr, 0);
        }
 
        if (next->debugctlmsr != debugctl)
-               wrmsr(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr, 0);
+               update_debugctlmsr(next->debugctlmsr);
 
        if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
                set_debugreg(next->debugreg0, 0);
 
                /* we clear debugctl to make sure DS
                 * is not in use when we change it */
                debugctl = 0;
-               wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
+               update_debugctlmsr(0);
                wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr);
        }
 
        if (next->debugctlmsr != debugctl)
-               wrmsrl(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr);
+               update_debugctlmsr(next->debugctlmsr);
 
        if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
                loaddebug(next, 0);
 
        if (child != current)
                return;
 
-       wrmsrl(MSR_IA32_DEBUGCTLMSR, val);
+       update_debugctlmsr(val);
 }
 
 /*
 
 extern void cpu_init(void);
 extern void init_gdt(int cpu);
 
+static inline void update_debugctlmsr(unsigned long debugctlmsr)
+{
+#ifndef CONFIG_X86_DEBUGCTLMSR
+       if (boot_cpu_data.x86 < 6)
+               return;
+#endif
+       wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
+}
+
 /*
  * from system description table in BIOS. Mostly for MCA use, but
  * others may find it useful: