svn commit: r332971 - head/sys/x86/x86

Konstantin Belousov kib at FreeBSD.org
Tue Apr 24 20:29:41 UTC 2018


Author: kib
Date: Tue Apr 24 20:29:40 2018
New Revision: 332971
URL: https://svnweb.freebsd.org/changeset/base/332971

Log:
  Ensure that cmci_monitor() is not executed in parallel, since shared
  machine check banks must be only monitored by single CPU.
  
  Noted and reviewed by:	jhb
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D15157

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==============================================================================
--- head/sys/x86/x86/mca.c	Tue Apr 24 20:22:30 2018	(r332970)
+++ head/sys/x86/x86/mca.c	Tue Apr 24 20:29:40 2018	(r332971)
@@ -1119,6 +1119,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;
@@ -1158,6 +1166,8 @@ _mca_init(int boot)
 			/* Clear all errors. */
 			wrmsr(MSR_MC_STATUS(i), 0);
 		}
+		if (boot)
+			mtx_unlock_spin(&mca_lock);
 
 #ifdef DEV_APIC
 		if (!amd_thresholding_supported() &&


More information about the svn-src-all mailing list