Skip to contentSkip to conversation

Windows 2003 server crashdump suppprt

RFC PATCH New Masaki Kanno 1 participant 5 messages Dec 4, 2006 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

cover Windows 2003 server crashdump suppprt

Hi all,

These patches are able to collect a crashdump of Windows 2003 server on HVM domain on ia64.

In the ia64 machine, there is an INIT switch. By pushing the INIT switch, an INIT interruption is generated. The INIT interruption triggers off when the Windows 2003 server collects the crashdump.

Currently, we don't provide a virtual INIT switch. Therefore, Windows 2003 server on HVM domain is not able to collect the crashdump. We provide a new xm command as the virtual INIT switch.

The new xm command: xm os-init <Domain>

Best regards,
Kan

#1 lore raw

RFC PATCH 1/4 Windows 2003 server crashdump suppprt

[1/4]

Tools side.

tools/libxc/xc_domain.c +13 -0
diff -r 3bd721db6db5 tools/libxc/xc_domain.c
@@ -540,6 +540,19 @@ int xc_domain_iomem_permission(int xc_ha
     domctl.u.iomem_permission.allow_access = allow_access;
 
     return do_domctl(xc_handle, &domctl);
+}
+
+int xc_domain_send_init(int xc_handle,
+                        uint32_t domid)
+{
+#ifdef __ia64__
+    DECLARE_DOMCTL;
+    domctl.cmd = XEN_DOMCTL_send_init;
+    domctl.domain = (domid_t)domid;
+    return do_domctl(xc_handle, &domctl);
+#else
+    return -1;
+#endif
 }
 
 /*
tools/libxc/xenctrl.h +10 -0
diff -r 3bd721db6db5 tools/libxc/xenctrl.h
@@ -374,6 +374,16 @@ int xc_sched_credit_domain_get(int xc_ha
                                uint32_t domid,
                                struct xen_domctl_sched_credit *sdom);
 
+/**
+ * This function sends INIT interruption to a HVM domain of ia64.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm domid the domain id to send 
+ * return 0 on success, -1 on failure
+ */
+int xc_domain_send_init(int xc_handle,
+                        uint32_t domid);
+
 /*
  * EVENT CHANNEL FUNCTIONS
  */
tools/python/xen/lowlevel/xc/xc.c +12 -0
diff -r 3bd721db6db5 tools/python/xen/lowlevel/xc/xc.c
@@ -861,6 +861,11 @@ static PyObject *pyxc_domain_set_time_of
     return zero;
 }
 
