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: <Pine.LNX.4.64.0812041746400.5079@axis700.grange>
Date:	Thu, 4 Dec 2008 17:56:00 +0100 (CET)
From:	Guennadi Liakhovetski <g.liakhovetski@....de>
To:	Dan Williams <dan.j.williams@...el.com>
cc:	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	maciej.sosnowski@...el.com, hskinnemoen@...el.com,
	nicolas.ferre@...el.com
Subject: Re: [PATCH 03/13] dmaengine: up-level reference counting to the
 module level

On Fri, 14 Nov 2008, Dan Williams wrote:

> -/**
>   * dma_async_client_register - register a &dma_client
>   * @client: ptr to a client structure with valid 'event_callback' and 'cap_mask'
>   */
>  void dma_async_client_register(struct dma_client *client)
>  {
> +	struct dma_device *device, *_d;
> +	struct dma_chan *chan;
> +	int err;
> +
>  	/* validate client data */
>  	BUG_ON(dma_has_cap(DMA_SLAVE, client->cap_mask) &&
>  		!client->slave);
>  
>  	mutex_lock(&dma_list_mutex);
> +	dmaengine_ref_count++;
> +
> +	/* try to grab channels */
> +	list_for_each_entry_safe(device, _d, &dma_device_list, global_node)
> +		list_for_each_entry(chan, &device->channels, device_node) {
> +			err = dma_chan_get(chan);

Dan, could you please explain this: dma_chan_get() takes a reference on 
the channel _and_ calls .device_alloc_chan_resources() on first invocation 
for a specific channel. I now see three locations in dmaengine.c, where 
dma_chan_get() is called: in dma_request_channel() - logical, but also in 
dmaengine_get() and dma_async_device_register(), and these latter two I 
don't understand. I do not understand why we have to grab references and 
allocate resources for all (public) channels on all controllers in the 
system if someone just called dmaengine_get()?

> @@ -420,6 +443,19 @@ int dma_async_device_register(struct dma_device *device)
>  	}
>  
>  	mutex_lock(&dma_list_mutex);
> +	list_for_each_entry(chan, &device->channels, device_node) {
> +		/* if clients are already waiting for channels we need to
> +		 * take references on their behalf
> +		 */
> +		if (dmaengine_ref_count && dma_chan_get(chan) == -ENODEV) {
> +			/* note we can only get here for the first
> +			 * channel as the remaining channels are
> +			 * guaranteed to get a reference
> +			 */

This is the second location - where and how are clients waiting for 
channels? In the old implementation clients had notification callbacks, 
which were called as new channels became available. Now clients are gone, 
so, what is meant here?

Confused
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