Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Aug 2015 14:08:02 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        John-Mark Gurney <jmg@funkthat.com>, Ryan Stone <rysto32@gmail.com>
Subject:   Re: How should a driver shutdown a taskqueue on detach?
Message-ID:  <8275579.N9C6ZanMsb@ralph.baldwin.cx>
In-Reply-To: <20150701232510.GH96349@funkthat.com>
References:  <CAFMmRNxLV0Uk9iT%2BU8rrPvn6aanSfEA6p577McM=_4xypaZr5w@mail.gmail.com> <20150701232510.GH96349@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, July 01, 2015 04:25:10 PM John-Mark Gurney wrote:
> Ryan Stone wrote this message on Wed, Jul 01, 2015 at 15:44 -0400:
> > I'm trying to figure out how a driver is supposed to shut down its
> > interrupt-handling taskqueue when it detaches.  taskqueue(9) recommends
> > disabling interrupts, draining each task and then freeing the taskqueue.
> > The problem that I have is the interrupt-handling tasks will sometimes
> > re-enable interrupts on the device.  Is there a better way than using some
> > kind of flag internally in the driver to note that a detach is in progress
> > that the interrupt handlers will have to check before enabling interrupts?
> 
> Why not disabled interrupts, unregister interrupt handler, and then
> make sure interrupts are disabled (only needed to prevent an interrupt
> storm)?  Once you have unregistered the interrupt handler, it can't run
> again...  Then you're free to drain the task queue safely...

Yes.  Do the bus_teardown_intr() first, then drain any pending tasks.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8275579.N9C6ZanMsb>