From owner-svn-src-stable-12@freebsd.org Sat May 9 21:34:51 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39D712F6AF0; Sat, 9 May 2020 21:34:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49KL7v0Npkz4Mr3; Sat, 9 May 2020 21:34:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 087A62267A; Sat, 9 May 2020 21:34:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 049LYo1H060934; Sat, 9 May 2020 21:34:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 049LYoJW060933; Sat, 9 May 2020 21:34:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005092134.049LYoJW060933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 9 May 2020 21:34:50 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 360857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.32 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2020 21:34:51 -0000 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)