From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v5 5/5] x86/hpet: debug keyhandlers
Date: Wed, 5 Mar 2014 15:43:46 +0000 [thread overview]
Message-ID: <1394034226-14327-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1394034226-14327-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 5f9599c..e8b35ca 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 );
@@ -795,6 +799,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;
@@ -852,6 +883,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:[~2014-03-05 15:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 15:43 [RFC v5 0/5] HPET fix interrupt logic Andrew Cooper
2014-03-05 15:43 ` [PATCH v5 1/5] x86/hpet: Pre cleanup Andrew Cooper
2014-03-05 15:43 ` [PATCH v5 2/5] x86/hpet: Use singe apic vector rather than irq_descs for HPET interrupts Andrew Cooper
2014-03-06 14:11 ` Tim Deegan
2014-03-06 14:33 ` Jan Beulich
2014-03-06 14:40 ` Andrew Cooper
2014-03-06 15:38 ` Jan Beulich
2014-03-06 16:08 ` Jan Beulich
2014-03-05 15:43 ` [PATCH v5 3/5] x86/hpet: Post cleanup Andrew Cooper
2014-03-05 15:43 ` [PATCH v5 4/5] x86/hpet: Debug and verbose hpet logging Andrew Cooper
2014-03-05 15:43 ` 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=1394034226-14327-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).