diff mbox series

[3/3] hwmon: (dell-smm) Warn if SMM call took a very long time to execute

Message ID 20220426200320.399435-4-W_Armin@gmx.de (mailing list archive)
State Superseded
Headers show
Series hwmon: (dell-smm) Improve init code | expand

Commit Message

Armin Wolf April 26, 2022, 8:03 p.m. UTC
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>
---
 drivers/hwmon/dell-smm-hwmon.c | 6 ++++++
 1 file changed, 6 insertions(+)

--
2.30.2

Comments

Guenter Roeck April 26, 2022, 8:17 p.m. UTC | #1
On Tue, Apr 26, 2022 at 10:03:20PM +0200, Armin Wolf wrote:
> 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>
> ---
>  drivers/hwmon/dell-smm-hwmon.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> index f13902414615..b960330eaded 100644
> --- a/drivers/hwmon/dell-smm-hwmon.c
> +++ b/drivers/hwmon/dell-smm-hwmon.c
> @@ -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("SMM call took %lld usecs!\n", duration);

pr_warn_once, maybe ? If this happens, it will happen a lot, and it doesn't
add much if any value to keep reporting the problem.

Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index f13902414615..b960330eaded 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -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("SMM call took %lld usecs!\n", duration);
+
 	return rc;
 }