Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jul 2018 12:09:21 -0700
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>, Mark Johnston <markj@freebsd.org>, Ryan Libby <rlibby@freebsd.org>, Mateusz Guzik <mjguzik@gmail.com>, Justin Hibbits <jhibbits@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r334708 - head/sys/kern
Message-ID:  <0b128417-7107-5090-e65a-afa94fd1aed6@FreeBSD.org>
In-Reply-To: <20180608183732.GK2450@kib.kiev.ua>
References:  <201806061257.w56CvCwq089369@repo.freebsd.org> <20180606140311.GU2450@kib.kiev.ua> <20180608033242.GA54099@pesky> <CAHgpiFyOQf6B3oGFGMz3avXqrrP0i6Puy9HqLER1XG5xE67BeQ@mail.gmail.com> <CAGudoHENGpCxn_omxfaRLOAH5fP6qdFcmmqZ7He%2BpcC=-1HFKQ@mail.gmail.com> <CAHgpiFzMQjHfnQLQrWc86FSxB2veHZeAc44qmROkaJugpGoU=g@mail.gmail.com> <20180608173755.GJ2450@kib.kiev.ua> <20180608183010.GC65388@pesky> <20180608183732.GK2450@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Ihlwrz2hwW8P4i4TIUbx990WlXF6P2iuy
Content-Type: multipart/mixed; boundary="gSEzCqGhF3w2oEwSXkvyFr5cqiusmgFTR";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kostikbel@gmail.com>,
 Mark Johnston <markj@freebsd.org>, Ryan Libby <rlibby@freebsd.org>,
 Mateusz Guzik <mjguzik@gmail.com>, Justin Hibbits <jhibbits@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <0b128417-7107-5090-e65a-afa94fd1aed6@FreeBSD.org>
Subject: Re: svn commit: r334708 - head/sys/kern
References: <201806061257.w56CvCwq089369@repo.freebsd.org>
 <20180606140311.GU2450@kib.kiev.ua> <20180608033242.GA54099@pesky>
 <CAHgpiFyOQf6B3oGFGMz3avXqrrP0i6Puy9HqLER1XG5xE67BeQ@mail.gmail.com>
 <CAGudoHENGpCxn_omxfaRLOAH5fP6qdFcmmqZ7He+pcC=-1HFKQ@mail.gmail.com>
 <CAHgpiFzMQjHfnQLQrWc86FSxB2veHZeAc44qmROkaJugpGoU=g@mail.gmail.com>
 <20180608173755.GJ2450@kib.kiev.ua> <20180608183010.GC65388@pesky>
 <20180608183732.GK2450@kib.kiev.ua>
In-Reply-To: <20180608183732.GK2450@kib.kiev.ua>

--gSEzCqGhF3w2oEwSXkvyFr5cqiusmgFTR
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

Did this issue get resolved?

On 6/8/2018 11:37 AM, Konstantin Belousov wrote:
> On Fri, Jun 08, 2018 at 02:30:10PM -0400, Mark Johnston wrote:
>> On Fri, Jun 08, 2018 at 08:37:55PM +0300, Konstantin Belousov wrote:
>>> On Thu, Jun 07, 2018 at 11:02:29PM -0700, Ryan Libby wrote:
>>>> On Thu, Jun 7, 2018 at 10:03 PM, Mateusz Guzik <mjguzik@gmail.com> w=
rote:
>>>>> Checking it without any locks is perfectly valid in this case. It i=
s done
>>>>> after v_holdcnt gets bumped from a non-zero value. So at that time =
it
>>>>> is at least two. Of course that result is stale as an arbitrary num=
ber of
>>>>> other threads could have bumped and dropped the ref past that point=
=2E
>>>>> The minimum value is 1 since we hold the ref. But this means the
>>>>> vnode must not be on the free list and that's what the assertion is=

>>>>> verifying.
>>>>>
>>>>> The problem is indeed lack of ordering against the code clearing th=
e
>>>>> flag for the case where 2 threads to vhold and one does the 0->1
>>>>> transition.
>>>>>
>>>>> That said, the fence is required for the assertion to work.
>>>>>
>>>>
>>>> Yeah, I agree with this logic.  What I mean is that reordering betwe=
en
>>>> v_holdcnt 0->1 and v_iflag is normally settled by the release and
>>>> acquisition of the vnode interlock, which we are supposed to hold fo=
r
>>>> v_*i*flag.  A quick scan seems to show all of the checks of VI_FREE =
that
>>>> are not asserts do hold the vnode interlock.  So, I'm just saying th=
at I
>>>> don't think the possible reordering affects them.
>>> But do we know that only VI_FREE checks are affected ?
>>>
>>> My concern is that users of _vhold() rely on seeing up to date state =
of the
>>> vnode, and VI_FREE is only an example of the problem.  Most likely, t=
he
>>> code which fetched the vnode pointer before _vhold() call, should gua=
rantee
>>> visibility.
>>
>> Wouldn't this be a problem only if we permit lockless accesses of vnod=
e
>> state outside of _vhold() and other vnode subroutines? The current
>> protocol requires that the interlock be held, and this synchronizes wi=
th
>> code which performs 0->1 and 1->0 transitions of the hold count. If th=
is
>> requirement is relaxed in the future, then fences would indeed be
>> needed.
>=20
> I do not claim that my concern is a real problem. I stated it as a
> thing to look at when deciding whether the fences should be added
> (unconditionally ?).
>=20
> If you argument is that the only current lock-less protocol for the
> struct vnode state is the v_holdcnt transitions for > 1, then I can
> agree with it.
>=20


--=20
Regards,
Bryan Drewery


--gSEzCqGhF3w2oEwSXkvyFr5cqiusmgFTR--

--Ihlwrz2hwW8P4i4TIUbx990WlXF6P2iuy
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAltQ4eFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5
MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G
l8/FSwgAiaerDXHKcN3mkQPl+OjXxVlRPv0CDTsCivMjkB7bF4VXA9+SOHxK0vWt
WTF65/+ypXSc1yNe66/rTd3WChArt2wIXNHRWIUcuGgJVUmClAOeYxKEJcCsm7+8
Je7Lku9NjHPF+C+LUmqGQZp3UTIgtl98nSExG6NnYH7P33mnnXpe+7lNVgmPaHxR
4XhNeklecwwLNU3HrZ9xW40GHrsF42taRPHdnRFGGhC3R9cRVafKSRpmZH4BAiMh
p8eNaWf+T7PS7oUrLNtnEashbECUWHhYttKWT27SrYtfvEUGFzRPuoWh0Cp68CMB
gHoxu0eTF9DXPEm6+rXh5Ub7hQVtOA==
=Q/A4
-----END PGP SIGNATURE-----

--Ihlwrz2hwW8P4i4TIUbx990WlXF6P2iuy--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0b128417-7107-5090-e65a-afa94fd1aed6>