direct-io.hg

changeset 14311:c75d1acd18c8

Merge
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Mar 09 11:14:03 2007 +0000 (2007-03-09)
parents c9dba7b35393 7ab04fa25d52
children 8af1a8250c13 b46a92ba0b61
files
line diff
     1.1 --- a/tools/libxc/xc_misc.c	Fri Mar 09 11:11:23 2007 +0000
     1.2 +++ b/tools/libxc/xc_misc.c	Fri Mar 09 11:14:03 2007 +0000
     1.3 @@ -33,6 +33,25 @@ int xc_readconsolering(int xc_handle,
     1.4      return ret;
     1.5  }
     1.6  
     1.7 +int xc_send_debug_keys(int xc_handle, char *keys)
     1.8 +{
     1.9 +    int ret, len = strlen(keys);
    1.10 +    DECLARE_SYSCTL;
    1.11 +
    1.12 +    sysctl.cmd = XEN_SYSCTL_debug_keys;
    1.13 +    set_xen_guest_handle(sysctl.u.debug_keys.keys, keys);
    1.14 +    sysctl.u.debug_keys.nr_keys = len;
    1.15 +
    1.16 +    if ( (ret = lock_pages(keys, len)) != 0 )
    1.17 +        return ret;
    1.18 +
    1.19 +    ret = do_sysctl(xc_handle, &sysctl);
    1.20 +
    1.21 +    unlock_pages(keys, len);
    1.22 +
    1.23 +    return ret;
    1.24 +}
    1.25 +
    1.26  int xc_physinfo(int xc_handle,
    1.27                  xc_physinfo_t *put_info)
    1.28  {
     2.1 --- a/tools/libxc/xenctrl.h	Fri Mar 09 11:11:23 2007 +0000
     2.2 +++ b/tools/libxc/xenctrl.h	Fri Mar 09 11:14:03 2007 +0000
     2.3 @@ -467,6 +467,8 @@ int xc_readconsolering(int xc_handle,
     2.4                         unsigned int *pnr_chars,
     2.5                         int clear);
     2.6  
     2.7 +int xc_send_debug_keys(int xc_handle, char *keys);
     2.8 +
     2.9  typedef xen_sysctl_physinfo_t xc_physinfo_t;
    2.10  int xc_physinfo(int xc_handle,
    2.11                  xc_physinfo_t *info);
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Mar 09 11:11:23 2007 +0000
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Mar 09 11:14:03 2007 +0000
     3.3 @@ -1007,6 +1007,24 @@ static PyObject *pyxc_domain_send_trigge
     3.4      return zero;
     3.5  }
     3.6  
     3.7 +static PyObject *pyxc_send_debug_keys(XcObject *self,
     3.8 +                                      PyObject *args,
     3.9 +                                      PyObject *kwds)
    3.10 +{
    3.11 +    char *keys;
    3.12 +
    3.13 +    static char *kwd_list[] = { "keys", NULL };
    3.14 +
    3.15 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list, &keys) )
    3.16 +        return NULL;
    3.17 +
    3.18 +    if ( xc_send_debug_keys(self->xc_handle, keys) != 0 )
    3.19 +        return pyxc_error_to_exception();
    3.20 +
    3.21 +    Py_INCREF(zero);
    3.22 +    return zero;
    3.23 +}
    3.24 +
    3.25  static PyObject *dom_op(XcObject *self, PyObject *args,
    3.26                          int (*fn)(int, uint32_t))
    3.27  {
    3.28 @@ -1420,6 +1438,12 @@ static PyMethodDef pyxc_methods[] = {
    3.29        " vcpu    [int]: VCPU to be sent trigger.\n"
    3.30        "Returns: [int] 0 on success; -1 on error.\n" },
    3.31  
    3.32 +    { "send_debug_keys",
    3.33 +      (PyCFunction)pyxc_send_debug_keys,
    3.34 +      METH_VARARGS | METH_KEYWORDS, "\n"
    3.35 +      "Inject debug keys into Xen.\n"
    3.36 +      " keys    [str]: String of keys to inject.\n" },
    3.37 +
    3.38  #ifdef __powerpc__
    3.39      { "arch_alloc_real_mode_area", 
    3.40        (PyCFunction)pyxc_alloc_real_mode_area, 
     4.1 --- a/tools/python/xen/xend/XendNode.py	Fri Mar 09 11:11:23 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendNode.py	Fri Mar 09 11:14:03 2007 +0000
     4.3 @@ -453,6 +453,12 @@ class XendNode:
     4.4                  return pif.network
     4.5          raise Exception('Bridge %s is not connected to a network' % bridge)
     4.6  
     4.7 +    #
     4.8 +    # Debug keys.
     4.9 +    #
    4.10 +
    4.11 +    def send_debug_keys(self, keys):
    4.12 +        return self.xc.send_debug_keys(keys)
    4.13  
    4.14      #
    4.15      # Getting host information.
     5.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Fri Mar 09 11:11:23 2007 +0000
     5.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Fri Mar 09 11:14:03 2007 +0000
     5.3 @@ -157,7 +157,7 @@ class XMLRPCServer:
     5.4                      self.server.register_function(fn, "xend.domain.%s" % name[7:])
     5.5  
     5.6          # Functions in XendNode and XendDmesg
     5.7 -        for type, lst, n in [(XendNode, ['info'], 'node'),
     5.8 +        for type, lst, n in [(XendNode, ['info', 'send_debug_keys'], 'node'),
     5.9                               (XendDmesg, ['info', 'clear'], 'node.dmesg')]:
    5.10              inst = type.instance()
    5.11              for name in lst:
     6.1 --- a/tools/python/xen/xm/main.py	Fri Mar 09 11:11:23 2007 +0000
     6.2 +++ b/tools/python/xen/xm/main.py	Fri Mar 09 11:14:03 2007 +0000
     6.3 @@ -133,6 +133,7 @@ SUBCOMMAND_HELP = {
     6.4      'sched-credit': ('[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]]',
     6.5                       'Get/set credit scheduler parameters.'),
     6.6      'sysrq'       : ('<Domain> <letter>', 'Send a sysrq to a domain.'),
     6.7 +    'debug-keys'  : ('<Keys>', 'Send debug keys to Xen.'),
     6.8      'trigger'     : ('<Domain> <nmi|reset|init> [<VCPU>]',
     6.9                       'Send a trigger to a domain.'),
    6.10      'vcpu-list'   : ('[<Domain>]',
    6.11 @@ -260,7 +261,6 @@ common_commands = [
    6.12      "shutdown",
    6.13      "start",
    6.14      "suspend",
    6.15 -    "trigger",
    6.16      "top",
    6.17      "unpause",
    6.18      "uptime",
    6.19 @@ -300,6 +300,7 @@ domain_commands = [
    6.20      ]
    6.21  
    6.22  host_commands = [
    6.23 +    "debug-keys",
    6.24      "dmesg",
    6.25      "info",
    6.26      "log",
    6.27 @@ -1395,6 +1396,10 @@ def xm_trigger(args):
    6.28      
    6.29      server.xend.domain.send_trigger(dom, trigger, vcpu)
    6.30  
    6.31 +def xm_debug_keys(args):
    6.32 +    arg_check(args, "debug-keys", 1)
    6.33 +    server.xend.node.send_debug_keys(str(args[0]))
    6.34 +
    6.35  def xm_top(args):
    6.36      arg_check(args, "top", 0)
    6.37  
    6.38 @@ -1738,6 +1743,7 @@ commands = {
    6.39      "pause": xm_pause,
    6.40      "unpause": xm_unpause,
    6.41      # host commands
    6.42 +    "debug-keys": xm_debug_keys,
    6.43      "dmesg": xm_dmesg,
    6.44      "info": xm_info,
    6.45      "log": xm_log,
     7.1 --- a/xen/common/keyhandler.c	Fri Mar 09 11:11:23 2007 +0000
     7.2 +++ b/xen/common/keyhandler.c	Fri Mar 09 11:14:03 2007 +0000
     7.3 @@ -47,7 +47,7 @@ void handle_keypress(unsigned char key, 
     7.4  {
     7.5      irq_keyhandler_t *h;
     7.6  
     7.7 -    if ( key_table[key].flags & KEYHANDLER_IRQ_CALLBACK )
     7.8 +    if ( !in_irq() || (key_table[key].flags & KEYHANDLER_IRQ_CALLBACK) )
     7.9      {
    7.10          console_start_log_everything();
    7.11          if ( (h = key_table[key].u.irq_handler) != NULL )
     8.1 --- a/xen/common/sysctl.c	Fri Mar 09 11:11:23 2007 +0000
     8.2 +++ b/xen/common/sysctl.c	Fri Mar 09 11:14:03 2007 +0000
     8.3 @@ -18,6 +18,7 @@
     8.4  #include <xen/console.h>
     8.5  #include <xen/iocap.h>
     8.6  #include <xen/guest_access.h>
     8.7 +#include <xen/keyhandler.h>
     8.8  #include <asm/current.h>
     8.9  #include <public/sysctl.h>
    8.10  
    8.11 @@ -121,6 +122,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
    8.12      break;
    8.13  #endif
    8.14  
    8.15 +    case XEN_SYSCTL_debug_keys:
    8.16 +    {
    8.17 +        char c;
    8.18 +        uint32_t i;
    8.19 +
    8.20 +        for ( i = 0; i < op->u.debug_keys.nr_keys; i++ )
    8.21 +        {
    8.22 +            if ( copy_from_guest_offset(&c, op->u.debug_keys.keys, i, 1) )
    8.23 +                return -EFAULT;
    8.24 +            handle_keypress(c, guest_cpu_user_regs());
    8.25 +        }
    8.26 +    }
    8.27 +    break;
    8.28 +
    8.29      default:
    8.30          ret = arch_do_sysctl(op, u_sysctl);
    8.31          break;
     9.1 --- a/xen/include/public/sysctl.h	Fri Mar 09 11:11:23 2007 +0000
     9.2 +++ b/xen/include/public/sysctl.h	Fri Mar 09 11:14:03 2007 +0000
     9.3 @@ -140,6 +140,18 @@ struct xen_sysctl_getdomaininfolist {
     9.4  typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
     9.5  DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
     9.6  
     9.7 +/*
     9.8 + * Inject debug keys into Xen.
     9.9 + */
    9.10 +#define XEN_SYSCTL_debug_keys        7
    9.11 +struct xen_sysctl_debug_keys {
    9.12 +    /* IN variables. */
    9.13 +    XEN_GUEST_HANDLE_64(char) keys;
    9.14 +    uint32_t nr_keys;
    9.15 +};
    9.16 +typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
    9.17 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
    9.18 +
    9.19  struct xen_sysctl {
    9.20      uint32_t cmd;
    9.21      uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
    9.22 @@ -150,6 +162,7 @@ struct xen_sysctl {
    9.23          struct xen_sysctl_sched_id          sched_id;
    9.24          struct xen_sysctl_perfc_op          perfc_op;
    9.25          struct xen_sysctl_getdomaininfolist getdomaininfolist;
    9.26 +        struct xen_sysctl_debug_keys        debug_keys;
    9.27          uint8_t                             pad[128];
    9.28      } u;
    9.29  };