Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2019 17:10:16 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342765 - head/sys/riscv/riscv
Message-ID:  <201901041710.x04HAGiV027682@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Jan  4 17:10:16 2019
New Revision: 342765
URL: https://svnweb.freebsd.org/changeset/base/342765

Log:
  Fix dirty bit handling in pmap_remove_write().
  
  Reviewed by:	jhb, kib
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D18732

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c	Fri Jan  4 17:08:45 2019	(r342764)
+++ head/sys/riscv/riscv/pmap.c	Fri Jan  4 17:10:16 2019	(r342765)
@@ -2947,15 +2947,13 @@ retry_pv_loop:
 			}
 		}
 		l3 = pmap_l3(pmap, pv->pv_va);
-retry:
 		oldl3 = pmap_load(l3);
-
+retry:
 		if ((oldl3 & PTE_W) != 0) {
-			newl3 = oldl3 & ~PTE_W;
-			if (!atomic_cmpset_long(l3, oldl3, newl3))
+			newl3 = oldl3 & ~(PTE_D | PTE_W);
+			if (!atomic_fcmpset_long(l3, &oldl3, newl3))
 				goto retry;
-			/* TODO: check for PTE_D? */
-			if ((oldl3 & PTE_A) != 0)
+			if ((oldl3 & PTE_D) != 0)
 				vm_page_dirty(m);
 			pmap_invalidate_page(pmap, pv->pv_va);
 		}



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