Author: kib
Date: Wed May  2 07:38:38 2018
New Revision: 333159
URL: https://svnweb.freebsd.org/changeset/base/333159

Log:
  MFC r332971:
  Ensure that cmci_monitor() is not executed in parallel.

Modified:
  stable/11/sys/x86/x86/mca.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/x86/mca.c
==============================================================================
--- stable/11/sys/x86/x86/mca.c Wed May  2 02:41:09 2018        (r333158)
+++ stable/11/sys/x86/x86/mca.c Wed May  2 07:38:38 2018        (r333159)
@@ -1056,6 +1056,14 @@ _mca_init(int boot)
                        if ((mask & (1UL << 5)) == 0)
                                wrmsr(MSR_MC0_CTL_MASK, mask | (1UL << 5));
                }
+
+               /*
+                * The cmci_monitor() must not be executed
+                * simultaneously by several CPUs.
+                */
+               if (boot)
+                       mtx_lock_spin(&mca_lock);
+
                for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
                        /* By default enable logging of all errors. */
                        ctl = 0xffffffffffffffffUL;
@@ -1090,6 +1098,8 @@ _mca_init(int boot)
                        /* Clear all errors. */
                        wrmsr(MSR_MC_STATUS(i), 0);
                }
+               if (boot)
+                       mtx_unlock_spin(&mca_lock);
 
 #ifdef DEV_APIC
                /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to