Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jul 2015 21:44:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285616 - head/sys/kern
Message-ID:  <201507152144.t6FLiHVS000545@svnmir.geo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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