WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add a 't' debug key to Xen for displaying info about cro

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add a 't' debug key to Xen for displaying info about cross-cpu clock jitter.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Mar 2006 13:06:07 +0000
Delivery-date: Mon, 13 Mar 2006 13:07:09 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 68915c4893ee3184ca955b90e221dd8e69772a46
# Parent  2625000d314588d0844b7a7a89be9887881cd5d8
Add a 't' debug key to Xen for displaying info about cross-cpu clock jitter.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 2625000d3145 -r 68915c4893ee xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Mon Mar 13 12:03:18 2006
+++ b/xen/common/keyhandler.c   Mon Mar 13 12:03:51 2006
@@ -14,6 +14,7 @@
 #include <xen/rangeset.h>
 #include <asm/debugger.h>
 #include <asm/shadow.h>
+#include <asm/div64.h>
 
 #define KEY_MAX 256
 #define STR_MAX  64
@@ -168,6 +169,58 @@
     read_unlock(&domlist_lock);
 }
 
+static cpumask_t read_clocks_cpumask = CPU_MASK_NONE;
+static s_time_t read_clocks_time[NR_CPUS];
+
+static void read_clocks_slave(void *unused)
+{
+    unsigned int cpu = smp_processor_id();
+    while ( !cpu_isset(cpu, read_clocks_cpumask) )
+        cpu_relax();
+    read_clocks_time[cpu] = NOW();
+    cpu_clear(cpu, read_clocks_cpumask);
+}
+
+static void read_clocks(unsigned char key)
+{
+    unsigned int cpu = smp_processor_id(), min_cpu, max_cpu;
+    u64 min, max, dif, difus;
+    static DEFINE_SPINLOCK(lock);
+
+    spin_lock(&lock);
+
+    smp_call_function(read_clocks_slave, NULL, 0, 0);
+
+    local_irq_disable();
+    read_clocks_cpumask = cpu_online_map;
+    read_clocks_time[cpu] = NOW();
+    cpu_clear(cpu, read_clocks_cpumask);
+    local_irq_enable();
+
+    while ( !cpus_empty(read_clocks_cpumask) )
+        cpu_relax();
+
+    min_cpu = max_cpu = cpu;
+    for_each_online_cpu ( cpu )
+    {
+        if ( read_clocks_time[cpu] < read_clocks_time[min_cpu] )
+            min_cpu = cpu;
+        if ( read_clocks_time[cpu] > read_clocks_time[max_cpu] )
+            max_cpu = cpu;
+    }
+
+    min = read_clocks_time[min_cpu];
+    max = read_clocks_time[max_cpu];
+
+    spin_unlock(&lock);
+
+    dif = difus = max - min;
+    do_div(difus, 1000);
+    printk("Min = %"PRIu64" ; Max = %"PRIu64" ; Diff = %"PRIu64
+           " (%"PRIu64" microseconds)\n",
+           min, max, dif, difus);
+}
+
 extern void dump_runq(unsigned char key);
 #ifndef NDEBUG
 extern void audit_domains_key(unsigned char key);
@@ -178,7 +231,7 @@
 extern void perfc_reset(unsigned char key);
 #endif
 
-void do_debug_key(unsigned char key, struct cpu_user_regs *regs)
+static void do_debug_key(unsigned char key, struct cpu_user_regs *regs)
 {
     (void)debugger_trap_fatal(0xf001, regs);
     nop(); /* Prevent the compiler doing tail call
@@ -187,7 +240,7 @@
 }
 
 #ifndef NDEBUG
-void debugtrace_key(unsigned char key)
+static void debugtrace_key(unsigned char key)
 {
     debugtrace_send_to_console = !debugtrace_send_to_console;
     debugtrace_dump();
@@ -210,6 +263,9 @@
         'r', dump_runq,      "dump run queues");
     register_irq_keyhandler(
         'R', halt_machine,   "reboot machine"); 
+
+    register_keyhandler(
+        't', read_clocks, "display multi-cpu clock info");
 
 #ifndef NDEBUG
     register_keyhandler(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add a 't' debug key to Xen for displaying info about cross-cpu clock jitter., Xen patchbot -unstable <=