From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [Patch v4 5/5] x86/hpet: debug keyhandlers
Date: Wed, 13 Nov 2013 17:59:14 +0000 [thread overview]
Message-ID: <1384365554-11017-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1384365554-11017-1-git-send-email-andrew.cooper3@citrix.com>
Debug key for dumping HPET state.
This patch is not intended for committing.
---
xen/arch/x86/hpet.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index dedfa04..781f0f4 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -9,6 +9,7 @@
#include <xen/cpuidle.h>
#include <xen/errno.h>
#include <xen/softirq.h>
+#include <xen/keyhandler.h>
#include <mach_apic.h>
@@ -68,6 +69,7 @@ boolean_param("hpetbroadcast", force_hpet_broadcast);
static bool_t __read_mostly hpet_verbose;
static bool_t __read_mostly hpet_debug;
+static bool_t __initdata hpet_debug_tick;
static void __init parse_hpet_param(char * s)
{
char *ss;
@@ -90,6 +92,8 @@ static void __init parse_hpet_param(char * s)
if ( val )
hpet_verbose = 1;
}
+ else if ( !strcmp(s, "tick") )
+ hpet_debug_tick = val;
s = ss + 1;
} while ( ss );
@@ -764,6 +768,33 @@ int hpet_legacy_irq_tick(void)
static u32 *hpet_boot_cfg;
+static void do_hpet_dump_state(unsigned char key)
+{
+ unsigned i;
+ printk("'%c' pressed - dumping HPET state\n", key);
+
+ for ( i = 0; i < num_hpets_used; ++i )
+ dump_hpet_timer(i);
+}
+
+static struct keyhandler hpet_dump_state = {
+ .irq_callback = 0,
+ .u.fn = do_hpet_dump_state,
+ .desc = "Dump hpet state"
+};
+
+static struct timer hpet_dbg_tick;
+static void hpet_dbg_tick_fn(void *data)
+{
+ static s_time_t last = 0;
+ s_time_t now = NOW();
+
+ printk("In HPET debug tick. Time is %"PRId64", delta is %"PRId64"\n",
+ now, now - last);
+ set_timer(&hpet_dbg_tick, now + SECONDS(5));
+ last = now;
+}
+
u64 __init hpet_setup(void)
{
static u64 __initdata hpet_rate;
@@ -821,6 +852,14 @@ u64 __init hpet_setup(void)
hpet_rate = 1000000000000000ULL; /* 10^15 */
(void)do_div(hpet_rate, hpet_period);
+ register_keyhandler('1', &hpet_dump_state);
+
+ if ( hpet_debug_tick )
+ {
+ init_timer(&hpet_dbg_tick, hpet_dbg_tick_fn, NULL, 0);
+ set_timer(&hpet_dbg_tick, NOW() + SECONDS(5));
+ }
+
return hpet_rate;
}
--
1.7.10.4
prev parent reply other threads:[~2013-11-13 17:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 17:59 [RFC v4 0/5] HPET fix interrupt logic Andrew Cooper
2013-11-13 17:59 ` [Patch v4 1/5] x86/hpet: Pre cleanup Andrew Cooper
2013-11-13 17:59 ` [Patch v4 2/5] x86/hpet: Use singe apic vector rather than irq_descs for HPET interrupts Andrew Cooper
2013-11-14 15:52 ` Tim Deegan
2013-11-14 15:56 ` Andrew Cooper
2013-11-14 16:01 ` [Patch v5 " Andrew Cooper
2013-11-22 15:45 ` Jan Beulich
2013-11-22 16:23 ` Andrew Cooper
2013-11-22 16:49 ` Jan Beulich
2013-11-22 17:38 ` Andrew Cooper
2013-11-25 7:52 ` Jan Beulich
2013-11-25 7:50 ` Jan Beulich
2013-11-26 18:32 ` Andrew Cooper
2013-11-27 8:35 ` Jan Beulich
2013-11-27 22:37 ` Andrew Cooper
2013-11-28 14:33 ` Jan Beulich
2013-11-28 15:06 ` Andrew Cooper
2013-11-13 17:59 ` [Patch v4 3/5] x86/hpet: Post cleanup Andrew Cooper
2013-11-13 17:59 ` [Patch v4 4/5] x86/hpet: Debug and verbose hpet logging Andrew Cooper
2013-11-13 17:59 ` Andrew Cooper [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384365554-11017-6-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).