Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 May 2020 21:34:50 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r360857 - stable/12/sys/riscv/riscv
Message-ID:  <202005092134.049LYoJW060933@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat May  9 21:34:50 2020
New Revision: 360857
URL: https://svnweb.freebsd.org/changeset/base/360857

Log:
  MFC 357313: Trim duplicate CSR swaps from user exceptions.
  
  The stack pointer is swapped with the sscratch CSR just before the
  jump to cpu_exception_handler_user where the first instruction swaps
  it again.  The two swaps together are a no-op, but the csr swap
  instructions can be expensive (e.g. on Bluespec RISC-V cores csr swap
  instructions force a full pipeline stall).

Modified:
  stable/12/sys/riscv/riscv/exception.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/exception.S
==============================================================================
--- stable/12/sys/riscv/riscv/exception.S	Sat May  9 21:32:44 2020	(r360856)
+++ stable/12/sys/riscv/riscv/exception.S	Sat May  9 21:34:50 2020	(r360857)
@@ -208,7 +208,6 @@ ENTRY(cpu_exception_handler)
 	csrrw	sp, sscratch, sp
 	beqz	sp, 1f
 	/* User mode detected */
-	csrrw	sp, sscratch, sp
 	j	cpu_exception_handler_user
 1:
 	/* Supervisor mode detected */
@@ -225,7 +224,6 @@ ENTRY(cpu_exception_handler_supervisor)
 END(cpu_exception_handler_supervisor)
 
 ENTRY(cpu_exception_handler_user)
-	csrrw	sp, sscratch, sp
 	save_registers 0
 	mv	a0, sp
 	call	_C_LABEL(do_trap_user)



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