From owner-svn-src-stable@freebsd.org Tue Jul 11 03:45:49 2017 Return-Path: Delivered-To: svn-src-stable@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 1EAA9D934E5; Tue, 11 Jul 2017 03:45:49 +0000 (UTC) (envelope-from mjg@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 mx1.freebsd.org (Postfix) with ESMTPS id DFF64837F1; Tue, 11 Jul 2017 03:45:48 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6B3jmFa054655; Tue, 11 Jul 2017 03:45:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B3jmkt054654; Tue, 11 Jul 2017 03:45:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201707110345.v6B3jmkt054654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 11 Jul 2017 03:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320885 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 320885 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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 03:45:49 -0000 Author: mjg Date: Tue Jul 11 03:45:47 2017 New Revision: 320885 URL: https://svnweb.freebsd.org/changeset/base/320885 Log: Remove waiters check from the inline rw wunlock routine. This is a direct commit to stable/10. r310979 is a merge of depessimisation of locking primitives. The important part was getting rid of an attempt to grab the lock in the slow path immediately after the fast path failed. In addition to that temporary checks were added before all atomic ops. They have no impact on semantic nor correctness, they only avoid an atomic operation which is likely to fail. After the addition of atomic_fcmpset and further changes said checks became pessimal and got removed. This may get merged to stable/10. Reports started showing up about a crash in all branches having extra checks. The codepath is: .. -> vm_map_delete -> __rw_wunlock_hard -> turnstile_broadcast The kernel crashed trying to wake up nonexistent waiters. The lock value as found in the vmcore matches the panicking thread, so in particular there was no waiters bit set. The bit can only be cleared by the current owner. A debug patch was provided, which reportedly had a side effect of getting rid of the issue. Also one of the reporters said that reverting the patch which adds the extra checks makes the crash go away. It was also reported that head with the fcmpset changes (explicit checks removed) also stops crashing. Finally, one user tested crashing stable/10 variant with just the rw wunlock check removed. The common case in all but one reports was an Intel Atom cpu. Claiming a cpu bug at this point is bold and I'm going to refrain from it, but right now apart from cpu-specific optimisation made by the compiler on custom kernel compiles I don't see how this can be a software bug. This will have to be investigated more. Meanwhile, restore rw wunlock to pre-r310979 state. PR: 213903 Modified: stable/10/sys/sys/rwlock.h Modified: stable/10/sys/sys/rwlock.h ============================================================================== --- stable/10/sys/sys/rwlock.h Tue Jul 11 00:32:48 2017 (r320884) +++ stable/10/sys/sys/rwlock.h Tue Jul 11 03:45:47 2017 (r320885) @@ -109,7 +109,7 @@ \ if ((rw)->rw_recurse) \ (rw)->rw_recurse--; \ - else if ((rw)->rw_lock != _tid || !_rw_write_unlock((rw), _tid))\ + else if (!_rw_write_unlock((rw), _tid)) \ _rw_wunlock_hard((rw), _tid, (file), (line)); \ } while (0)