[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130530083315.GA14913@gmail.com>
Date: Thu, 30 May 2013 10:33:15 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Dave Hansen <dave@...1.net>
Cc: a.p.zijlstra@...llo.nl, mingo@...hat.com, paulus@...ba.org,
acme@...stprotocols.net, tglx@...utronix.de, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [v3][PATCH 2/4] x86: warn when NMI handlers take large amounts
of time
* Dave Hansen <dave@...1.net> wrote:
> @@ -96,8 +106,24 @@ static int __kprobes nmi_handle(unsigned
> * can be latched at any given time. Walk the whole list
> * to handle those situations.
> */
> - list_for_each_entry_rcu(a, &desc->head, list)
> + list_for_each_entry_rcu(a, &desc->head, list) {
> + u64 before, delta, whole_msecs;
> + int decimal_msecs;
> +
> + before = local_clock();
> handled += a->handler(type, regs);
> + delta = local_clock() - before;
> +
> + if (delta < nmi_longest_ns)
> + continue;
> +
> + nmi_longest_ns = delta;
> + whole_msecs = delta / (1000 * 1000);
> + decimal_msecs = (delta / 1000) % 1000;
> + printk_ratelimited(KERN_INFO
> + "INFO: NMI handler took too long to run: "
> + "%lld.%03d msecs\n", whole_msecs, decimal_msecs);
> + }
One more thing, would it make sense to print the symbol name of the
->handler here? That way the message would be more actionable:
INFO: NMI handler (nmi_handler_foo) took too long to run: 12.613 msecs
(Note, printk() has a '%ps' format string extension to print function
pointer symbolic names, so it's easy to add.)
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists