BLOCKING_NOTIFIER_HEAD(x86_mce_decoder_chain);
 
 /* Do initial initialization of a struct mce */
-void mce_setup(struct mce *m)
+noinstr void mce_setup(struct mce *m)
 {
        memset(m, 0, sizeof(struct mce));
        m->cpu = m->extcpu = smp_processor_id();
        m->cpuid = cpuid_eax(1);
        m->socketid = cpu_data(m->extcpu).phys_proc_id;
        m->apicid = cpu_data(m->extcpu).initial_apicid;
-       rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap);
+       m->mcgcap = __rdmsr(MSR_IA32_MCG_CAP);
 
        if (this_cpu_has(X86_FEATURE_INTEL_PPIN))
-               rdmsrl(MSR_PPIN, m->ppin);
+               m->ppin = __rdmsr(MSR_PPIN);
        else if (this_cpu_has(X86_FEATURE_AMD_PPIN))
-               rdmsrl(MSR_AMD_PPIN, m->ppin);
+               m->ppin = __rdmsr(MSR_AMD_PPIN);
 
        m->microcode = boot_cpu_data.microcode;
 }
 }
 
 /* Handle unconfigured int18 (should never happen) */
-static void unexpected_machine_check(struct pt_regs *regs)
+static noinstr void unexpected_machine_check(struct pt_regs *regs)
 {
+       instrumentation_begin();
        pr_err("CPU#%d: Unexpected int18 (Machine Check)\n",
               smp_processor_id());
+       instrumentation_end();
 }
 
 /* Call the installed machine check handler for this CPU setup. */
                return;
 
        nmi_enter();
+       /*
+        * The call targets are marked noinstr, but objtool can't figure
+        * that out because it's an indirect call. Annotate it.
+        */
+       instrumentation_begin();
        machine_check_vector(regs);
+       instrumentation_end();
        nmi_exit();
 }
 
 static __always_inline void exc_machine_check_user(struct pt_regs *regs)
 {
        idtentry_enter(regs);
+       instrumentation_begin();
        machine_check_vector(regs);
+       instrumentation_end();
        idtentry_exit(regs);
 }
 
 
 int mce_p5_enabled __read_mostly;
 
 /* Machine check handler for Pentium class Intel CPUs: */
-static void pentium_machine_check(struct pt_regs *regs)
+static noinstr void pentium_machine_check(struct pt_regs *regs)
 {
        u32 loaddr, hi, lotype;
 
+       instrumentation_begin();
        rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
        rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
 
        }
 
        add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
+       instrumentation_end();
 }
 
 /* Set up machine check reporting for processors with Intel style MCE: */
 
 #include "internal.h"
 
 /* Machine check handler for WinChip C6: */
-static void winchip_machine_check(struct pt_regs *regs)
+static noinstr void winchip_machine_check(struct pt_regs *regs)
 {
+       instrumentation_begin();
        pr_emerg("CPU0: Machine Check Exception.\n");
        add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
+       instrumentation_end();
 }
 
 /* Set up machine check reporting on the Winchip C6 series */