diff options
author | Ofir Bitton <obitton@habana.ai> | 2022-02-28 16:08:20 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-22 20:57:34 +0200 |
commit | 4c3b9f6e3bd0480474666f9e016ff57ea0c5ecaa (patch) | |
tree | deb41501e3bac1d60d44810b0f1fcc3487c1d553 /drivers/misc/habanalabs/common/device.c | |
parent | 050a6f349a09d3cefb14f4114bfa047b2c5b2a65 (diff) | |
download | linux-next-4c3b9f6e3bd0480474666f9e016ff57ea0c5ecaa.tar.gz |
habanalabs: add new return code to device fd open
In order to be more informative during device open, we are adding a
new return code -EAGAIN that indicates device is still going through
resource reclaiming and hence it cannot be used yet.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/device.c')
-rw-r--r-- | drivers/misc/habanalabs/common/device.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c index dc9341a64541..3eb392b4308a 100644 --- a/drivers/misc/habanalabs/common/device.c +++ b/drivers/misc/habanalabs/common/device.c @@ -107,6 +107,8 @@ static void hpriv_release(struct kref *ref) hdev->is_compute_ctx_active = false; mutex_unlock(&hdev->fpriv_list_lock); + hdev->compute_ctx_in_release = 0; + kfree(hpriv); } @@ -150,6 +152,8 @@ static int hl_device_release(struct inode *inode, struct file *filp) hl_ts_mgr_fini(hpriv->hdev, &hpriv->ts_mem_mgr); hl_ctx_mgr_fini(hdev, &hpriv->ctx_mgr); + hdev->compute_ctx_in_release = 1; + if (!hl_hpriv_put(hpriv)) dev_notice(hdev->dev, "User process closed FD but device still in use\n"); |