hwmon: (dell-smm) Warn if SMM call took a very long time to execute
authorArmin Wolf <W_Armin@gmx.de>
Tue, 26 Apr 2022 21:31:54 +0000 (23:31 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 20 May 2022 17:57:05 +0000 (10:57 -0700)
If a particular SMM call takes a very long time to execute,
the user might experience audio problems. Print a warning
if a particular SMM call took over 0.250 seconds to execute,
so the user can check whether or not possible audio problems
are caused by this driver.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20220426213154.724708-4-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/dell-smm-hwmon.c

index f1390241461523d9ee2e75d543a4562b5fe7348d..071aa6f4e109b76567f21b9d02a2c6c934d56c9e 100644 (file)
@@ -49,6 +49,9 @@
 #define I8K_SMM_GET_DELL_SIG1  0xfea3
 #define I8K_SMM_GET_DELL_SIG2  0xffa3
 
+/* in usecs */
+#define DELL_SMM_MAX_DURATION  250000
+
 #define I8K_FAN_MULT           30
 #define I8K_FAN_RPM_THRESHOLD  1000
 #define I8K_MAX_TEMP           127
@@ -239,6 +242,9 @@ static int i8k_smm_func(void *par)
        pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x  (took %7lld usecs)\n", eax, ebx,
                 (rc ? 0xffff : regs->eax & 0xffff), duration);
 
+       if (duration > DELL_SMM_MAX_DURATION)
+               pr_warn_once("SMM call took %lld usecs!\n", duration);
+
        return rc;
 }