Skip to content

Commit f2e01dc

Browse files
sohilmehIngo Molnar
authored andcommitted
x86/nmi: Improve NMI duration console printouts
Convert the last remaining printk() in nmi.c to pr_info(). Along with it, use timespec macros to calculate the NMI handler duration. Signed-off-by: Sohil Mehta <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Kai Huang <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 05279a2 commit f2e01dc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/kernel/nmi.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ static void nmi_check_duration(struct nmiaction *action, u64 duration)
119119

120120
action->max_duration = duration;
121121

122-
remainder_ns = do_div(duration, (1000 * 1000));
123-
decimal_msecs = remainder_ns / 1000;
122+
/* Convert duration from nsec to msec */
123+
remainder_ns = do_div(duration, NSEC_PER_MSEC);
124+
decimal_msecs = remainder_ns / NSEC_PER_USEC;
124125

125-
printk_ratelimited(KERN_INFO
126-
"INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n",
127-
action->handler, duration, decimal_msecs);
126+
pr_info_ratelimited("INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n",
127+
action->handler, duration, decimal_msecs);
128128
}
129129

130130
static int nmi_handle(unsigned int type, struct pt_regs *regs)

0 commit comments

Comments
 (0)