Re: [PATCH 3/3] Documentation: dmaengine: Add DMA_CTRL_REUSE documentation

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

 



On Thu, Jul 23, 2015 at 09:47:22PM +0200, Robert Jarzmik wrote:
> Vinod Koul <vinod.koul@xxxxxxxxx> writes:
> 
> > +  * DMA_CTRL_REUSE
> > +    - If set, the descriptor can be reused after being completed. It should
> > +      not be freed by provider if this flag is set.
> > +    - The descriptor should be prepared for reuse by invoking
> > +      dmaengine_desc_set_reuse() which will set DMA_CTRL_REUSE.
> > +    - dmaengine_desc_set_reuse() will succeed only when channel support
> > +      reusable descriptor as exhibited by capablities
> > +    - As a consequence, if a device driver wants to skip the dma_map_sg() and
> > +      dma_unmap_sg() in between 2 transfers, because the DMA'd data wasn't used,
> > +      it can resubmit the transfer right after its completion.
> > +    - Descriptor can be freed in few ways
> > +	- Clearing DMA_CTRL_REUSE by invoking dmaengine_desc_clear_reuse()
> > +	  and submitting for last txn
> > +	- Explicitly invoking dmaengine_desc_free(), this can succeed only
> > +	  when DMA_CTRL_REUSE is already set
> 
> > +	- Terminating the channel
> Is this last condition mandatory, or can it be transformed into :
>  - Clearing DMA_CTRL_REUSE and terminating the channel
> 
> The reason I'm asking this is for this kind of scenario :
>  - 4 video buffers are prepared and submitted (ie. 4 txs)
>  - 1st video buffer completes
>  - 2nd video buffer starts, and an error occurs in this 2nd buffer
>    => the driver will terminate the DMA channel to stop the transmission
>  - the driver will wait for the next "start of frame" of the camera sensor
>  - and then it will start 3rd video buffer
>    => in this case, the 3rd video will be reused, even if the channel was
>    terminated
Nope during terminate flow you are expected to clean up channel. Which mean
cleaning up all pending descriptors and throwing error. You are required to
prepare again

Here when adding, I though of giving few choice
- allowing folks to say, okay I have last txn, let me remove reuse and
  submit. That should be hint to driver to free it up
  The expecttaion would be that client supporting reuse check this for every
  submit, if the desc is being reused or not
- allowing cleanup anytime when we dont know where last txn is, or when user
  cancelled
- Or freeing gracefuly on already submitted desc

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux