gpu: nvgpu: profiler: update PMA stream free policy

Update PMA stream free policy to implicitly unbind any resources already
bound to the profiler object.

Bug 3480919

Change-Id: I71ed4b73be295a86046a1384800e7ed0f2430f64
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2662361
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Antony Clince Alex
2022-02-01 08:17:53 +00:00
committed by mobile promotions
parent a6e5b76cbf
commit e96746cfcd

View File

@@ -521,6 +521,7 @@ static int nvgpu_prof_ioctl_free_pma_stream(struct nvgpu_profiler_object_priv *p
{ {
struct nvgpu_profiler_object *prof = priv->prof; struct nvgpu_profiler_object *prof = priv->prof;
struct gk20a *g = prof->g; struct gk20a *g = prof->g;
int err;
nvgpu_log(g, gpu_dbg_prof, "Request to free PMA stream for handle %u", nvgpu_log(g, gpu_dbg_prof, "Request to free PMA stream for handle %u",
prof->prof_handle); prof->prof_handle);
@@ -531,8 +532,15 @@ static int nvgpu_prof_ioctl_free_pma_stream(struct nvgpu_profiler_object_priv *p
} }
if (prof->bound) { if (prof->bound) {
nvgpu_err(g, "PM resources are bound, cannot free PMA"); nvgpu_log(g, gpu_dbg_prof, "PM resources already bound with"
return -EINVAL; " profiler handle %u, implicity unbinding for"
" freeing PMA stream", prof->prof_handle);
err = nvgpu_profiler_unbind_pm_resources(prof);
if (err != 0) {
nvgpu_err(g, "Profiler handle %u failed to unbind,"
" err %d", prof->prof_handle, err);
return err;
}
} }
nvgpu_prof_free_pma_stream_priv_data(priv); nvgpu_prof_free_pma_stream_priv_data(priv);