Skip to contentSkip to conversation

remove domu_debug option

PATCH New Kip Macy 1 participant 2 messages Dec 4, 2005 – Dec 8, 2005

lore
Share & tools
lore

Kip Macy

author
#0 lore raw

PATCH 1/1 remove domu_debug option

add ptraced bit to domains to make domu debug a run-time option

I left fsmware.com misspelled because I wasn't sure if the changeset was checksummed and reverting is too much of a headache when I'm sure you'll want some things changed anyway.

Thanks.

-Kip

# HG changeset patch
# User [email protected]
# Node ID 83c1b3dbd1292abe3038a2dbac233b144bf5794d
# Parent 60955b616ca60a0e55f7f956f9e3f418f5bc1f5f
add ptraced bit for domains to make domu debugging a run-time option

tools/libxc/xc_ptrace.c +16 -6
diff -r 60955b616ca6 -r 83c1b3dbd129 tools/libxc/xc_ptrace.c
@@ -344,8 +344,6 @@
     int             cpu, index;
     void           *addr = (char *)eaddr;
     void           *data = (char *)edata;
-
-    op.interface_version = DOM0_INTERFACE_VERSION;
 
     cpu = (request != PTRACE_ATTACH) ? domid_tid : 0;
     
@@ -434,6 +432,13 @@
                 }
             }
         }
+        if ( request == PTRACE_DETACH )
+        {
+            op.cmd = DOM0_SETPTRACE;
+            op.u.setptrace.domain = current_domid;
+            op.u.setptrace.enable = 0;
+            retval = do_dom0_op(xc_handle, &op);
+        }
         regs_valid = 0;
         xc_domain_unpause(xc_handle, current_domid > 0 ? current_domid : -current_domid);
         break;
@@ -453,10 +458,15 @@
             printf("domain currently paused\n");
         } else
             retval = xc_domain_pause(xc_handle, current_domid);
-    if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
-        printf("get_online_cpumap failed\n");
-    if (online_cpumap != cpumap)
-        online_vcpus_changed(cpumap);
+        op.cmd = DOM0_SETPTRACE;
+        op.u.setptrace.domain = current_domid;
+        op.u.setptrace.enable = 1;
+        retval = do_dom0_op(xc_handle, &op);
+
+        if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
+            printf("get_online_cpumap failed\n");
+        if (online_cpumap != cpumap)
+            online_vcpus_changed(cpumap);
         break;
 
     case PTRACE_SETFPREGS:
xen/common/dom0_ops.c +16 -0
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/common/dom0_ops.c
@@ -570,6 +570,22 @@
         }
     }
     break;
+    case DOM0_SETPTRACE:
+    {
+        struct domain *d; 
+        ret = -ESRCH;
+        d = find_domain_by_id(op->u.setptrace.domain);
+        if ( d != NULL )
+        {
+            if (op->u.setptrace.enable)
+                set_bit(_DOMF_ptraced, &d->domain_flags);
+            else
+                clear_bit(_DOMF_ptraced, &d->domain_flags);
+            put_domain(d);
+            ret = 0;
+        }
+    }
+    break;
 
 #ifdef PERF_COUNTERS
     case DOM0_PERFCCONTROL:
xen/include/asm-x86/debugger.h +48 -28

97 lines not on this page · raw message

xen/include/public/dom0_ops.h +8 -1
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/include/public/dom0_ops.h
@@ -403,6 +403,12 @@
     domid_t domain;
     xen_domain_handle_t handle;
 } dom0_setdomainhandle_t;
+
+#define DOM0_SETPTRACE 45
+typedef struct {
+    domid_t domain;
+    uint8_t enable;
+} dom0_setptrace_t;
 
 typedef struct {
     uint32_t cmd;
@@ -440,7 +446,8 @@
         dom0_platform_quirk_t    platform_quirk;
         dom0_physical_memory_map_t physical_memory_map;
         dom0_max_vcpus_t         max_vcpus;
-        dom0_setdomainhandle_t   setdomainhandle;
+        dom0_setdomainhandle_t   setdomainhandle;        
+        dom0_setptrace_t         setptrace;
         uint8_t                  pad[128];
     } u;
 } dom0_op_t;
xen/include/xen/sched.h +4 -0
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/include/xen/sched.h
@@ -393,6 +393,10 @@
  /* Domain is paused by controller software. */
 #define _DOMF_ctrl_pause       6
 #define DOMF_ctrl_pause        (1UL<<_DOMF_ctrl_pause)
