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] [xen-unstable] xm: New command 'debug-keys' to inject de

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm: New command 'debug-keys' to inject debug-key events into Xen.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Mar 2007 11:30:22 -0800
Delivery-date: Fri, 09 Mar 2007 11:31:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1173438719 0
# Node ID 7ab04fa25d527e741e06910381ec576026770be9
# Parent  a67d3fbd4577ae1c0294ae782c43b519fad4c6ae
xm: New command 'debug-keys' to inject debug-key events into Xen.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_misc.c                        |   19 +++++++++++++++++++
 tools/libxc/xenctrl.h                        |    2 ++
 tools/python/xen/lowlevel/xc/xc.c            |   24 ++++++++++++++++++++++++
 tools/python/xen/xend/XendNode.py            |    6 ++++++
 tools/python/xen/xend/server/XMLRPCServer.py |    2 +-
 tools/python/xen/xm/main.py                  |    8 +++++++-
 xen/common/keyhandler.c                      |    2 +-
 xen/common/sysctl.c                          |   15 +++++++++++++++
 xen/include/public/sysctl.h                  |   13 +++++++++++++
 9 files changed, 88 insertions(+), 3 deletions(-)

diff -r a67d3fbd4577 -r 7ab04fa25d52 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Fri Mar 09 09:21:31 2007 +0000
+++ b/tools/libxc/xc_misc.c     Fri Mar 09 11:11:59 2007 +0000
@@ -29,6 +29,25 @@ int xc_readconsolering(int xc_handle,
         *pnr_chars = sysctl.u.readconsole.count;
 
     unlock_pages(buffer, nr_chars);
+
+    return ret;
+}
+
+int xc_send_debug_keys(int xc_handle, char *keys)
+{
+    int ret, len = strlen(keys);
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_debug_keys;
+    set_xen_guest_handle(sysctl.u.debug_keys.keys, keys);
+    sysctl.u.debug_keys.nr_keys = len;
+
+    if ( (ret = lock_pages(keys, len)) != 0 )
+        return ret;
+
+    ret = do_sysctl(xc_handle, &sysctl);
+
+    unlock_pages(keys, len);
 
     return ret;
 }
diff -r a67d3fbd4577 -r 7ab04fa25d52 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Mar 09 09:21:31 2007 +0000
+++ b/tools/libxc/xenctrl.h     Fri Mar 09 11:11:59 2007 +0000
@@ -467,6 +467,8 @@ int xc_readconsolering(int xc_handle,
                        unsigned int *pnr_chars,
                        int clear);
 
+int xc_send_debug_keys(int xc_handle, char *keys);
+
 typedef xen_sysctl_physinfo_t xc_physinfo_t;
 int xc_physinfo(int xc_handle,
                 xc_physinfo_t *info);
diff -r a67d3fbd4577 -r 7ab04fa25d52 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Mar 09 09:21:31 2007 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Mar 09 11:11:59 2007 +0000
@@ -1007,6 +1007,24 @@ static PyObject *pyxc_domain_send_trigge
     return zero;
 }
 
