Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2010 15:50:38 +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: r204957 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201003101550.o2AFocNF081419@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Mar 10 15:50:38 2010
New Revision: 204957
URL: http://svn.freebsd.org/changeset/base/204957

Log:
  Fall back to wbinvd when region for CLFLUSH is >= 2MB.
  
  Submitted by:	Kevin Day <toasty dragondata com>
  Reviewed by:	jhb
  MFC after:	2 weeks

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	Wed Mar 10 15:47:33 2010	(r204956)
+++ head/sys/amd64/amd64/pmap.c	Wed Mar 10 15:50:38 2010	(r204957)
@@ -1105,7 +1105,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 	if (cpu_feature & CPUID_SS)
 		; /* If "Self Snoop" is supported, do nothing. */
-	else if (cpu_feature & CPUID_CLFSH) {
+	else if ((cpu_feature & CPUID_CLFSH) != 0 &&
+		 eva - sva < 2 * 1024 * 1024) {
 
 		/*
 		 * Otherwise, do per-cache line flush.  Use the mfence
@@ -1122,7 +1123,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 		/*
 		 * No targeted cache flush methods are supported by CPU,
-		 * globally invalidate cache as a last resort.
+		 * or the supplied range is bigger then 2MB.
+		 * Globally invalidate cache.
 		 */
 		pmap_invalidate_cache();
 	}

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Wed Mar 10 15:47:33 2010	(r204956)
+++ head/sys/i386/i386/pmap.c	Wed Mar 10 15:50:38 2010	(r204957)
@@ -996,7 +996,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 	if (cpu_feature & CPUID_SS)
 		; /* If "Self Snoop" is supported, do nothing. */
-	else if (cpu_feature & CPUID_CLFSH) {
+	else if ((cpu_feature & CPUID_CLFSH) != 0 &&
+		 eva - sva < 2 * 1024 * 1024) {
 
 		/*
 		 * Otherwise, do per-cache line flush.  Use the mfence
@@ -1013,7 +1014,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 		/*
 		 * No targeted cache flush methods are supported by CPU,
-		 * globally invalidate cache as a last resort.
+		 * or the supplied range is bigger then 2MB.
+		 * Globally invalidate cache.
 		 */
 		pmap_invalidate_cache();
 	}



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