From owner-svn-src-head@freebsd.org Tue Aug 18 10:58:38 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 97A869BCA85; Tue, 18 Aug 2015 10:58:38 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 008AA15FC; Tue, 18 Aug 2015 10:58:38 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A06DD1FE023; Tue, 18 Aug 2015 12:58:34 +0200 (CEST) Subject: Re: svn commit: r286880 - head/sys/kern To: Julien Charbon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201508181015.t7IAFAex055889@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <55D3102F.6080206@selasky.org> Date: Tue, 18 Aug 2015 12:59:59 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201508181015.t7IAFAex055889@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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, 18 Aug 2015 10:58:38 -0000 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, and > 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 > ============================================================================== > --- head/sys/kern/kern_timeout.c Tue Aug 18 10:07:03 2015 (r286879) > +++ head/sys/kern/kern_timeout.c Tue Aug 18 10:15:09 2015 (r286880) > @@ -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 progress > + * and indeed impossible to stop then return 0. > + */ > + not_running = !(cc_exec_curr(cc, direct) == c); > + > CC_UNLOCK(cc); > - return (1); > + return (not_running); > } > > void > > Should this be MFC'ed to 10? --HPS