Commit f2e01dcf authored by Sohil Mehta's avatar Sohil Mehta Committed by Ingo Molnar
Browse files

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: default avatarSohil Mehta <sohil.mehta@intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Reviewed-by: default avatarKai Huang <kai.huang@intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarNikolay Borisov <nik.borisov@suse.com>
Link: https://lore.kernel.org/r/20250327234629.3953536-10-sohil.mehta@intel.com
parent 05279a28
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -119,11 +119,11 @@ static void nmi_check_duration(struct nmiaction *action, u64 duration)

	action->max_duration = duration;

	remainder_ns = do_div(duration, (1000 * 1000));
	decimal_msecs = remainder_ns / 1000;
	/* Convert duration from nsec to msec */
	remainder_ns = do_div(duration, NSEC_PER_MSEC);
	decimal_msecs = remainder_ns / NSEC_PER_USEC;

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