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]
Message-ID: <4DA2DA6A.6000202@st.com>
Date:	Mon, 11 Apr 2011 16:09:38 +0530
From:	viresh kumar <viresh.kumar@...com>
To:	Russell King - ARM Linux <linux@....linux.org.uk>
Cc:	"Koul, Vinod" <vinod.koul@...el.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Linus WALLEIJ <linus.walleij@...ricsson.com>,
	amitgoel <amit.goel@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Armando VISCONTI <armando.visconti@...com>,
	Shiraz HASHIM <shiraz.hashim@...com>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: dmaengine: Can we schedule new transfer from dma callback	routine??

On 04/11/2011 02:26 PM, Russell King - ARM Linux wrote:
> On Mon, Apr 11, 2011 at 01:25:04PM +0530, viresh kumar wrote:
>>
>> Hello,
>>
>> In dw_dmac.c driver, dwc_descriptor_complete() routine, following is
>> mentioned before calling callback:
>>
>> 	/*
>> 	 * The API requires that no submissions are done from a
>> 	 * callback, so we don't need to drop the lock here
>> 	 */
>> 	if (callback)
>> 		callback(param);
>>
>> Does this hold true for dmaengine??
> 
> Not for slave devices - see Dan's reply:
> 
> http://lists.arm.linux.org.uk/lurker/message/20101223.005313.a38d7bf0.en.html
> 
> As the slave API hasn't been well documented, there's a lot of
> inconsistency of behaviour between DMA engine slave implementations.
> I'd suggest at least fixing slave DMA engine drivers to ensure that:
> 
> (a) the callback is always called in tasklet context
> (b) the callback can submit new slave transactions (iow, the spinlock
>     which prep_slave_sg takes must not be held during the callback.)
> 
> The way that others solve this is to move the completed txd structures
> to a local 'completed' list, and then walk this list after the spinlocks
> have been dropped.
> 
> IOW, something like this:
> 
> my_tasklet()
> {
> 	INIT_LIST_HEAD(completed);
> 
> 	spin_lock_irqsave(my_chan->lock);
> 	for_each_txd(my_txd, my_chan) {
> 		if (has_completed(my_txd))
> 			list_add_tail(my_txd->node, &completed);
> 	}
> 	spin_unlock_irqrestore(my_chan->lock);
> 
> 	list_for_each_entry_safe(my_txd, next, &completed, node) {
> 		void *callback_param = my_txd->txd.callback_param;
> 		void (*fn)(void *) = my_txd->txd.callback;
> 
> 		my_txd_free(my_chan, my_txd);
> 
> 		fn(callback_param);
> 	}	
> }

Got it. Thanx.

-- 
viresh
--
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