+static PyObject *pyxc_send_debug_keys(XcObject *self,
+                                      PyObject *args,
+                                      PyObject *kwds)
+{
+    char *keys;
+
+    static char *kwd_list[] = { "keys", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list, &keys) )
+        return NULL;
+
+    if ( xc_send_debug_keys(self->xc_handle, keys) != 0 )
+        return pyxc_error_to_exception();
+
+    Py_INCREF(zero);
+    return zero;
+}
+
 static PyObject *dom_op(XcObject *self, PyObject *args,
                         int (*fn)(int, uint32_t))
 {
@@ -1419,6 +1437,12 @@ static PyMethodDef pyxc_methods[] = {
       " trigger [int]: Trigger type number.\n"
       " vcpu    [int]: VCPU to be sent trigger.\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
+
+    { "send_debug_keys",
+      (PyCFunction)pyxc_send_debug_keys,
+      METH_VARARGS | METH_KEYWORDS, "\n"
+      "Inject debug keys into Xen.\n"
+      " keys    [str]: String of keys to inject.\n" },
 
 #ifdef __powerpc__
     { "arch_alloc_real_mode_area", 
diff -r a67d3fbd4577 -r 7ab04fa25d52 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Fri Mar 09 09:21:31 2007 +0000
+++ b/tools/python/xen/xend/XendNode.py Fri Mar 09 11:11:59 2007 +0000
@@ -453,6 +453,12 @@ class XendNode:
                 return pif.network
         raise Exception('Bridge %s is not connected to a network' % bridge)
 
+    #
+    # Debug keys.
+    #
+
+    def send_debug_keys(self, keys):
+        return self.xc.send_debug_keys(keys)
 
     #
     # Getting host information.
diff -r a67d3fbd4577 -r 7ab04fa25d52 
tools/python/xen/xend/server/XMLRPCServer.py
--- a/tools/python/xen/xend/server/XMLRPCServer.py      Fri Mar 09 09:21:31 
2007 +0000
+++ b/tools/python/xen/xend/server/XMLRPCServer.py      Fri Mar 09 11:11:59 
2007 +0000
@@ -157,7 +157,7 @@ class XMLRPCServer:
                     self.server.register_function(fn, "xend.domain.%s" % 
name[7:])
 
         # Functions in XendNode and XendDmesg
-        for type, lst, n in [(XendNode, ['info'], 'node'),
+        for type, lst, n in [(XendNode, ['info', 'send_debug_keys'], 'node'),
                              (XendDmesg, ['info', 'clear'], 'node.dmesg')]:
             inst = type.instance()
             for name in lst:
diff -r a67d3fbd4577 -r 7ab04fa25d52 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Mar 09 09:21:31 2007 +0000
+++ b/tools/python/xen/xm/main.py       Fri Mar 09 11:11:59 2007 +0000
@@ -133,6 +133,7 @@ SUBCOMMAND_HELP = {
     'sched-credit': ('[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]]',
                      'Get/set credit scheduler parameters.'),
     'sysrq'       : ('<Domain> <letter>', 'Send a sysrq to a domain.'),
+    'debug-keys'  : ('<Keys>', 'Send debug keys to Xen.'),
     'trigger'     : ('<Domain> <nmi|reset|init> [<VCPU>]',
                      'Send a trigger to a domain.'),
     'vcpu-list'   : ('[<Domain>]',
@@ -260,7 +261,6 @@ common_commands = [
     "shutdown",
     "start",
     "suspend",
-    "trigger",
     "top",
     "unpause",
     "uptime",
@@ -300,6 +300,7 @@ domain_commands = [
     ]
 
 host_commands = [
+    "debug-keys",
     "dmesg",
     "info",
     "log",
@@ -1394,6 +1395,10 @@ def xm_trigger(args):
         vcpu = int(args[2])
     
     server.xend.domain.send_trigger(dom, trigger, vcpu)
+
+def xm_debug_keys(args):
+    arg_check(args, "debug-keys", 1)
+    server.xend.node.send_debug_keys(str(args[0]))
 
 def xm_top(args):
     arg_check(args, "top", 0)
@@ -1738,6 +1743,7 @@ commands = {
     "pause": xm_pause,
     "unpause": xm_unpause,
     # host commands
+    "debug-keys": xm_debug_keys,
     "dmesg": xm_dmesg,
     "info": xm_info,
     "log": xm_log,
diff -r a67d3fbd4577 -r 7ab04fa25d52 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Fri Mar 09 09:21:31 2007 +0000
+++ b/xen/common/keyhandler.c   Fri Mar 09 11:11:59 2007 +0000
@@ -47,7 +47,7 @@ void handle_keypress(unsigned char key, 
 {
     irq_keyhandler_t *h;
 
-    if ( key_table[key].flags & KEYHANDLER_IRQ_CALLBACK )
+    if ( !in_irq() || (key_table[key].flags & KEYHANDLER_IRQ_CALLBACK) )
     {
         console_start_log_everything();
         if ( (h = key_table[key].u.irq_handler) != NULL )
diff -r a67d3fbd4577 -r 7ab04fa25d52 xen/common/sysctl.c
--- a/xen/common/sysctl.c       Fri Mar 09 09:21:31 2007 +0000
+++ b/xen/common/sysctl.c       Fri Mar 09 11:11:59 2007 +0000
@@ -18,6 +18,7 @@
 #include <xen/console.h>
 #include <xen/iocap.h>
 #include <xen/guest_access.h>
+#include <xen/keyhandler.h>
 #include <asm/current.h>
 #include <public/sysctl.h>
 
@@ -121,6 +122,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
     break;
 #endif
 
+    case XEN_SYSCTL_debug_keys:
+    {
+        char c;
+        uint32_t i;
+
+        for ( i = 0; i < op->u.debug_keys.nr_keys; i++ )
+        {
+            if ( copy_from_guest_offset(&c, op->u.debug_keys.keys, i, 1) )
+                return -EFAULT;
+            handle_keypress(c, guest_cpu_user_regs());
+        }
+    }
+    break;
+
     default:
         ret = arch_do_sysctl(op, u_sysctl);
         break;
diff -r a67d3fbd4577 -r 7ab04fa25d52 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Fri Mar 09 09:21:31 2007 +0000
+++ b/xen/include/public/sysctl.h       Fri Mar 09 11:11:59 2007 +0000
@@ -140,6 +140,18 @@ typedef struct xen_sysctl_getdomaininfol
 typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
 
+/*
+ * Inject debug keys into Xen.
+ */
+#define XEN_SYSCTL_debug_keys        7
+struct xen_sysctl_debug_keys {
+    /* IN variables. */
+    XEN_GUEST_HANDLE_64(char) keys;
+    uint32_t nr_keys;
+};
+typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
+
 struct xen_sysctl {
     uint32_t cmd;
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
@@ -150,6 +162,7 @@ struct xen_sysctl {
         struct xen_sysctl_sched_id          sched_id;
         struct xen_sysctl_perfc_op          perfc_op;
         struct xen_sysctl_getdomaininfolist getdomaininfolist;
+        struct xen_sysctl_debug_keys        debug_keys;
         uint8_t                             pad[128];
     } u;
 };

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xm: New command 'debug-keys' to inject debug-key events into Xen., Xen patchbot-unstable <=