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 <anpatel@nvidia.com>
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 <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ankit Patel
2020-05-25 13:17:39 +05:30
committed by Laxman Dewangan
parent bb9c174767
commit 68df82f0f7

View File

@@ -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;