* Grygorii Strashko <grygorii.strashko@xxxxxx> [191023 21:43]: > > > On 24/10/2019 00:27, Tony Lindgren wrote: > > * Grygorii Strashko <grygorii.strashko@xxxxxx> [191023 20:56]: > > > On 23/10/2019 23:18, Tony Lindgren wrote: > > > > And no, adding pm_runtime_get_sync() to issue_pending is not > > > > a solution. There may be clocks and regulators that need to > > > > be powered up, and we don't want to use pm_runtime_irq_safe() > > > > because of the permanent use count on the parent. > > > > > > 5 cents. > > > > > > I think the right thing might be to get rid of pm_runtime_xxx() > > > in cppi41_dma_issue_pending(). So overall approach will be: > > > > > > - new job -> cppi41_dma_prep_slave_sg() -> pm_runtime_get() > > > - issue_pending: fill backlog if suspended or run_queue if active (pm_runtime_active()) > > > - job done: dmaengine_desc_get_callback_invoke() -> > > > > > > dmaengine_desc_get_callback_invoke(); > > > pm_runtime_mark_last_busy(cdd->ddev.dev); > > > pm_runtime_put_autosuspend(cdd->ddev.dev); > > > in all places. > > > > > > It even might allow to get rid of cdd->lock. > > > > Well I don't think cppi41_dma_prep_slave_sg() is necessarily > > paired with anything currently. > > It should - dma cmpletion callbacks have to be called somewhere. Well what I meant is there's no guarantee that we have cppi41_dma_issue_pending() followed by cppi41_dma_prep_slave_sg() currently :) > This can potentially leading > > to pm_runtime_get() called multiple times? > > That's the idea - increase pm_counter as many times as jobs submitted. Right, but that needs to be done in a paired manner so the API is clear to everyone and does not lead into unpaired PM runtime calls. Regards, Tony