From owner-svn-src-head@freebsd.org Tue Sep 22 16:43:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 244A0A0725A; Tue, 22 Sep 2015 16:43:41 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8AB351634; Tue, 22 Sep 2015 16:43:37 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: by wicgb1 with SMTP id gb1so168600243wic.1; Tue, 22 Sep 2015 09:43:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=qnArk2F8tjnwvAmyYzvZ16TAXqUJcDVKIn7svCLZ+h8=; b=CmxjroqQ/3XUWWYZkaHNDeKrX2rOmZNtVOoRgw+9m/gUDUUWQYCBZ3aC2xeJwzO5aZ zs/McI1YProlRM6k14WN2CKdFBoM28+bH6yO/SwrFIM30NnlfTAcKKFtjL1mQfw5qrsz IQmR6ZDFeKgs/HnCJ2C9gop3VQumSmHrB6ymgkRFHkW5kMd/YX3ET56UrlVhNiuwGqyc sWPnrNvdoDyLoFyvjnLLZyHgDq58hrXwLeIyOjX39HIqX7gwpMwRcsLEDVAovju1CFVk eJAcEA5xMBsW+6sfgTPzYbkKDCUGvQ9UG0hYscucmfdfirPDPseKBKw6FAz/W0jqVO5o oRiA== X-Received: by 10.194.122.66 with SMTP id lq2mr30178393wjb.156.1442940214722; Tue, 22 Sep 2015 09:43:34 -0700 (PDT) Received: from lon1sbrother-s1.vcorp.ad.vrsn.com ([217.30.88.7]) by smtp.googlemail.com with ESMTPSA id s9sm2755262wjy.16.2015.09.22.09.43.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Sep 2015 09:43:34 -0700 (PDT) Subject: Re: svn commit: r287780 - in head: share/man/man9 sys/kern sys/sys To: Hans Petter Selasky , Davide Italiano , George Neville-Neil References: <201509141052.t8EAqRWf008293@repo.freebsd.org> <20150916220559.GS1023@FreeBSD.org> <55FA69BD.10507@selasky.org> <55FD22E9.2040508@selasky.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , rss@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , Warner Losh , Randall Stewart From: Julien Charbon X-Enigmail-Draft-Status: N1210 Message-ID: <56018525.8050601@freebsd.org> Date: Tue, 22 Sep 2015 18:43:17 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55FD22E9.2040508@selasky.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sOHNcRUpvmhivD5NJfEUv3QNSDx20px3r" X-Mailman-Approved-At: Tue, 22 Sep 2015 17:11:25 +0000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2015 16:43:41 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sOHNcRUpvmhivD5NJfEUv3QNSDx20px3r Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi guys, On 19/09/15 10:55, Hans Petter Selasky wrote: > On 09/18/15 22:33, Davide Italiano wrote: >> On Thu, Sep 17, 2015 at 12:20 AM, Hans Petter Selasky=20 >> wrote: >>> On 09/17/15 00:05, Gleb Smirnoff wrote: >> [...] 2) Your commit message didn't explain what (if any) is the >> use case > for this. >=20 > It currently has one critical client, and that is destruction of > TCP connections. >=20 > The last 6 months there has been terribly much discussion, bugs > and panics in the callout area, and there seems no end with recent > panics posted to -current. Even the updates which rss & more did > slipped in new bugs. >=20 > I'm going to let Julien finish his work first. If he doesn't need > the KPI it will be removed. Else I want that it stays in. [...] It is too much pressure on my shoulders, I am a callout rookie after all. :) Let me continue this discussion at a technical level: o Short answers: - Is callout_drain_async() currently required for TCP timers callout: N= o - Are we using the same logic than callout_drain_async() in current TCP timers code: Yes - Would callout_drain_async() make TCP timer code cleaner: Yes - Is callout(9) with an associated mutex hard to use: No - Is callout(9) without an associated mutex (mpsafe callout) hard to use: Yes o My callout (rookie) solutions: - Short-term: At least, improve man callout(9) page for mpsafe callout usage. I am working on it. - Mid-term: Improve current mpsafe callout KPI. hps is working on it. - Long-term I: Deprecate mpsafe callout usage. On TCP stack side it would require to remove INP_INFO lock, this is achievable as soon as we have RCU-ish locks in kernel. gnn is working on getting RCU-ish lock. (@gnn you might feel a gentle backpressure here :) - Long-term II: Come with a new callout-ish KPI only for that brings more guarantee in mpsafe callout cases and use it (Lot of work!). o Long answers: - Is callout_drain_async() KPI required for TCP timers: No - Are we using the same logic than callout_drain_async() in current TCP timers code: Yes All TCP timers race conditions (so far) have been fixed in two commits: https://svnweb.freebsd.org/base?view=3Drevision&revision=3D281599 https://svnweb.freebsd.org/base?view=3Drevision&revision=3D284245 This logic is used currently in release/10.2.0, stable/10 and HEAD with no issues (so far). And it is the same logic than callout_drain_async(). - Would it make the TCP time code cleaner: Yes Below code with mpsafe callout is wrong: if (callout_stop(c)) { /* Free resources used in callout callback */ free_res(); <- Kernel panic here } else { /* Defer free resources used in callout callback */ defer_free_res(); } Below code with mpsafe callout is right, but tricky as in general callout_reset() and callout_stop() calls are far away (current TCP timers code login): r =3D callout_reset(c); ... s =3D callout_stop(c); if (r && s) { /* Free resources used in callout callback */ free_res(); } else { /* Defer free resources used in callout callback */ defer_free_res(); } Below code with mpsafe callout is right, and less tricky: if (callout_stop_async(c, defer_free_res)) { /* Free resources used in callout callback */ free_res(); } Sorry for this too long answer. -- Julien --sOHNcRUpvmhivD5NJfEUv3QNSDx20px3r Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJWAYUvAAoJEKVlQ5Je6dhxxZQIAJ3txCnzUdOBT0mjT0E9X8ft 9cSTXkNbPjmFUySl66mi6FFo98KzSpmCxJ3kp4e70dXmn1uyeyfH52VrpttHzU9z DUeqhj3EiHuWJiOH05uwMZhS/v37CZFdlILFZViOh8gfX/U6xEUhgfpGkruPfnMi pYXiiCe0Oha0QdpfiYPm9JclWeF5sPWrTxMs3zvUWJ3HHjQ46vk9/oInlemVCWmk MggvmO0KZdZJGqGwAhYuVuyJSmWl8m5EFyAuuyP5eJFyh3GVKm+INl934pbITE/5 fcaaShDAO3XGrrocl5IhGlLq7v8t9JmMtVyUzlp2DmdnrulW8GgxSY/uXKD8Pr4= =7fRS -----END PGP SIGNATURE----- --sOHNcRUpvmhivD5NJfEUv3QNSDx20px3r--