Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Dec 2008 18:32:09 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r185740 - head/sys/dev/pccbb
Message-ID:  <200812071832.mB7IW96f032499@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sun Dec  7 18:32:09 2008
New Revision: 185740
URL: http://svn.freebsd.org/changeset/base/185740

Log:
  Use atomic_add_int rather than a simple ++ to ensure no cache races if
  the power interrupt and init code waiting for the interrupt are
  running on different CPUs.  I haven't seen this make any real
  difference, but I've also had some reports of odd behavior I can't
  otherwise explain.  It is an infrequent operation, and certainly
  wouldn't hurt.

Modified:
  head/sys/dev/pccbb/pccbb_pci.c

Modified: head/sys/dev/pccbb/pccbb_pci.c
==============================================================================
--- head/sys/dev/pccbb/pccbb_pci.c	Sun Dec  7 13:25:06 2008	(r185739)
+++ head/sys/dev/pccbb/pccbb_pci.c	Sun Dec  7 18:32:09 2008	(r185740)
@@ -730,7 +730,7 @@ cbb_pci_filt(void *arg)
 		if (sockevent & CBB_SOCKET_EVENT_POWER) {
 			cbb_clrb(sc, CBB_SOCKET_MASK, CBB_SOCKET_EVENT_POWER);
 			cbb_set(sc, CBB_SOCKET_EVENT, CBB_SOCKET_EVENT_POWER);
-			sc->powerintr++;
+			atomic_add_int(&sc->powerintr, 1);
 			wakeup((void *)&sc->powerintr);
 		}
 		retval = FILTER_HANDLED;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812071832.mB7IW96f032499>