Commit 4aecb05e authored by Oded Gabbay's avatar Oded Gabbay

habanalabs: kill user process after CS rollback

This patch calls the kill user process function after we rollback the
in-flight CSs. This is because the user process can't be closed while
there are open CSs. Therefore, there is no point of sending it a SIGKILL
before we do the rollback CS part.
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b888751a
...@@ -630,8 +630,6 @@ static void device_hard_reset_pending(struct work_struct *work) ...@@ -630,8 +630,6 @@ static void device_hard_reset_pending(struct work_struct *work)
container_of(work, struct hl_device_reset_work, reset_work); container_of(work, struct hl_device_reset_work, reset_work);
struct hl_device *hdev = device_reset_work->hdev; struct hl_device *hdev = device_reset_work->hdev;
device_kill_open_processes(hdev);
hl_device_reset(hdev, true, true); hl_device_reset(hdev, true, true);
kfree(device_reset_work); kfree(device_reset_work);
...@@ -736,6 +734,13 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset, ...@@ -736,6 +734,13 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset,
/* Go over all the queues, release all CS and their jobs */ /* Go over all the queues, release all CS and their jobs */
hl_cs_rollback_all(hdev); hl_cs_rollback_all(hdev);
/* Kill processes here after CS rollback. This is because the process
* can't really exit until all its CSs are done, which is what we
* do in cs rollback
*/
if (from_hard_reset_thread)
device_kill_open_processes(hdev);
/* Release kernel context */ /* Release kernel context */
if ((hard_reset) && (hl_ctx_put(hdev->kernel_ctx) == 1)) if ((hard_reset) && (hl_ctx_put(hdev->kernel_ctx) == 1))
hdev->kernel_ctx = NULL; hdev->kernel_ctx = NULL;
...@@ -1129,8 +1134,6 @@ void hl_device_fini(struct hl_device *hdev) ...@@ -1129,8 +1134,6 @@ void hl_device_fini(struct hl_device *hdev)
hdev->hard_reset_pending = true; hdev->hard_reset_pending = true;
device_kill_open_processes(hdev);
hl_hwmon_fini(hdev); hl_hwmon_fini(hdev);
device_late_fini(hdev); device_late_fini(hdev);
...@@ -1149,6 +1152,12 @@ void hl_device_fini(struct hl_device *hdev) ...@@ -1149,6 +1152,12 @@ void hl_device_fini(struct hl_device *hdev)
/* Go over all the queues, release all CS and their jobs */ /* Go over all the queues, release all CS and their jobs */
hl_cs_rollback_all(hdev); hl_cs_rollback_all(hdev);
/* Kill processes here after CS rollback. This is because the process
* can't really exit until all its CSs are done, which is what we
* do in cs rollback
*/
device_kill_open_processes(hdev);
hl_cb_pool_fini(hdev); hl_cb_pool_fini(hdev);
/* Release kernel context */ /* Release kernel context */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment