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:	Wed, 12 Jun 2013 14:07:10 +0200
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Vinod Koul <vinod.koul@...el.com>
CC:	linux-mips@...ux-mips.org, alsa-devel@...a-project.org,
	Liam Girdwood <lgirdwood@...il.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>,
	Maarten ter Huurne <maarten@...ewalker.org>
Subject: Re: [alsa-devel] [PATCH v2 3/6] dma: Add a jz4740 dmaengine driver

On 06/12/2013 07:38 AM, Vinod Koul wrote:
> On Mon, Jun 10, 2013 at 07:29:46PM +0200, Lars-Peter Clausen wrote:
>> On 05/30/2013 08:46 PM, Lars-Peter Clausen wrote:
>>>>> +static int jz4740_dma_alloc_chan_resources(struct dma_chan *c)
>>>>> +{
>>>>> +	struct jz4740_dmaengine_chan *chan = to_jz4740_dma_chan(c);
>>>>> +
>>>>> +	chan->jz_chan = jz4740_dma_request(chan, NULL);
>>>>> +	if (!chan->jz_chan)
>>>>> +		return -EBUSY;
>>>>> +
>>>>> +	jz4740_dma_set_complete_cb(chan->jz_chan, jz4740_dma_complete_cb);
>>>>> +
>>>>> +	return 0;
>>>> Sorry, I didnt reply on this one. The API expects you to allocate a pool of
>>>> descriptors. These descriptors are to be used in .device_prep_xxx calls later.
>>>
>>> The size of the descriptor is not fixed, so they can not be pre-allocated. And
>>> this is nothing new either, most of the more recently added dmaengine drivers
>>> allocate their descriptors on demand.
>>
>> Vinod, are you ok with this explanation?
> Sorry, I was travelling...
> 
> Can you explain more of a bit when you say size is not fixed.

This is the function that allocates the descriptor:

static struct jz4740_dma_desc *jz4740_dma_alloc_desc(unsigned int num_sgs)
{
	return kzalloc(sizeof(struct jz4740_dma_desc) +
		sizeof(struct jz4740_dma_sg) * num_sgs, GFP_ATOMIC);
}

So the size depends on the entries in the sg list.


> Why would it be
> issue if we allocate descriptors at the alloc_chan. The idea is that you 
> preallocated pool at alloc_chan and since the .device_prep_xxx calls can be
> called from atomic context as well, you dont need to do this later. You can use use
> these descriptors at that time. The idea is keep rotating the descriptors from
> free poll to used one

Yes, I know all that. And it makes sense to use a pool in certain
situations, e.g. if the hardware only supports a limited set of physical
descriptors. But in this case the descriptors are completely virtual.
Forcing the driver to use a pool would make it more complex, use more memory
and also a bit slower (although probably not noticeable).

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