From owner-svn-src-all@freebsd.org Fri Aug 17 16:08:29 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 C779E1073EB7; Fri, 17 Aug 2018 16:08:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4257485E8D; Fri, 17 Aug 2018 16:08:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pl0-x243.google.com with SMTP id a4-v6so423406plm.13; Fri, 17 Aug 2018 09:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dNw0F6CpOOO0XNG34khiFP1LvuXu2vk+jeahS8J4MFI=; b=IabKL996A/3kAF31EnBuKXO1neaDQnRH5a/d4/cQJDzyd09+KekmWHmRxj5QDhn7Dm AquSngpBmFylJ71SjOXVsu0b8GXQRs5dIFMvIkyz9kveIol4dv2zXbmgnJCFS+xAF3Kw e2LGjuWBHyAOwghViHPDiSwk5XlgTDg/+PinCzkw3uJ0a4ZqPjQcA1mYWsQcAXkbdiNy VL99tYARUbLc+Ut/+g5WPLvC/6z3haB9d7OTBL1/Q7M8P8yKfum7akRQWYJ8NPaevM05 wUqu6yYql2tGDIVMfDPazuqrLw63GqeUQr8YfNzK4zRoRJtPHmyYgdXSxsNJG0o8nm+H 1gDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=dNw0F6CpOOO0XNG34khiFP1LvuXu2vk+jeahS8J4MFI=; b=b8ZrygiIM2sceF8l9qWZighJolvkg++z/mnFmzqk1/T6UWIFxuZ2sdmCvF2erp1fZT OQGqdTkHevku1XwYI85LnbUGaby0TA1gYXJgkbUxe5ahGwPac6ZeSbGQWq94mezi46ef eu+HM7ue8179XhPN9iGGcou7tXlsJjtaJ/8RfR4D70GZ+qrvMKFb9cw4tXI12fRxFLBX t3AN5sfO/eq8ywh6FwXV5MGA+oFQxlIXrSdxn9iPuIShnK3kDVdnbqqn5z4omm8C51Pf DTMpFN92GBLPZBPQEW0rA2YAYfKVap1CW3VevbyIdFx1zhwAYVsRr/ZQpEHboMGO4jC1 VMhQ== X-Gm-Message-State: AOUpUlGmgOkjPvBJvbCIuX1nwO+a9SR6ePmoAw9Mh90Wj5wn9fVIIdKI dB2CT/JkSpmE+mJqD1JY8br3f4SY X-Google-Smtp-Source: AA+uWPzwxk18GiDfmZOAwdBfoOpnGPd95JZDOWsX5OTn/tvlSoR40cx20o/hJUf0c3pV0W0Mg663eQ== X-Received: by 2002:a17:902:6b05:: with SMTP id o5-v6mr34022704plk.338.1534522107017; Fri, 17 Aug 2018 09:08:27 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-239.dsl.bell.ca. [70.52.224.239]) by smtp.gmail.com with ESMTPSA id 1-v6sm5577243pfk.134.2018.08.17.09.08.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Aug 2018 09:08:26 -0700 (PDT) Sender: Mark Johnston Date: Fri, 17 Aug 2018 12:08:20 -0400 From: Mark Johnston To: Bryan Drewery Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334708 - head/sys/kern Message-ID: <20180817160820.GA13168@raichu> 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> <0b128417-7107-5090-e65a-afa94fd1aed6@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b128417-7107-5090-e65a-afa94fd1aed6@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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: Fri, 17 Aug 2018 16:08:29 -0000 On Thu, Jul 19, 2018 at 12:09:21PM -0700, Bryan Drewery wrote: > Did this issue get resolved? It's fixed by r337974. > 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 wrote: > >>>>> Checking it without any locks is perfectly valid in this case. It is 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 number of > >>>>> other threads could have bumped and dropped the ref past that point. > >>>>> 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 the > >>>>> 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 between > >>>> 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 for > >>>> 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 that 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, the > >>> code which fetched the vnode pointer before _vhold() call, should guarantee > >>> visibility. > >> > >> Wouldn't this be a problem only if we permit lockless accesses of vnode > >> state outside of _vhold() and other vnode subroutines? The current > >> protocol requires that the interlock be held, and this synchronizes with > >> code which performs 0->1 and 1->0 transitions of the hold count. If this > >> requirement is relaxed in the future, then fences would indeed be > >> needed. > > > > 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 ?). > > > > 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. > > > > > -- > Regards, > Bryan Drewery >