[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466204089-17030-7-git-send-email-pali.rohar@gmail.com>
Date: Sat, 18 Jun 2016 00:54:49 +0200
From: Pali Rohár <pali.rohar@...il.com>
To: Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jan C Peters <jcpeters89@...il.com>,
Thorsten Leemhuis <fedora@...mhuis.info>,
David Santamaría Rogado <howl.nsp@...il.com>,
Peter Saunderson <peteasa@...il.com>,
Tolga Cakir <cevelnet@...il.com>,
"Austin S. Hemmelgarn" <ahferroin7@...il.com>,
Mario_Limonciello@...l.com,
Gabriele Mazzotta <gabriele.mzt@...il.com>,
Michał Kępień <kernel@...pniu.pl>,
Dakota Whipple <dakotajaywhipple@...il.com>,
Leon Yu <leon@...nyu.net>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
Pali Rohár <pali.rohar@...il.com>
Subject: [PATCH 6/6] hwmon: (dell-smm) In debug mode log duration of SMM calls
This allow us to debug how long take each SMM call and how long is system
frozen in SMM handler.
Signed-off-by: Pali Rohár <pali.rohar@...il.com>
---
drivers/hwmon/dell-smm-hwmon.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 571d498..acf9c03 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -140,6 +140,14 @@ static int i8k_smm(struct smm_regs *regs)
int eax = regs->eax;
cpumask_var_t old_mask;
+#ifdef DEBUG
+ int ebx = regs->ebx;
+ unsigned long duration;
+ ktime_t calltime, delta, rettime;
+
+ calltime = ktime_get();
+#endif
+
/* SMM requires CPU 0 */
if (!alloc_cpumask_var(&old_mask, GFP_KERNEL))
return -ENOMEM;
@@ -211,6 +219,15 @@ static int i8k_smm(struct smm_regs *regs)
out:
set_cpus_allowed_ptr(current, old_mask);
free_cpumask_var(old_mask);
+
+#ifdef DEBUG
+ rettime = ktime_get();
+ delta = ktime_sub(rettime, calltime);
+ duration = ktime_to_ns(delta) >> 10;
+ pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx,
+ (rc ? 0xffff : regs->eax & 0xffff), duration);
+#endif
+
return rc;
}
--
1.7.9.5
Powered by blists - more mailing lists