From 68df82f0f758d70165e8ff4b40989910f42b545b Mon Sep 17 00:00:00 2001 From: Ankit Patel Date: Mon, 25 May 2020 13:17:39 +0530 Subject: [PATCH] video: tegra: host: free channel on job completion This issue mostly seen in T210 when resource policy for modules are set to RESOURCE_PER_DEVICE and test with kernel_submit regression, Then it generally leads to a crash in second or forthcoming iteration of kernel_submit. Observation: After completion of channel's job, module gets suspended without freeing the channel, And when module resume, it's start submiting job on the channel's syncpoint which is already freed by others. This scenario occurs in two cases with VIC module, 1 A user application(Ex: nvgpu) freed the syncpoint and VIC module is in suspend, Now when module will resume it will expect same syncpt active and belongs to it. 2 In between of 1st possibility If other module(Ex: nvenc) gets the syncpoint from free list when the first module(VIC) is suspended, Now when first module(VIC) resume and start submiting job on the same syncpoint which is already acquired by other module. Changes made : o Now, Channel will be freed on channel dma completion o Channel will be re-acquire on every submit o Syncpoint will not be freed when channel gets free. o Syncpoint will be acquire once by user space and will be freed when use space release the device o Now, Syncpoints gets mark used and unused using chid o Set resource policy to RESOURCE_PER_DEVICE for msenc, nvdec, nvjpg and vic Bug 200582662 Change-Id: Ief7658974cbd958f883e7b83add5902f766826df Signed-off-by: Ankit Patel Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2352726 (cherry picked from commit 745c3c8d46c23353a81e5e6035af3ed3848b02eb) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2366098 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/video/tegra/host/nvdla/dla_queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/tegra/host/nvdla/dla_queue.c b/drivers/video/tegra/host/nvdla/dla_queue.c index 4b966a3e..6f302b47 100644 --- a/drivers/video/tegra/host/nvdla/dla_queue.c +++ b/drivers/video/tegra/host/nvdla/dla_queue.c @@ -1,7 +1,7 @@ /* * NVDLA queue management * - * Copyright (c) 2019, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2019-2020, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -338,7 +338,6 @@ struct nvdla_queue *nvdla_queue_alloc(struct nvdla_queue_pool *pool, if (err < 0) goto err_alloc_channel; - queue->channel->syncpts[0] = queue->syncpt_id; queue->vm_pdev = queue->channel->vm->pdev; } else { queue->vm_pdev = pdev;