+static PyObject *pyxc_domain_send_init(XcObject *self, PyObject *args)
+{
+    return dom_op(self, args, xc_domain_send_init);
+}
+
 static PyObject *dom_op(XcObject *self, PyObject *args,
                         int (*fn)(int, uint32_t))
 {
@@ -1172,6 +1177,13 @@ static PyMethodDef pyxc_methods[] = {
       METH_VARARGS, "\n"
       "Set a domain's time offset to Dom0's localtime\n"
       " dom        [int]: Domain whose time offset is being set.\n"
+      "Returns: [int] 0 on success; -1 on error.\n" },
+
+    { "domain_send_init", 
+      (PyCFunction)pyxc_domain_send_init, 
+      METH_VARARGS, "\n"
+      "Send INIT interruption to a domain.\n"
+      " dom [int]: Identifier of domain to be sent INIT interruption.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
     { NULL, NULL, 0, NULL }
tools/python/xen/xend/XendDomain.py +28 -0
diff -r 3bd721db6db5 tools/python/xen/xend/XendDomain.py
@@ -44,6 +44,7 @@ from xen.xend.XendDevices import XendDev
 from xen.xend.XendDevices import XendDevices
 
 from xen.xend.xenstore.xstransact import xstransact
+from xen.xend.xenstore.xsutil import GetDomainPath
 from xen.xend.xenstore.xswatch import xswatch
 from xen.util import mkdir, security
 from xen.xend import uuid
@@ -1378,6 +1379,33 @@ class XendDomain:
         except Exception, ex:
             raise XendError(str(ex))
 
+    def domain_send_init(self, domid):
+        """Send INIT interruption to a domain for ia64.
+
+        @param domid: Domain ID or Name
+        @type domid: int or string.
+        @raise XendError: failed to send INIT interruption
+        @raise XendInvalidDomain: Domain is not valid        
+        @rtype: 0
+        """
+        mch = os.uname()[4]
+        if mch != 'ia64':
+            raise XendError("This command is Xen/ia64 only")
+
+        dominfo = self.domain_lookup_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
+
+        vmpath = xstransact.Read(GetDomainPath(dominfo.getDomid()), "vm")
+        ostype = xstransact.Read(vmpath, "image/ostype")
+        if ostype != 'hvm':
+            raise XendError("This command is HVM domain only")
+
+        try:
+            return xc.domain_send_init(dominfo.getDomid())
+        except Exception, ex:
+            raise XendError(str(ex))
+    
 
 def instance():
     """Singleton constructor. Use this instead of the class constructor.
tools/python/xen/xm/main.py +8 -0
diff -r 3bd721db6db5 tools/python/xen/xm/main.py
@@ -124,6 +124,7 @@ SUBCOMMAND_HELP = {
     'vcpu-set'    : ('<Domain> <vCPUs>',
                      'Set the number of active VCPUs for allowed for the'
                      ' domain.'),
+    'os-init'     : ('<Domain>', 'Send a INIT to a domain.'),
 
     # device commands
 
@@ -256,6 +257,7 @@ domain_commands = [
     "mem-max",
     "mem-set",
     "migrate",
+    "os-init",
     "pause",
     "reboot",
     "rename",
@@ -1174,6 +1176,11 @@ def xm_sysrq(args):
     req = args[1]
     server.xend.domain.send_sysrq(dom, req)    
 
+def xm_osinit(args):
+    arg_check(args, "os-init", 1)
+    dom = args[0]
+    server.xend.domain.send_init(dom)
+
 def xm_top(args):
     arg_check(args, "top", 0)
 
@@ -1486,6 +1493,7 @@ commands = {
     "uptime": xm_uptime,
     "suspend": xm_suspend,
     "list": xm_list,
+    "os-init": xm_osinit,
     # memory commands
     "mem-max": xm_mem_max,
     "mem-set": xm_mem_set,

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

#2 lore raw

RFC PATCH 2/4 Windows 2003 server crashdump suppprt

In reply to Masaki Kanno

[2/4]

Xen common side.

xen/include/public/domctl.h +7 -0
diff -r 3bd721db6db5 xen/include/public/domctl.h
@@ -355,12 +355,14 @@ typedef struct xen_domctl_ioport_permiss
 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
 
+
 #define XEN_DOMCTL_hypercall_init    22
 struct xen_domctl_hypercall_init {
     uint64_t  gmfn;            /* GMFN to be initialised */
 };
 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
+
 
 #define XEN_DOMCTL_arch_setup        23
 #define _XEN_DOMAINSETUP_hvm_guest 0
@@ -378,12 +380,17 @@ typedef struct xen_domctl_arch_setup {
 } xen_domctl_arch_setup_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
 
+
 #define XEN_DOMCTL_settimeoffset     24
 struct xen_domctl_settimeoffset {
     int32_t  time_offset_seconds; /* applied to domain wallclock time */
 };
 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
+
+
+#define XEN_DOMCTL_send_init         26
+
 
 struct xen_domctl {
     uint32_t cmd;

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

#3 lore raw

RFC PATCH 3/4 Windows 2003 server crashdump suppprt

In reply to Masaki Kanno

[3/4]

Xen arch/ia64 side.

xen/arch/ia64/vmx/mmio.c +9 -1
diff -r 3bd721db6db5 xen/arch/ia64/vmx/mmio.c
@@ -386,7 +386,7 @@ memread_p(VCPU *vcpu, u64 *src, u64 *des
  */
 #define PAL_INIT_ENTRY 0x80000000ffffffa0
 #define PSR_SET_BITS (IA64_PSR_DT | IA64_PSR_IT | IA64_PSR_RT |	\
-                      IA64_PSR_IC | IA64_PSR_RI)
+                      IA64_PSR_IC | IA64_PSR_RI | IA64_PSR_I)
 
 static void vmx_inject_guest_pal_init(VCPU *vcpu)
 {
@@ -433,6 +433,14 @@ static void deliver_ipi (VCPU *vcpu, uin
         panic_domain (NULL, "Deliver reserved IPI!\n");
         break;
     }
+}
+
+/*
+ * Deliver the INIT interruption to guest.
+ */
+void deliver_pal_init(VCPU *vcpu)
+{
+    deliver_ipi(vcpu, 5, 0);
 }
 
 /*
xen/arch/ia64/vmx/vlsapic.c +12 -0
diff -r 3bd721db6db5 xen/arch/ia64/vmx/vlsapic.c
@@ -586,6 +586,18 @@ chk_irq_exit:
 }
 
 /*
+ * Set a INIT interruption request to vcpu[0] of target domain.
+ * The INIT interruption is injected into each vcpu by guest firmware.
+ */
+vmx_pend_pal_init(struct domain *d)
+{
+    VCPU *vcpu;
+
+    vcpu = d->vcpu[0];
+    vcpu->arch.arch_vmx.pal_init_pending = 1;
+}
+
+/*
  * Only coming from virtualization fault.
  */
 void guest_write_eoi(VCPU *vcpu)
xen/arch/ia64/vmx/vmx_process.c +6 -0
diff -r 3bd721db6db5 xen/arch/ia64/vmx/vmx_process.c
@@ -225,6 +225,12 @@ void leave_hypervisor_tail(struct pt_reg
         if (v->vcpu_id == 0) {
             int callback_irq =
                 d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
+            if ( v->arch.arch_vmx.pal_init_pending ) {
+                /*inject INIT interruption to guest pal*/
+                v->arch.arch_vmx.pal_init_pending = 0;
+                deliver_pal_init(v);
+                return;
+            }
             if (callback_irq != 0 && local_events_need_delivery()) {
                 /*inject para-device call back irq*/
                 v->vcpu_info->evtchn_upcall_mask = 1;
xen/arch/ia64/xen/dom0_ops.c +14 -0
diff -r 3bd721db6db5 xen/arch/ia64/xen/dom0_ops.c
@@ -170,6 +170,20 @@ long arch_do_domctl(xen_domctl_t *op, XE
         put_domain(d);
     }
     break;
+
+    case XEN_DOMCTL_send_init:
+    {
+        struct domain *d = find_domain_by_id(op->domain);
+
+        if ( d == NULL ) {
+            ret = -ESRCH;
+            break;
+        }
+        vmx_pend_pal_init(d);
+        put_domain(d);
+    }
+    break;
+
     default:
         printk("arch_do_domctl: unrecognized domctl: %d!!!\n",op->cmd);
         ret = -ENOSYS;
xen/include/asm-ia64/vmx.h +2 -0
diff -r 3bd721db6db5 xen/include/asm-ia64/vmx.h
@@ -56,6 +56,8 @@ extern void vmx_die_if_kernel(char *str,
 extern void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err);
 extern void vmx_send_assist_req(struct vcpu *v);
 extern void vmx_vioapic_set_irq(struct domain *d, int irq, int level);
+extern void deliver_pal_init(struct vcpu *vcpu);
+extern void vmx_pend_pal_init(struct domain *d);
 
 static inline vcpu_iodata_t *get_vio(struct domain *d, unsigned long cpu)
 {
xen/include/asm-ia64/vmx_vpd.h +1 -0
diff -r 3bd721db6db5 xen/include/asm-ia64/vmx_vpd.h
@@ -104,6 +104,7 @@ struct arch_vmx_struct {
 //	unsigned long	in_service[4];	// vLsapic inservice IRQ bits
     unsigned long   flags;
     unsigned long   xen_port;
+    char pal_init_pending;
 #ifdef VTI_DEBUG
     unsigned long  ivt_current;
     struct ivt_debug ivt_debug[IVT_DEBUG_MAX];

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

#4 lore raw

RFC PATCH 4/4 Windows 2003 server crashdump suppprt

In reply to Masaki Kanno

[4/4]

Linux side.

linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c +1 -0
diff -r 3bd721db6db5 linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c
@@ -303,6 +303,7 @@ xencomm_privcmd_domctl(privcmd_hypercall
 	case XEN_DOMCTL_hypercall_init:
 	case XEN_DOMCTL_arch_setup:
 	case XEN_DOMCTL_settimeoffset:
+	case XEN_DOMCTL_send_init:
 		break;
 	default:
 		printk("%s: unknown domctl cmd %d\n", __func__, kern_op.cmd);

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