+ /* Domain is paused by controller software. */
+#define _DOMF_ptraced          7
+#define DOMF_ptraced           (1UL<<_DOMF_ptraced)
+
 
 static inline int domain_runnable(struct vcpu *v)
 {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#1 lore raw

PATCH 1/1 remove domu_debug option

re-submit

---------- Forwarded message ----------
From: Kip Macy <[email protected]>
Date: Dec 4, 2005 5:43 PM
Subject: [PATCH] remove domu_debug option
To: xen-devel <[email protected]>

add ptraced bit to domains to make domu debug a run-time option

I left fsmware.com misspelled because I wasn't sure if the changeset was checksummed and reverting is too much of a headache when I'm sure you'll want some things changed anyway.

Thanks.

-Kip

# HG changeset patch
# User [email protected]
# Node ID 83c1b3dbd1292abe3038a2dbac233b144bf5794d
# Parent 60955b616ca60a0e55f7f956f9e3f418f5bc1f5f
add ptraced bit for domains to make domu debugging a run-time option

tools/libxc/xc_ptrace.c +16 -6
diff -r 60955b616ca6 -r 83c1b3dbd129 tools/libxc/xc_ptrace.c
@@ -344,8 +344,6 @@
     int             cpu, index;
     void           *addr = (char *)eaddr;
     void           *data = (char *)edata;
-
-    op.interface_version = DOM0_INTERFACE_VERSION;
 
     cpu = (request != PTRACE_ATTACH) ? domid_tid : 0;
     
@@ -434,6 +432,13 @@
                 }
             }
         }
+        if ( request == PTRACE_DETACH )
+        {
+            op.cmd = DOM0_SETPTRACE;
+            op.u.setptrace.domain = current_domid;
+            op.u.setptrace.enable = 0;
+            retval = do_dom0_op(xc_handle, &op);
+        }
         regs_valid = 0;
         xc_domain_unpause(xc_handle, current_domid > 0 ? current_domid : -current_domid);
         break;
@@ -453,10 +458,15 @@
             printf("domain currently paused\n");
         } else
             retval = xc_domain_pause(xc_handle, current_domid);
-    if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
-        printf("get_online_cpumap failed\n");
-    if (online_cpumap != cpumap)
-        online_vcpus_changed(cpumap);
+        op.cmd = DOM0_SETPTRACE;
+        op.u.setptrace.domain = current_domid;
+        op.u.setptrace.enable = 1;
+        retval = do_dom0_op(xc_handle, &op);
+
+        if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
+            printf("get_online_cpumap failed\n");
+        if (online_cpumap != cpumap)
+            online_vcpus_changed(cpumap);
         break;
 
     case PTRACE_SETFPREGS:
xen/common/dom0_ops.c +16 -0
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/common/dom0_ops.c
@@ -570,6 +570,22 @@
         }
     }
     break;
+    case DOM0_SETPTRACE:
+    {
+        struct domain *d; 
+        ret = -ESRCH;
+        d = find_domain_by_id(op->u.setptrace.domain);
+        if ( d != NULL )
+        {
+            if (op->u.setptrace.enable)
+                set_bit(_DOMF_ptraced, &d->domain_flags);
+            else
+                clear_bit(_DOMF_ptraced, &d->domain_flags);
+            put_domain(d);
+            ret = 0;
+        }
+    }
+    break;
 
 #ifdef PERF_COUNTERS
     case DOM0_PERFCCONTROL:
xen/include/asm-x86/debugger.h +48 -28

97 lines not on this page · raw message

xen/include/public/dom0_ops.h +8 -1
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/include/public/dom0_ops.h
@@ -403,6 +403,12 @@
     domid_t domain;
     xen_domain_handle_t handle;
 } dom0_setdomainhandle_t;
+
+#define DOM0_SETPTRACE 45
+typedef struct {
+    domid_t domain;
+    uint8_t enable;
+} dom0_setptrace_t;
 
 typedef struct {
     uint32_t cmd;
@@ -440,7 +446,8 @@
         dom0_platform_quirk_t    platform_quirk;
         dom0_physical_memory_map_t physical_memory_map;
         dom0_max_vcpus_t         max_vcpus;
-        dom0_setdomainhandle_t   setdomainhandle;
+        dom0_setdomainhandle_t   setdomainhandle;        
+        dom0_setptrace_t         setptrace;
         uint8_t                  pad[128];
     } u;
 } dom0_op_t;
xen/include/xen/sched.h +4 -0
diff -r 60955b616ca6 -r 83c1b3dbd129 xen/include/xen/sched.h
@@ -393,6 +393,10 @@
  /* Domain is paused by controller software. */
 #define _DOMF_ctrl_pause       6
 #define DOMF_ctrl_pause        (1UL<<_DOMF_ctrl_pause)
+ /* Domain is paused by controller software. */
+#define _DOMF_ptraced          7
+#define DOMF_ptraced           (1UL<<_DOMF_ptraced)
+
 
 static inline int domain_runnable(struct vcpu *v)
 {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel