From owner-svn-src-all@freebsd.org Thu Jul 19 19:09:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0DB01046152; Thu, 19 Jul 2018 19:09:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D268757C4; Thu, 19 Jul 2018 19:09:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 0AE9A94F; Thu, 19 Jul 2018 19:09:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id BF62D717D; Thu, 19 Jul 2018 19:09:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 2rNJERhm52KL; Thu, 19 Jul 2018 19:09:28 +0000 (UTC) Subject: Re: svn commit: r334708 - head/sys/kern DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com EAD3B7178 To: Konstantin Belousov , Mark Johnston , Ryan Libby , Mateusz Guzik , Justin Hibbits Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806061257.w56CvCwq089369@repo.freebsd.org> <20180606140311.GU2450@kib.kiev.ua> <20180608033242.GA54099@pesky> <20180608173755.GJ2450@kib.kiev.ua> <20180608183010.GC65388@pesky> <20180608183732.GK2450@kib.kiev.ua> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata= xsBNBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+ rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB AAHNJEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPsLAgAQTAQoAKgIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZAQUCWujOIgUJCmB7NwAKCRA113G7bkaXz/xpB/9b /UWIPbieY1IeIuHF2pyYPE7Hytkh3HVsxMA0F5Ma2AYQsXZZeKNKWrF7RPyDyDwUklLHJkhm k3EfClBbHxf08kMIm1vWCJRtgxic9knY/bzYGiWMpHjg3cSd1XfrYH1autYqTZAjDwIkgOjU dR//Tbn4V36sY7y2jz+kdMVWvK53U32aZqiwBbCn4DPe1wSZcUs17mV/0uZdIoGdj74B1orN A/0py5vHYo6HcbBNoaR8pKRLf5VZNRsxqGIMhTucx4SJWcHpuRBWYyvJSFzwvxdK4ZD4Yqoc kFGPVtOXktVMai9exrLvP3G77fKMu8DI6j4QRU4wCesnHuIfRPFuzsBNBFJphmsBCACiVFPf kNfaFtUSuY0395ueo/rMyHPGPQ2iwvERFCpeFGSQSgagpenNHLpFQKTg/dl6FOoST5tqyxMq fyHGHDzzU51bvA/IfaGoNi/BIhTe/toZNMRvpcI3PLjiGcnJnuwCCbAVOAGdb+t5cZtpNdOI cKYmrYG3u9RiBpe6dTF+qLrD/8Bs1wjhduQ8fcNNgnkXu8xDH4ZxY0lIc3QgvYWp9vimlQe6 iKjUd2/DX28ETZcD5h6pYV331KMPTrEI0p0yvFijUZce8c1XHFyL1j9sBAha5qpszJl6Uq5i LolhKRcGfcdmtD72vHQjUYglUyudSJUVyo2gMYjdbiFKzJulABEBAAHCwGUEGAEKAA8CGwwF AlrozigFCQpgez0ACgkQNddxu25Gl8+m5Af/R3VEdxNMAcDIes9ADhQyofj20SPV3eCJ3HYR OebTSuNdOudGt4AAyA8Ks94u9hiIp5IGsc6RDsT9W7O2vgXhd6eV3eiY5Oif5xLIYrIDVu1Y 1GyRxRrPEn/QOqDN6uFZCPwK1aOapGcYCrO9lB0gMuTVfgHanU61rgC9tMX0OoAOyRd+V3/M 8lDNhjJdF/IpO3SdYzKfkwduy4qamw4Gphcx/RfYQvYLq/eDkP8d50PphWdboqWBwNRHayro W/07OGzfxM5fJ5mBsXPQcO2QcRjkyHf6xCM6Hi1qQL4OnXMNE/ZTX0lnOj1/pH93TlzSHZMP TaiiA/MBD3vGsXBmBg== Organization: FreeBSD Message-ID: <0b128417-7107-5090-e65a-afa94fd1aed6@FreeBSD.org> Date: Thu, 19 Jul 2018 12:09:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180608183732.GK2450@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Ihlwrz2hwW8P4i4TIUbx990WlXF6P2iuy" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2018 19:09:32 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ihlwrz2hwW8P4i4TIUbx990WlXF6P2iuy Content-Type: multipart/mixed; boundary="gSEzCqGhF3w2oEwSXkvyFr5cqiusmgFTR"; protected-headers="v1" From: Bryan Drewery To: Konstantin Belousov , Mark Johnston , Ryan Libby , Mateusz Guzik , Justin Hibbits Cc: src-committers , 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> <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 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--