Commit e79e745b authored by Oded Gabbay's avatar Oded Gabbay
Browse files

habanalabs: use get_task_pid() to take PID



The previous function we used, find_get_pid(), wasn't good in case
the user process was run inside docker.

As a result, we didn't had the PID and we couldn't kill the user
process in case the device got stuck and we needed to reset the
device.

Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent fbcd0efe
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@

#define pr_fmt(fmt)			"habanalabs: " fmt

#include <uapi/misc/habanalabs.h>
#include "habanalabs.h"

#include <linux/pci.h>
#include <linux/hwmon.h>
#include <uapi/misc/habanalabs.h>

enum hl_device_status hl_device_status(struct hl_device *hdev)
{
@@ -819,6 +819,10 @@ static int device_kill_open_processes(struct hl_device *hdev, u32 timeout)
			usleep_range(1000, 10000);

			put_task_struct(task);
		} else {
			dev_warn(hdev->dev,
				"Can't get task struct for PID so giving up on killing process\n");
			return -ETIME;
		}
	}

+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ int hl_device_open(struct inode *inode, struct file *filp)
	hl_cb_mgr_init(&hpriv->cb_mgr);
	hl_ctx_mgr_init(&hpriv->ctx_mgr);

	hpriv->taskpid = find_get_pid(current->pid);
	hpriv->taskpid = get_task_pid(current, PIDTYPE_PID);

	mutex_lock(&hdev->fpriv_list_lock);