Skip to contentSkip to conversation

habanalabs: add rate-limit to an error message

PATCH In review Oded Gabbay 2 participants 4 messages Jun 6, 2019 – Jun 7, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 habanalabs: add rate-limit to an error message

This patch changes the print of an error message about mis-configuration of the debug infrastructure to be rate-limited, to prevent flooding of kernel log, as these configuration requests can come at a high rate.

---
 drivers/misc/habanalabs/habanalabs_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/habanalabs_ioctl.c +1 -1
index c5f7ecabef0a..cbc5fa1ffe11 100644
@@ -255,7 +255,7 @@ static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data)
 	case HL_DEBUG_OP_SPMU:
 	case HL_DEBUG_OP_TIMESTAMP:
 		if (!hdev->in_debug) {
-			dev_err(hdev->dev,
+			dev_err_ratelimited(hdev->dev,
 				"Rejecting debug configuration request because device not in debug mode\n");
 			return -EFAULT;
 		}
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 docs/habanalabs: update text for some entries in sysfs

This patch updates the description of some entries in sysfs for the habanalabs driver.

---
 .../ABI/testing/sysfs-driver-habanalabs       | 42 +++++++++++--------
 1 file changed, 24 insertions(+), 18 deletions(-)
Documentation/ABI/testing/sysfs-driver-habanalabs +24 -18
index 78b2bcf316a3..f433fc6db3c6 100644
@@ -62,18 +62,20 @@ What:           /sys/class/habanalabs/hl<n>/ic_clk
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Allows the user to set the maximum clock frequency of the
-                Interconnect fabric. Writes to this parameter affect the device
-                only when the power management profile is set to "manual" mode.
-                The device IC clock might be set to lower value then the
+Description:    Allows the user to set the maximum clock frequency, in Hz, of
+                the Interconnect fabric. Writes to this parameter affect the
+                device only when the power management profile is set to "manual"
+                mode. The device IC clock might be set to lower value than the
                 maximum. The user should read the ic_clk_curr to see the actual
-                frequency value of the IC
+                frequency value of the IC. This property is valid only for the
+                Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/ic_clk_curr
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Displays the current clock frequency of the Interconnect fabric
+Description:    Displays the current clock frequency, in Hz, of the Interconnect
+                fabric. This property is valid only for the Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/infineon_ver
 Date:           Jan 2019
@@ -92,18 +94,20 @@ What:           /sys/class/habanalabs/hl<n>/mme_clk
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Allows the user to set the maximum clock frequency of the
-                MME compute engine. Writes to this parameter affect the device
-                only when the power management profile is set to "manual" mode.
-                The device MME clock might be set to lower value then the
+Description:    Allows the user to set the maximum clock frequency, in Hz, of
+                the MME compute engine. Writes to this parameter affect the
+                device only when the power management profile is set to "manual"
+                mode. The device MME clock might be set to lower value than the
                 maximum. The user should read the mme_clk_curr to see the actual
-                frequency value of the MME
+                frequency value of the MME. This property is valid only for the
+                Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/mme_clk_curr
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Displays the current clock frequency of the MME compute engine
+Description:    Displays the current clock frequency, in Hz, of the MME compute
+                engine. This property is valid only for the Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/pci_addr
 Date:           Jan 2019
@@ -163,18 +167,20 @@ What:           /sys/class/habanalabs/hl<n>/tpc_clk
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Allows the user to set the maximum clock frequency of the
-                TPC compute engines. Writes to this parameter affect the device
-                only when the power management profile is set to "manual" mode.
-                The device TPC clock might be set to lower value then the
+Description:    Allows the user to set the maximum clock frequency, in Hz, of
+                the TPC compute engines. Writes to this parameter affect the
+                device only when the power management profile is set to "manual"
+                mode. The device TPC clock might be set to lower value than the
                 maximum. The user should read the tpc_clk_curr to see the actual
-                frequency value of the TPC
+                frequency value of the TPC. This property is valid only for
+                Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/tpc_clk_curr
 Date:           Jan 2019
 KernelVersion:  5.1
 Contact:        [email protected]
-Description:    Displays the current clock frequency of the TPC compute engines
+Description:    Displays the current clock frequency, in Hz, of the TPC compute
+                engines. This property is valid only for the Goya ASIC family
 
 What:           /sys/class/habanalabs/hl<n>/uboot_ver
 Date:           Jan 2019
Signature · 1 line
2.17.1
#2 lore raw
In reply to Oded Gabbay
Quoted 3 lines · Oded Gabbay

This patch changes the print of an error message about mis-configuration of the debug infrastructure to be rate-limited, to prevent flooding of kernel log, as these configuration requests can come at a high rate.

[]

drivers/misc/habanalabs/habanalabs_ioctl.c

Quoted 1 line
drivers/misc/habanalabs/habanalabs_ioctl.c +0 -0

[]

drivers/misc/habanalabs/habanalabs_ioctl.c static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data) · line 261

Quoted 9 lines
drivers/misc/habanalabs/habanalabs_ioctl.c +1 -1
@@ -255,7 +255,7 @@ static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data)
 	case HL_DEBUG_OP_SPMU:
 	case HL_DEBUG_OP_TIMESTAMP:
 		if (!hdev->in_debug) {
-			dev_err(hdev->dev,
+			dev_err_ratelimited(hdev->dev,
 				"Rejecting debug configuration request because device not in debug mode\n");
 			return -EFAULT;
 		}

Perhaps this should be dev_dbg

#3 lore raw
Quoted 8 lines · Joe Perches
Quoted 3 lines · Oded Gabbay

This patch changes the print of an error message about mis-configuration of the debug infrastructure to be rate-limited, to prevent flooding of kernel log, as these configuration requests can come at a high rate.

[]

drivers/misc/habanalabs/habanalabs_ioctl.c

Quoted 1 line
drivers/misc/habanalabs/habanalabs_ioctl.c +0 -0

[]

Quoted 13 lines

drivers/misc/habanalabs/habanalabs_ioctl.c static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data) · line 261

Quoted 9 lines
drivers/misc/habanalabs/habanalabs_ioctl.c +1 -1
@@ -255,7 +255,7 @@ static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data)
      case HL_DEBUG_OP_SPMU:
      case HL_DEBUG_OP_TIMESTAMP:
              if (!hdev->in_debug) {
-                     dev_err(hdev->dev,
+                     dev_err_ratelimited(hdev->dev,
                              "Rejecting debug configuration request because device not in debug mode\n");
                      return -EFAULT;
              }

Perhaps this should be dev_dbg

But this a basic error. I prefer to give visibility to the user in such a case.

Thanks,
Oded