lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 24 Jul 2015 11:12:26 +0530
From:	Vinod Koul <vinod.koul@...el.com>
To:	Julia Lawall <julia.lawall@...6.fr>
Cc:	Alex Smith <alex.smith@...tec.com>, Zubair.Kakakhel@...tec.com,
	dmaengine@...r.kernel.org,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: question about drivers/dma/dma-jz4780.c

On Thu, Jul 23, 2015 at 07:24:10PM +0200, Julia Lawall wrote:
> 
> 
> On Thu, 23 Jul 2015, Vinod Koul wrote:
> 
> > On Wed, Jul 22, 2015 at 03:26:01PM +0100, Alex Smith wrote:
> >
> > > >>>I think the explicit devm_free_irq() here is unnecessary, as when remove is
> > > >>>called there should be no remaining users of the DMA controller and therefore
> > > >>>no chance of an IRQ occurring between the controller being unregistered and an
> > > >>>implicit IRQ release afterwards.
> > > >Are you ensuring that device can no longer sent interrupts and all instances
> > > >of tasklet running or either completed are terminated and no further tasklet
> > > >can be spawned?
> > >
> > > Hi Vinod,
> > >
> > > If I understand correctly, when remove() is called, there should be
> > > no more users of the DMA controller, enforced by the module
> > > reference count.
> > >
> > > Wouldn't that guarantee that there are no more transactions running
> > > and therefore no chance of an interrupt from the controller or a
> > > tasklet still running?
> >
> > That will only guarantee no new requests are recieved, but you may have
> > tasklet already scheduled or irq sent from HW how do you prevent that?
> 
> More genrally, I have seen another driver with synchronize_irq in the
> remove function (dma/img-mdc-dma.c).  Would that be safe enough?  On the
> other hand, if one is going to go to the trouble of putting that, maybe
> one would do just as well to drop the devm for irqs and use free_irq in
> place of synchronize_irq instead?
synchronize_irq() will take care of irq but not tasklet right. Also irq can
be triggered again as you haven't disabled that yet.
Is it really worth the trouble going though hoops to ensure your device is
in right state, so might be simpler to free the irq and kill tasklet

Yes for dmaengine drivers I do ask this question which typically ends up in
driver invoking devm_irq_free() in driver's remove callback

IMHO don't think devm irq calls are very useful, they do make stuff complicated

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