From owner-svn-src-head@freebsd.org Wed Aug 26 16:32:14 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 BC9E29C33D2 for ; Wed, 26 Aug 2015 16:32:14 +0000 (UTC) (envelope-from julien@jch.io) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) (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 60098A83 for ; Wed, 26 Aug 2015 16:32:14 +0000 (UTC) (envelope-from julien@jch.io) Received: by wicja10 with SMTP id ja10so49874052wic.1 for ; Wed, 26 Aug 2015 09:32:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=qIe0fgVsML0e8pBiOJn9CPWTAgqET9nNdC/I0JAWfO0=; b=fQGNpOKUys73fHyGeUNctnLScpU0FaGeYtTUDfHB4nOe2fO9oD03JhKSwL3aEMRXji FM7WYb0Lg0PFCPPennDJ6W00BqaF8zne2y7py+3MfW/b94hDI2g5XNkDN+6XhKecIVeJ jRhOkpveDQy/Pdn1sKC1WfWb71P9y+zy8vsj1kl97FaYAY2OofCWIN94k5nGPVYRgsdv 74ZEtmXRHm9/CmOTnuDi7EuaJ3PLgr8yqZ0+WH3lNzx5wDekG2Gux8xu+cjYvtNQMkEB oddOnZz9dCv60Epxneh0oBkQ+mXadGKndyyMzrICdPS6c84r9gsZupsrqY8mTjF2QQpm 5Fpw== X-Gm-Message-State: ALoCoQnHBnzT7R6aFWTWr7LYsJxNJRl3GRleo/FHdtCP2DaJdYHmxzBHuxL5j/P57qxpY2sWsI2o X-Received: by 10.180.101.164 with SMTP id fh4mr5289472wib.25.1440606727256; Wed, 26 Aug 2015 09:32:07 -0700 (PDT) Received: from fri2pmaresca-l1.vcorp.ad.vrsn.com ([217.30.88.7]) by smtp.googlemail.com with ESMTPSA id y13sm4631923wjq.26.2015.08.26.09.32.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 09:32:06 -0700 (PDT) Subject: Re: svn commit: r286880 - head/sys/kern To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, John Baldwin References: <201508181015.t7IAFAex055889@repo.freebsd.org> <55DD69E5.4090904@selasky.org> From: Julien Charbon Message-ID: <55DDE9FF.3020705@freebsd.org> Date: Wed, 26 Aug 2015 18:31:59 +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: <55DD69E5.4090904@selasky.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sVp8OSs2S8XEkQVM2w1JquIHOlmb6Xjm1" 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: Wed, 26 Aug 2015 16:32:14 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sVp8OSs2S8XEkQVM2w1JquIHOlmb6Xjm1 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi Hans, On 26/08/15 09:25, Hans Petter Selasky wrote: > On 08/18/15 12:15, Julien Charbon wrote: >> Author: jch >> Date: Tue Aug 18 10:15:09 2015 >> New Revision: 286880 >> URL: https://svnweb.freebsd.org/changeset/base/286880 >> >> Log: >> callout_stop() should return 0 (fail) when the callout is currently= >> being serviced and indeed unstoppable. >> >> A scenario to reproduce this case is: >> >> - the callout is being serviced and at same time, >> - callout_reset() is called on this callout that sets >> the CALLOUT_PENDING flag and at same time, >> - callout_stop() is called on this callout and returns 1 (success) >> even if the callout is indeed currently running and unstoppable. >> >> This issue was caught up while making r284245 (D2763) workaround, a= nd >> was discussed at BSDCan 2015. Once applied the r284245 workaround >> is not needed anymore and will be reverted. >> >> Differential Revision: https://reviews.freebsd.org/D3078 >> Reviewed by: jhb >> Sponsored by: Verisign, Inc. >> >> Modified: >> head/sys/kern/kern_timeout.c >> >> Modified: head/sys/kern/kern_timeout.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> >> --- head/sys/kern/kern_timeout.c Tue Aug 18 10:07:03 2015 (r2868= 79) >> +++ head/sys/kern/kern_timeout.c Tue Aug 18 10:15:09 2015 (r2868= 80) >> @@ -1150,7 +1150,7 @@ _callout_stop_safe(struct callout *c, in >> struct callout_cpu *cc, *old_cc; >> struct lock_class *class; >> int direct, sq_locked, use_lock; >> - int not_on_a_list; >> + int not_on_a_list, not_running; >> >> if (safe) >> WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock, >> @@ -1378,8 +1378,15 @@ again: >> } >> } >> callout_cc_del(c, cc); >> + >> + /* >> + * If we are asked to stop a callout which is currently in progre= ss >> + * and indeed impossible to stop then return 0. >> + */ >> + not_running =3D !(cc_exec_curr(cc, direct) =3D=3D c); >> + >> CC_UNLOCK(cc); >> - return (1); >> + return (not_running); >> } >> >> void >=20 > I think this patch is incomplete and can break the return value for > non-MPSAFE callouts. I think the correct statement should check the > value of "use_lock" too: >=20 > not_running =3D !(cc_exec_curr(cc, direct) =3D=3D c && use_lock =3D= =3D 0); >=20 > Because if the callback process waits for lock "c_lock" in the callback= > process then we have above "cc_exec_curr(cc, direct) =3D=3D c" is satis= fied > too, and non-MPSAFE callouts are always cancelable, via > cc_exec_cancel(cc, direct) =3D true; Hum, interesting let me double check that. -- Julien --sVp8OSs2S8XEkQVM2w1JquIHOlmb6Xjm1 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 iQEcBAEBCgAGBQJV3eoEAAoJEKVlQ5Je6dhxrnkH/3U43xxFECX8nd6l8PHlUhAF DwBvlKviCZ7fxnmUEEN8o1U/TC52E2hQYPVlONTmGkbEkOI7bppXOPeT8tcIJ38F u1uqwx1ArnG8T8Vne5puvB28Ij1SwyIarhkR4XUEAmYdp7IUrE5dIOhVeuVOTzSZ P3xoxrjMKfxaNtY+c7bDPuGbhzGFZiGK+ljsSltjxVKgPyXiKERyz3t51AYWJkMX npfn6iNLHkr3SePj03MzIL8e7aXtzCEiJSzENQDEdl+QlhuqYBv6TO1FGfMr/gP/ pAL2qoHpn84zuKsp9D+D4g7giW44Gd19RLx+DQxFLNSy3q9JMv1wr5cnc8Dq8ls= =cd2B -----END PGP SIGNATURE----- --sVp8OSs2S8XEkQVM2w1JquIHOlmb6Xjm1--