Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2013 21:48:26 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Vijay Singh <vijju.singh@gmail.com>
Cc:        hackers@freebsd.org
Subject:   Re: vmspace_fork()
Message-ID:  <20130423184826.GD67273@kib.kiev.ua>
In-Reply-To: <CALCNsJQAA%2B9k6jq1bQJyavOLmd7Xc6BqgoLBUJfAQqecuOeENw@mail.gmail.com>
References:  <CALCNsJQAA%2B9k6jq1bQJyavOLmd7Xc6BqgoLBUJfAQqecuOeENw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <http://fxr.watson.org/fxr/source/vm/vm_map.c#L3101>;
> new_map =3D &vm2 <http://fxr.watson.org/fxr/ident?im=3D3;i=3Dvm2>->vm_map
> <http://fxr.watson.org/fxr/ident?im=3D3;i=3Dvm_map>;
>  3102 <http://fxr.watson.org/fxr/source/vm/vm_map.c#L3102>;
> locked <http://fxr.watson.org/fxr/ident?im=3D3;i=3Dlocked>; =3D
> vm_map_trylock <http://fxr.watson.org/fxr/ident?im=3D3;i=3Dvm_map_trylock=
>(new_map);
> */* trylock to silence WITNESS */*
>  3103 <http://fxr.watson.org/fxr/source/vm/vm_map.c#L3103>;
> KASSERT <http://fxr.watson.org/fxr/ident?im=3D3;i=3DKASSERT>(locked
> <http://fxr.watson.org/fxr/ident?im=3D3;i=3Dlocked>, (*"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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130423184826.GD67273>