svn commit: r285616 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Jul 15 21:44:17 UTC 2015


Author: kib
Date: Wed Jul 15 21:44:16 2015
New Revision: 285616
URL: https://svnweb.freebsd.org/changeset/base/285616

Log:
  Do not use atomic_swap_int(9), it is not available on all
  architectures.  Atomic_cmpset_int(9) is a direct replacement, due to
  loop.  The change fixes arm, arm64, mips an sparc64, which lack
  atomic_swap().
  
  Suggested and reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==============================================================================
--- head/sys/kern/kern_intr.c	Wed Jul 15 21:35:09 2015	(r285615)
+++ head/sys/kern/kern_intr.c	Wed Jul 15 21:44:16 2015	(r285616)
@@ -1327,7 +1327,7 @@ ithread_loop(void *arg)
 		 * we are running, it will set it_need to note that we
 		 * should make another pass.
 		 */
-		while (atomic_swap_int(&ithd->it_need, 0) != 0) {
+		while (atomic_cmpset_int(&ithd->it_need, 1, 0) != 0) {
 			/*
 			 * This needs a release barrier to make sure
 			 * that this write posts before any of the
@@ -1506,7 +1506,7 @@ ithread_loop(void *arg)
 		 * we are running, it will set it_need to note that we
 		 * should make another pass.
 		 */
-		while (atomic_swap_int(&ithd->it_need, 0) != 0) {
+		while (atomic_cmpset_int(&ithd->it_need, 1, 0) != 0) {
 			/*
 			 * This needs a release barrier to make sure
 			 * that this write posts before any of the


More information about the svn-src-head mailing list