diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2016-06-17 18:54:49 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-06-27 21:58:03 -0400 |
commit | 9d58bec0966bfc87948244b81056137e6d214e04 (patch) | |
tree | 493334143c74d8663b72d3c0b6aa06c63c5460fb | |
parent | 747bc8b063ae6b66447918280922253721cb1d9b (diff) |
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@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/dell-smm-hwmon.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 571d4984d39c..acf9c0361d9f 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) | |||
140 | int eax = regs->eax; | 140 | int eax = regs->eax; |
141 | cpumask_var_t old_mask; | 141 | cpumask_var_t old_mask; |
142 | 142 | ||
143 | #ifdef DEBUG | ||
144 | int ebx = regs->ebx; | ||
145 | unsigned long duration; | ||
146 | ktime_t calltime, delta, rettime; | ||
147 | |||
148 | calltime = ktime_get(); | ||
149 | #endif | ||
150 | |||
143 | /* SMM requires CPU 0 */ | 151 | /* SMM requires CPU 0 */ |
144 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) | 152 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) |
145 | return -ENOMEM; | 153 | return -ENOMEM; |
@@ -211,6 +219,15 @@ static int i8k_smm(struct smm_regs *regs) | |||
211 | out: | 219 | out: |
212 | set_cpus_allowed_ptr(current, old_mask); | 220 | set_cpus_allowed_ptr(current, old_mask); |
213 | free_cpumask_var(old_mask); | 221 | free_cpumask_var(old_mask); |
222 | |||
223 | #ifdef DEBUG | ||
224 | rettime = ktime_get(); | ||
225 | delta = ktime_sub(rettime, calltime); | ||
226 | duration = ktime_to_ns(delta) >> 10; | ||
227 | pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx, | ||
228 | (rc ? 0xffff : regs->eax & 0xffff), duration); | ||
229 | #endif | ||
230 | |||
214 | return rc; | 231 | return rc; |
215 | } | 232 | } |
216 | 233 | ||