From owner-svn-src-all@freebsd.org Fri Sep 18 16:52:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4FBB9CFC8A; Fri, 18 Sep 2015 16:52:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A35D613E4; Fri, 18 Sep 2015 16:52:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8IGqJm9059478; Fri, 18 Sep 2015 16:52:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8IGqJac059476; Fri, 18 Sep 2015 16:52:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509181652.t8IGqJac059476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Sep 2015 16:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287960 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2015 16:52:19 -0000 Author: kib Date: Fri Sep 18 16:52:18 2015 New Revision: 287960 URL: https://svnweb.freebsd.org/changeset/base/287960 Log: Clear exclusive monitors when handling data aborts, the monitors are in unknown state per spec. Reviewed by: andrew (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3668 Modified: head/sys/arm64/arm64/trap.c head/sys/arm64/include/cpufunc.h Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Fri Sep 18 13:44:15 2015 (r287959) +++ head/sys/arm64/arm64/trap.c Fri Sep 18 16:52:18 2015 (r287960) @@ -155,6 +155,13 @@ data_abort(struct trapframe *frame, uint uint64_t far; int error, sig, ucode; + /* + * According to the ARMv8-A rev. A.g, B2.10.5 "Load-Exclusive + * and Store-Exclusive instruction usage restrictions", state + * of the exclusive monitors after data abort exception is unknown. + */ + clrex(); + #ifdef KDB if (kdb_active) { kdb_reenter(); Modified: head/sys/arm64/include/cpufunc.h ============================================================================== --- head/sys/arm64/include/cpufunc.h Fri Sep 18 13:44:15 2015 (r287959) +++ head/sys/arm64/include/cpufunc.h Fri Sep 18 16:52:18 2015 (r287960) @@ -108,6 +108,17 @@ get_mpidr(void) return (mpidr); } +static __inline void +clrex(void) +{ + + /* + * Ensure compiler barrier, otherwise the monitor clear might + * occur too late for us ? + */ + __asm __volatile("clrex" : : : "memory"); +} + #define cpu_nullop() arm64_nullop() #define cpufunc_nullop() arm64_nullop() #define cpu_setttb(a) arm64_setttb(a)