Date: Thu, 13 Nov 2014 09:31:39 -0800 From: Adrian Chadd <adrian@freebsd.org> To: Alfred Perlstein <alfred@freebsd.org> Cc: Hans Petter Selasky <hps@selasky.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org> Subject: Re: Questions about locking; turnstiles and sleeping threads Message-ID: <CAJ-VmokOSLtZWDwVRVw581d9=GMQrrTESrxt2GwprGE-mQNKmw@mail.gmail.com> In-Reply-To: <54648483.5060107@freebsd.org> References: <CAJ-VmomrauhCMoF_dZfMWWhZp0EgwfE9RmxL5Pc37PhLSzZ6Qg@mail.gmail.com> <20141112212613.21037929@kan> <CAJ-Vmok-8znyycyOBS_ZQU275zFy%2BzuZ2C-jt4N3DnuEVS=PWg@mail.gmail.com> <CAJ-Vmo=R4ayAn-d986TC3CzZ4y23jnDW=uTyo4O=x4Ae1wB60A@mail.gmail.com> <CAJ-Vmok40-W%2B%2BdUJPcfO74%2BuudCgbs3tR5nwrR-aNuCy=5o0HQ@mail.gmail.com> <546472DA.3080006@freebsd.org> <CAJ-VmomQdNDWqdC7o-nuGfypDDgDsJX9ouhx%2Br7ckZptgzQ10Q@mail.gmail.com> <5464764E.9080308@freebsd.org> <CAJ-VmonbrB3s5SsABo1Kotfz1Dn3cpvbnRMu4J9ikPmyS_aTgQ@mail.gmail.com> <54647D1E.9010904@freebsd.org> <CAJ-VmonbEfxz9Bgw9O9f-5%2Bb=UM1b1nzPK9zfAAnmYKVumOKkQ@mail.gmail.com> <54648483.5060107@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 13 November 2014 02:14, Alfred Perlstein <alfred@freebsd.org> wrote: > Would need more context to help on this. > > I can't tell based on your description which thread is holding which lock. > > If A is waiting for callout C to stop AND there exists a thread B that is > contending against C for a lock, you should be fine so long as there is no > lock cycle against A. > > Would be best if you pointed at some code and gave descriptions. I haven't dug into the USB side of things ,but on the atheros side I gave the description above. Thread A grabs lock X and tries to drain callout, which involves grabbing lock Y to do the dirty work. Lock Y isn't held at this point - the callout is about to run or is running, so it enters the sleepq call to finish the drain. Thread B wants to grab lock X, but can't because thread A holds lock X and is in a sleepq due to callout_drain(). Hence panic. I'll poke people on IRC today and see if I can get a better description of what/where the WITNESS_WARN() should be placed in callout_drain(). Then we'll see what's left triggering it. -adrian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokOSLtZWDwVRVw581d9=GMQrrTESrxt2GwprGE-mQNKmw>