gpu: nvgpu: unset async subctx VM with correct index

On deleting the subcontext, tsg->subctx_vms[] entries are set to NULL as
per the subcontext id. For async subcontexts the index logic was used
from that of tsg->async_veids bitmask. However subctx_vms is an array
shared by all subcontexts hence index should be subcontext id aka veid.

Also update the description of function nvgpu_tsg_validate_ch_subctx_vm
as some of the functionality is now moved to another function
nvgpu_tsg_create_sync_subcontext_internal.

Bug 3979886

Change-Id: Ic290fb175b34988c6ffabe9c9dc4ec124d2c70af
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2879025
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2023-03-29 12:42:04 +05:30
committed by mobile promotions
parent 410d3603ff
commit 821699d3a3
2 changed files with 1 additions and 4 deletions

View File

@@ -338,7 +338,7 @@ void nvgpu_tsg_delete_subcontext(struct gk20a *g, struct nvgpu_tsg *tsg,
return; return;
} }
nvgpu_clear_bit(veid - MAX_SYNC_SUBCONTEXTS, tsg->async_veids); nvgpu_clear_bit(veid - MAX_SYNC_SUBCONTEXTS, tsg->async_veids);
tsg->subctx_vms[veid - MAX_SYNC_SUBCONTEXTS] = NULL; tsg->subctx_vms[veid] = NULL;
} }
nvgpu_mutex_release(&tsg->veid_alloc_lock); nvgpu_mutex_release(&tsg->veid_alloc_lock);

View File

@@ -403,9 +403,6 @@ int nvgpu_tsg_create_sync_subcontext_internal(struct gk20a *g,
* @param tsg [in] Pointer to TSG struct. * @param tsg [in] Pointer to TSG struct.
* @param ch [in] Pointer to Channel struct. * @param ch [in] Pointer to Channel struct.
* *
* - If this is first channel created without creating subcontext,
* then this channel is using subcontext with VEID 0 by default.
* Set subctx_vms and reserve the VEID0.
* - If channel VM does not match subcontext VM return -EINVAL. * - If channel VM does not match subcontext VM return -EINVAL.
* *
* @return 0 in case of success, < 0 in case of failure. * @return 0 in case of success, < 0 in case of failure.