From owner-svn-src-head@freebsd.org Mon Sep 7 14:01:19 2015 Return-Path: Delivered-To: svn-src-head@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 291AB9CB8C5; Mon, 7 Sep 2015 14:01:19 +0000 (UTC) (envelope-from andrew@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 1A49B1396; Mon, 7 Sep 2015 14:01:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87E1Iar065373; Mon, 7 Sep 2015 14:01:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87E1IgI065372; Mon, 7 Sep 2015 14:01:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509071401.t87E1IgI065372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Sep 2015 14:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287536 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 14:01:19 -0000 Author: andrew Date: Mon Sep 7 14:01:18 2015 New Revision: 287536 URL: https://svnweb.freebsd.org/changeset/base/287536 Log: Use load-acquire semantics while waiting for td_lock to be released. The store should have release semantics and will have due to the dsb above it so add a comment to explain this. [1] While here update the code to not reload the current thread, it's already in a register, we just need to not trash it. Suggested by: kib [1] Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/swtch.S Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Mon Sep 7 14:00:38 2015 (r287535) +++ head/sys/arm64/arm64/swtch.S Mon Sep 7 14:01:18 2015 (r287536) @@ -160,17 +160,18 @@ ENTRY(cpu_switch) dsb sy isb - /* Release the old thread */ + /* + * Release the old thread. This doesn't need to be a store-release + * as the above dsb instruction will provide release semantics. + */ str x2, [x0, #TD_LOCK] #if defined(SCHED_ULE) && defined(SMP) /* Read the value in blocked_lock */ ldr x0, =_C_LABEL(blocked_lock) - ldr x1, [x0] - /* Load curthread */ - ldr x2, [x18, #PC_CURTHREAD] + ldr x2, [x0] 1: - ldr x3, [x2, #TD_LOCK] - cmp x3, x1 + ldar x3, [x1, #TD_LOCK] + cmp x3, x2 b.eq 1b #endif