Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jul 2017 16:42:09 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320546 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201707011642.v61Gg9f6005062@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sat Jul  1 16:42:09 2017
New Revision: 320546
URL: https://svnweb.freebsd.org/changeset/base/320546

Log:
  When "force" is specified to pmap_invalidate_cache_range(), the given
  start address is not required to be page aligned.  However, the loop
  within pmap_invalidate_cache_range() that performs the actual cache
  line invalidations requires that the starting address be truncated to
  a multiple of the cache line size.  This change corrects an error in
  that truncation.
  
  Submitted by:	Brett Gutstein <bgutstein@rice.edu>
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Jul  1 15:58:57 2017	(r320545)
+++ head/sys/amd64/amd64/pmap.c	Sat Jul  1 16:42:09 2017	(r320546)
@@ -1868,7 +1868,7 @@ pmap_invalidate_cache_range(vm_offset_t sva, vm_offset
 {
 
 	if (force) {
-		sva &= ~(vm_offset_t)cpu_clflush_line_size;
+		sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1);
 	} else {
 		KASSERT((sva & PAGE_MASK) == 0,
 		    ("pmap_invalidate_cache_range: sva not page-aligned"));

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Jul  1 15:58:57 2017	(r320545)
+++ head/sys/i386/i386/pmap.c	Sat Jul  1 16:42:09 2017	(r320546)
@@ -1289,7 +1289,7 @@ pmap_invalidate_cache_range(vm_offset_t sva, vm_offset
 {
 
 	if (force) {
-		sva &= ~(vm_offset_t)cpu_clflush_line_size;
+		sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1);
 	} else {
 		KASSERT((sva & PAGE_MASK) == 0,
 		    ("pmap_invalidate_cache_range: sva not page-aligned"));



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