From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 23 18:48:31 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38D8B894 for ; Tue, 23 Apr 2013 18:48:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id BE3171705 for ; Tue, 23 Apr 2013 18:48:30 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r3NImQpq055822; Tue, 23 Apr 2013 21:48:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.2 kib.kiev.ua r3NImQpq055822 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r3NImQEc055821; Tue, 23 Apr 2013 21:48:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 23 Apr 2013 21:48:26 +0300 From: Konstantin Belousov To: Vijay Singh Subject: Re: vmspace_fork() Message-ID: <20130423184826.GD67273@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xOS8do0ZRfB5pORP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 18:48:31 -0000 --xOS8do0ZRfB5pORP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 23, 2013 at 10:44:56AM -0700, Vijay Singh wrote: > Hackers, what does hitting the following assert in vmspace_fork() imply? >=20 > 3101 > new_map =3D &vm2 ->vm_map > ; > 3102 > locked =3D > vm_map_trylock (new_map); > */* trylock to silence WITNESS */* > 3103 > KASSERT (locked > , (*"vmspace_fork: lock > failed"*)); I have hard time reading this html. >=20 > I am hitting the assert in line 3103 and it seems like the assumption > is that the trylock will > always get the lock? Assuming you are referencing line 3103 of the sys/vm/vm_map.c, yes, the try lock operation must always succeed. The reason is that the new_map AKA vm2 is freshly allocated and its pointer is not yet published for other threads to see. So nothing could own the lock. The try is done to silence the witness warning about the same lock type, as indicated by the comment. --xOS8do0ZRfB5pORP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRdtd5AAoJEJDCuSvBvK1Bhv0QAIWOzg3zq54VQuEZMfifzdk5 c3T/5h4qrEDBG5djZXj9uCJLLnYxzeS5DCLaloNyKpK6j3dWqWRMeCRgvDnEcI3u zInQTzTOOpojw1+k8fbIgDkOrwusLjBCCwxSN0xIz0n0E0xb22LovQz18mpoccOS E7XvkxpEHTZkX4ed2IFkCYbSSHpG2UXPRPqQPYudcq/LwxJmPRu5LhFY1JKcbWCz 7GMdNfVmN3kz9wCdd8VTW+P+J8D2CEeUnUXWAqZX9dfuTEacI82G9SzpGGah/EP0 Z3+jTYf16iXXvQ6qda4o5FbFrmXxSWpH6nxvcI1XyqK1gqMkEbzgz6VhZ5g0ilJZ dyoV8BC8PrLDo8+s8i0+rYBnOhj05ADNkviDJZ7vNtpJSQifRH5tz31dtf6N0eF0 XXgjdImDNn0iFhloz4YxyGTrQR06M5nN/eSoYXExOHUK5Zm/Na29nuqZ0BFm66/m /t6JNY9tqTXSNvgK3SUilof+xn/PvL3O0C1vHqh+mEZv5sd7+utDicMA+pjEMaVV 74ACQBO7MQrkF5RREO8Fidfsqutfvzd/OV0F4FfA+N7D1OeSFsZkJmISqcZbd20J vTGrRBcNAjCevBsJjewAOZ8b43FGukcQIRZDcsva/+zhGoIMkO+0/uITu60CKLjr yRNs9oNDQBMb7Nwp/EJt =5COm -----END PGP SIGNATURE----- --xOS8do0ZRfB5pORP--