From 9963b94b4b6d3811f98e8c5fdbda5bc0fb14eaba Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 13 Aug 2020 13:51:50 +0530 Subject: [PATCH] gpu: nvgpu: unbind resources during reservation release nvgpu_profiler_pm_resource_release() right now returns error if PM resources are already bound. Update this to unbind the resources explicitly as per the user requirement. Bug 2510974 Jira NVGPU-5360 Change-Id: Ib71e2d8d3caacd3bc5e29a06af0b90983468d33a Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2398354 Reviewed-by: automaticguardword Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/profiler/profiler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/profiler/profiler.c b/drivers/gpu/nvgpu/common/profiler/profiler.c index 3a87ff085..1a0352f23 100644 --- a/drivers/gpu/nvgpu/common/profiler/profiler.c +++ b/drivers/gpu/nvgpu/common/profiler/profiler.c @@ -210,8 +210,16 @@ int nvgpu_profiler_pm_resource_release(struct nvgpu_profiler_object *prof, } if (prof->bound) { - nvgpu_err(g, "PM resources are bound, cannot release reservation"); - return -EINVAL; + nvgpu_log(g, gpu_dbg_prof, + "PM resources alredy bound with profiler handle %u," + " unbinding for reservation release", + prof->prof_handle); + err = nvgpu_profiler_unbind_pm_resources(prof); + if (err != 0) { + nvgpu_err(g, "Profiler handle %u failed to unbound, err %d", + prof->prof_handle, err); + return err; + } } err = g->ops.pm_reservation.release(g, reservation_id, pm_resource, 0);