Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2019 20:01:06 +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: r349768 - head/sys/arm64/arm64
Message-ID:  <201907052001.x65K16OU095248@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Fri Jul  5 20:01:06 2019
New Revision: 349768
URL: https://svnweb.freebsd.org/changeset/base/349768

Log:
  Restructure cache_handle_range to avoid repeated barriers.  Specifically,
  restructure cache_handle_range so that all of the data cache operations are
  performed before any instruction cache operations.  Then, we only need one
  barrier between the data and instruction cache operations and one barrier
  after the instruction cache operations.
  
  On an Amazon EC2 a1.2xlarge instance, this simple change reduces the time
  for a "make -j8 buildworld" by 9%.
  
  Reviewed by:	andrew
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D20848

Modified:
  head/sys/arm64/arm64/cpufunc_asm.S

Modified: head/sys/arm64/arm64/cpufunc_asm.S
==============================================================================
--- head/sys/arm64/arm64/cpufunc_asm.S	Fri Jul  5 16:49:34 2019	(r349767)
+++ head/sys/arm64/arm64/cpufunc_asm.S	Fri Jul  5 20:01:06 2019	(r349768)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 
 /*
  * Macro to handle the cache. This takes the start address in x0, length
- * in x1. It will corrupt x0, x1, x2, and x3.
+ * in x1. It will corrupt x0, x1, x2, x3, and x4.
  */
 .macro cache_handle_range dcop = 0, ic = 0, icop = 0
 .if \ic == 0
@@ -64,17 +64,23 @@ __FBSDID("$FreeBSD$");
 	and	x2, x0, x4		/* Get the low bits of the address */
 	add	x1, x1, x2		/* Add these to the size */
 	bic	x0, x0, x4		/* Clear the low bit of the address */
-1:
-	dc	\dcop, x0
-	dsb	ish
 .if \ic != 0
-	ic	\icop, x0
-	dsb	ish
+	mov	x2, x0			/* Save the address */
+	mov	x4, x1			/* Save the size */
 .endif
+1:
+	dc	\dcop, x0
 	add	x0, x0, x3		/* Move to the next line */
 	subs	x1, x1, x3		/* Reduce the size */
 	b.hi	1b			/* Check if we are done */
+	dsb	ish
 .if \ic != 0
+2:
+	ic	\icop, x2
+	add	x2, x2, x3		/* Move to the next line */
+	subs	x4, x4, x3		/* Reduce the size */
+	b.hi	2b			/* Check if we are done */
+	dsb	ish
 	isb
 .endif
 .endm



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