DMA Engine - dealing with timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all,

As a newbie, I'm trying to figure out how to properly deal with timeouts for dma_engine_submit(). I'm using a """prototype""" kernel module that sits on-tops of the Xilinx AXIDMA driver as part of Xilinx's Linux fork. They do a good job of merging with upstream kernels but there are some Xilinx-specific things and I apologize if some information is hard to parse. I believe my question is generic to the DMA Engine framework. This module, called "dma-proxy" is discussed a lot by Xilinx forums members but information doesn't typically flow back to users where there are fixes. Aside from the "dma-proxy" driver, Xilinx also includes a "AXIDMA Test" driver. Both drivers sit atop of the Xilinx DMA driver and do various things. The "dma-proxy" does some sharing of memory between userspace and the kernel but that's not really important to my question.


First, this chain eventually resolves into `dma_engine_submit()`:
-----------------------------------------------------------------

(~ https://github.com/Xilinx-Wiki-Projects/software-prototypes/blob/master/linux-user-space-dma/Software/Kernel/dma-proxy.c#L198)

sg_init_table(..., 1);
sg_dma_address(... ) = foo.dma_handle;
sg_dma_len(...t) = foo.length;
chan_desc = dma_device->device_prep_slave_sg(..., ..., 1, ..., ..., NULL);

if (! chan_desc) {
     printk(KERN_ERR "dmaengine_prep*() error\n");
else { ... }


Then, the driver waits for the completion and prints an error if it cannot complete:
-------------------------------------------------------------------------------------------------------------------

unsigned long timeout = msecs_to_jiffies(3000);
timeout = wait_for_completion_timeout(foo.cmp, timeout);
status = dma_async_is_tx_complete(..., ..., NULL, NULL);

if (timeout == 0)  {
     printk(KERN_ERR "DMA timed out\n");
}
else { ... }

======

I cannot figure out what to do in the case of a timeout. It appears descriptors (chan_desc) are being leaked when completion cannot be completed. I see some patches to make the list of descriptors larger but it appears the default/configured is 255. So if I sit and timeout for 3sec * 255, I run out of descriptors and that DMA engine instance is no longer usable.

It appears that even Xilinx's AXIDMA Test driver doesn't handle any sort of resource release or cleanup either:
https://github.com/Xilinx/linux-xlnx/blob/master/drivers/dma/xilinx/axidmatest.c#L432

I hope someone can point me in the right direction so I can timeout nicely.

Thanks!

--
Anthony G. Clark

Gtalk :: clark.anthony.g 
Phone :: 951 526 5237 

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux