Date: Thu, 13 Nov 2014 09:56:06 -0800 From: Garrett Cooper <yaneurabeya@gmail.com> To: Adrian Chadd <adrian@freebsd.org> Cc: Hans Petter Selasky <hps@selasky.org>, Alfred Perlstein <alfred@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org> Subject: Re: Questions about locking; turnstiles and sleeping threads Message-ID: <ECB3576A-CD92-4F19-9EA3-CFF430165D0B@gmail.com> In-Reply-To: <CAJ-Vmo=ZW0i0upfPkf2fx8GgnKn943dZr96_PsGnw5NgcbC7NQ@mail.gmail.com> References: <CAJ-VmomrauhCMoF_dZfMWWhZp0EgwfE9RmxL5Pc37PhLSzZ6Qg@mail.gmail.com> <54647D1E.9010904@freebsd.org> <CAJ-VmonbEfxz9Bgw9O9f-5%2Bb=UM1b1nzPK9zfAAnmYKVumOKkQ@mail.gmail.com> <201411130948.23785.jhb@freebsd.org> <CAJ-Vmo=ZW0i0upfPkf2fx8GgnKn943dZr96_PsGnw5NgcbC7NQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Nov 13, 2014, at 09:32, Adrian Chadd <adrian@freebsd.org> wrote: >=20 >> On 13 November 2014 06:48, John Baldwin <jhb@freebsd.org> wrote: >>> On Thursday, November 13, 2014 4:52:50 am Adrian Chadd wrote: >>> Hm, the more I dig into this, the more I realise it's not a 1:45am >>> question to ask. >>>=20 >>> Specifically, callout_stop_safe() takes 'safe', which says "are we >>> waiting around for this callout to finish if it started". Ie, >>> callout_drain() is callout_stop_safe(c, 1) ; callout_stop() is >>> callout_stop_safe(c, 0). >>>=20 >>> If safe is 1, then it'll potentially put the current thread to sleep >>> in order to wait for it to synchronise with the callout that's >>> running. It's sleeping with cc_lock which is the per-callwheel lock >>> and it's doing that with whatever other locks are held. That's the >>> situation which is tripping things up. >>>=20 >>> The manpage says that no locks should be held that the callout may >>> block on, which isn't the case here at all - I'm trying to grab a lock >>> in another thread that the caller _into_ the callout subsystem holds. >>> The manpage doesn't mention anything about this. Sniffle. >>=20 >> It should just say "no sleepable locks at all". And yes, callout_stop() i= s >> perfectly fine to call with locks held. It is only callout_drain() that >> should not be called, same as with bus_teardown_intr() and taskqueue_drai= n() >> (other routines that can sleep while ensuring that an asynchronous task r= un >> by another thread is stopped). >=20 > so, we should add WITNESS_WARN() to those as well? This might be related to the issue Steve Kargl brought up in the thread "shu= tdown or ACPI problem" on -current@.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ECB3576A-CD92-4F19-9EA3-CFF430165D0B>