]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
habanalabs: extend fatal messages to contain PCI info
authorMoti Haimovski <mhaimovski@habana.ai>
Thu, 29 Dec 2022 10:44:09 +0000 (12:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:58 +0000 (09:33 +0100)
[ Upstream commit 2a0a839b6a28f7c4c528bb75b740c7f38ef79a37 ]

This commit attaches the PCI device address to driver fatal messages
in order to ease debugging in multi-device setups.

Signed-off-by: Moti Haimovski <mhaimovski@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/common/device.c

index 233d8b46c831fcc3e1ef8c6b28d13a5b41868cb6..e0dca445abf14bbdfc622baadaad1365f8192ad9 100644 (file)
@@ -1458,7 +1458,8 @@ kill_processes:
                if (rc == -EBUSY) {
                        if (hdev->device_fini_pending) {
                                dev_crit(hdev->dev,
-                                       "Failed to kill all open processes, stopping hard reset\n");
+                                       "%s Failed to kill all open processes, stopping hard reset\n",
+                                       dev_name(&(hdev)->pdev->dev));
                                goto out_err;
                        }
 
@@ -1468,7 +1469,8 @@ kill_processes:
 
                if (rc) {
                        dev_crit(hdev->dev,
-                               "Failed to kill all open processes, stopping hard reset\n");
+                               "%s Failed to kill all open processes, stopping hard reset\n",
+                               dev_name(&(hdev)->pdev->dev));
                        goto out_err;
                }
 
@@ -1519,14 +1521,16 @@ kill_processes:
                         * ensure driver puts the driver in a unusable state
                         */
                        dev_crit(hdev->dev,
-                               "Consecutive FW fatal errors received, stopping hard reset\n");
+                               "%s Consecutive FW fatal errors received, stopping hard reset\n",
+                               dev_name(&(hdev)->pdev->dev));
                        rc = -EIO;
                        goto out_err;
                }
 
                if (hdev->kernel_ctx) {
                        dev_crit(hdev->dev,
-                               "kernel ctx was alive during hard reset, something is terribly wrong\n");
+                               "%s kernel ctx was alive during hard reset, something is terribly wrong\n",
+                               dev_name(&(hdev)->pdev->dev));
                        rc = -EBUSY;
                        goto out_err;
                }
@@ -1645,9 +1649,13 @@ kill_processes:
        hdev->reset_info.needs_reset = false;
 
        if (hard_reset)
-               dev_info(hdev->dev, "Successfully finished resetting the device\n");
+               dev_info(hdev->dev,
+                        "Successfully finished resetting the %s device\n",
+                        dev_name(&(hdev)->pdev->dev));
        else
-               dev_dbg(hdev->dev, "Successfully finished resetting the device\n");
+               dev_dbg(hdev->dev,
+                       "Successfully finished resetting the %s device\n",
+                       dev_name(&(hdev)->pdev->dev));
 
        if (hard_reset) {
                hdev->reset_info.hard_reset_cnt++;
@@ -1681,7 +1689,9 @@ out_err:
        hdev->reset_info.in_compute_reset = 0;
 
        if (hard_reset) {
-               dev_err(hdev->dev, "Failed to reset! Device is NOT usable\n");
+               dev_err(hdev->dev,
+                       "%s Failed to reset! Device is NOT usable\n",
+                       dev_name(&(hdev)->pdev->dev));
                hdev->reset_info.hard_reset_cnt++;
        } else if (reset_upon_device_release) {
                spin_unlock(&hdev->reset_info.lock);
@@ -2004,7 +2014,8 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
        }
 
        dev_notice(hdev->dev,
-               "Successfully added device to habanalabs driver\n");
+               "Successfully added device %s to habanalabs driver\n",
+               dev_name(&(hdev)->pdev->dev));
 
        hdev->init_done = true;
 
@@ -2053,11 +2064,11 @@ out_disabled:
                device_cdev_sysfs_add(hdev);
        if (hdev->pdev)
                dev_err(&hdev->pdev->dev,
-                       "Failed to initialize hl%d. Device is NOT usable !\n",
-                       hdev->cdev_idx);
+                       "Failed to initialize hl%d. Device %s is NOT usable !\n",
+                       hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
        else
-               pr_err("Failed to initialize hl%d. Device is NOT usable !\n",
-                       hdev->cdev_idx);
+               pr_err("Failed to initialize hl%d. Device %s is NOT usable !\n",
+                       hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
 
        return rc;
 }
@@ -2113,7 +2124,8 @@ void hl_device_fini(struct hl_device *hdev)
 
                if (ktime_compare(ktime_get(), timeout) > 0) {
                        dev_crit(hdev->dev,
-                               "Failed to remove device because reset function did not finish\n");
+                               "%s Failed to remove device because reset function did not finish\n",
+                               dev_name(&(hdev)->pdev->dev));
                        return;
                }
        }