mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
If user calls IOCTL to allocate object context for two channels in same TSG in parallel, nvgpu_gr_setup_alloc_obj_ctx() could end up racing and trying to allocate object context for both channels at the same time. This could result in corrupting object context. Fix this by introducing per-TSG mutex ctx_init_lock to serialize context initialization for all channels within TSG. In ideal scenario nvrm_gpu is the only caller of all the IOCTLs, and nvrm_gpu makes sure to initialize object context for each channel in serial order. Because of this new lock does not cause any contention. Jira NVGPU-6431 Change-Id: Ibb1cbb4878748929bb7f23e8666c283c39ecbf5a Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2538333 (cherry picked from commit 8be447838dc1ecbd5637eb6bd13b8f338eaf33cd) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2538773 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Shashank Singh <shashsingh@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit