From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Ofir Bitton <obitton@habana.ai>
Subject: [PATCH 1/9] habanalabs: send device activity in a proper context
Date: Tue, 6 Sep 2022 17:43:10 +0300 [thread overview]
Message-ID: <20220906144318.1890416-1-ogabbay@kernel.org> (raw)
From: Ofir Bitton <obitton@habana.ai>
'Device activity open packet' should be sent outside of mutex as
there is no real necessity for a lock.
In addition 'device activity close packet' should be sent upon an
actual release of the device.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/misc/habanalabs/common/device.c | 4 ++--
drivers/misc/habanalabs/common/habanalabs_drv.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 986045de552e..a59cbbc8965f 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -385,6 +385,8 @@ static void hpriv_release(struct kref *ref)
hdev = hpriv->hdev;
+ hdev->asic_funcs->send_device_activity(hdev, false);
+
put_pid(hpriv->taskpid);
hl_debugfs_remove_file(hpriv);
@@ -492,8 +494,6 @@ static int hl_device_release(struct inode *inode, struct file *filp)
hdev->last_open_session_duration_jif =
jiffies - hdev->last_successful_open_jif;
- hdev->asic_funcs->send_device_activity(hdev, false);
-
return 0;
}
diff --git a/drivers/misc/habanalabs/common/habanalabs_drv.c b/drivers/misc/habanalabs/common/habanalabs_drv.c
index f9db7b91bfe3..c60d6dab7aa7 100644
--- a/drivers/misc/habanalabs/common/habanalabs_drv.c
+++ b/drivers/misc/habanalabs/common/habanalabs_drv.c
@@ -204,11 +204,11 @@ int hl_device_open(struct inode *inode, struct file *filp)
goto out_err;
}
- rc = hdev->asic_funcs->send_device_activity(hdev, true);
-
list_add(&hpriv->dev_node, &hdev->fpriv_list);
mutex_unlock(&hdev->fpriv_list_lock);
+ hdev->asic_funcs->send_device_activity(hdev, true);
+
hl_debugfs_add_file(hpriv);
atomic_set(&hdev->last_error.cs_timeout.write_enable, 1);
--
2.25.1
next reply other threads:[~2022-09-06 15:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 14:43 Oded Gabbay [this message]
2022-09-06 14:43 ` [PATCH 2/9] habanalabs: fix possible hole in device va Oded Gabbay
2022-09-06 14:43 ` [PATCH 3/9] habanalabs/gaudi: rename mme cfg error response print Oded Gabbay
2022-09-06 14:43 ` [PATCH 4/9] habanalabs/gaudi2: read F/W security indication after hard reset Oded Gabbay
2022-09-06 14:43 ` [PATCH 5/9] habanalabs: add support for new cpucp return codes Oded Gabbay
2022-09-06 14:43 ` [PATCH 6/9] habanalabs: fix resetting the DRAM BAR Oded Gabbay
2022-09-06 14:43 ` [PATCH 7/9] habanalabs/gaudi2: free event irq if init fails Oded Gabbay
2022-09-06 14:43 ` [PATCH 8/9] habanalabs: new notifier events for device state Oded Gabbay
2022-09-06 14:43 ` [PATCH 9/9] habanalabs: MMU invalidation h/w is per device Oded Gabbay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220906144318.1890416-1-ogabbay@kernel.org \
--to=ogabbay@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=obitton@habana.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox