[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] merge?



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 813c37b68376f5629df85d663fff6515f8dafa72
# Parent  31c257b9a36025fba57dcd3d0a5fe707785cbd70
# Parent  0c7379b702e5ee663b84705231e96d6800e0e93f
merge?

diff -r 31c257b9a360 -r 813c37b68376 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Sep  9 17:36:39 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Sep  9 17:40:39 2005
@@ -690,6 +690,8 @@
 {
     XcObject *xc = (XcObject *)self;
     xc_physinfo_t info;
+    char cpu_cap[128], *p=cpu_cap, *q=cpu_cap;
+    int i;
     
     if ( !PyArg_ParseTuple(args, "") )
         return NULL;
@@ -697,14 +699,25 @@
     if ( xc_physinfo(xc->xc_handle, &info) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
-    return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
+    *q=0;
+    for(i=0;i<sizeof(info.hw_cap)/4;i++)
+    {
+        p+=sprintf(p,"%08x:",info.hw_cap[i]);
+        if(info.hw_cap[i])
+           q=p;
+    }
+    if(q>cpu_cap)
+        *(q-1)=0;
+
+    return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
                          "threads_per_core", info.threads_per_core,
                          "cores_per_socket", info.cores_per_socket,
                          "sockets_per_node", info.sockets_per_node,
                          "nr_nodes",         info.nr_nodes,
                          "total_pages",      info.total_pages,
                          "free_pages",       info.free_pages,
-                         "cpu_khz",          info.cpu_khz);
+                         "cpu_khz",          info.cpu_khz,
+                         "hw_caps",          cpu_cap);
 }
 
 static PyObject *pyxc_xeninfo(PyObject *self,
@@ -715,7 +728,10 @@
     xen_extraversion_t xen_extra;
     xen_compile_info_t xen_cc;
     xen_changeset_info_t xen_chgset;
+    xen_capabilities_info_t xen_caps;
+    xen_parameters_info_t xen_parms;
     long xen_version;
+    char str[128];
 
     xen_version = xc_version(xc->xc_handle, XENVER_version, NULL);
 
@@ -728,10 +744,20 @@
     if ( xc_version(xc->xc_handle, XENVER_changeset, &xen_chgset) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
-    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
+    if ( xc_version(xc->xc_handle, XENVER_capabilities, &xen_caps) != 0 )
+        return PyErr_SetFromErrno(xc_error);
+
+    if ( xc_version(xc->xc_handle, XENVER_parameters, &xen_parms) != 0 )
+        return PyErr_SetFromErrno(xc_error);
+
+    sprintf(str,"virt_start=0x%lx",xen_parms.virt_start);
+
+    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}",
                          "xen_major", xen_version >> 16,
                          "xen_minor", (xen_version & 0xffff),
                          "xen_extra", xen_extra,
+                         "xen_caps",  xen_caps,
+                         "xen_params", str,
                          "xen_changeset", xen_chgset,
                          "cc_compiler", xen_cc.compiler,
                          "cc_compile_by", xen_cc.compile_by,
diff -r 31c257b9a360 -r 813c37b68376 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Fri Sep  9 17:36:39 2005
+++ b/tools/python/xen/xend/XendNode.py Fri Sep  9 17:40:39 2005
@@ -58,20 +58,26 @@
 
     def physinfo(self):
         pinfo = self.xc.physinfo()
-        info = [['cores_per_socket', pinfo['cores_per_socket']],
+        info = [['nr_cpus',          
pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']],
+                ['nr_nodes',         pinfo['nr_nodes']],
+                ['sockets_per_node', pinfo['sockets_per_node']],
+                ['cores_per_socket', pinfo['cores_per_socket']],
                 ['threads_per_core', pinfo['threads_per_core']],
-                ['cpu_mhz', pinfo['cpu_khz']/1000],
-                ['memory', pinfo['total_pages']/256],
-                ['free_memory', pinfo['free_pages']/256]]
+                ['cpu_mhz',          pinfo['cpu_khz']/1000],
+                ['hw_caps',          pinfo['hw_caps']],
+                ['memory',           pinfo['total_pages']/256],
+                ['free_memory',      pinfo['free_pages']/256]]
         return info
         
     def xeninfo(self):
         xinfo = self.xc.xeninfo()
-       return [['xen_major', xinfo['xen_major']],
-               ['xen_minor', xinfo['xen_minor']],
-               ['xen_extra', xinfo['xen_extra']],
-               ['xen_changeset', xinfo['xen_changeset']],
-               ['cc_compiler', xinfo['cc_compiler']],
+        return [['xen_major', xinfo['xen_major']],
+                ['xen_minor', xinfo['xen_minor']],
+                ['xen_extra', xinfo['xen_extra']],
+                ['xen_caps',  xinfo['xen_caps']],
+                ['xen_params',xinfo['xen_params']],
+                ['xen_changeset', xinfo['xen_changeset']],
+                ['cc_compiler', xinfo['cc_compiler']],
                 ['cc_compile_by', xinfo['cc_compile_by']],
                 ['cc_compile_domain', xinfo['cc_compile_domain']],
                 ['cc_compile_date', xinfo['cc_compile_date']]]
diff -r 31c257b9a360 -r 813c37b68376 xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c   Fri Sep  9 17:36:39 2005
+++ b/xen/arch/x86/dom0_ops.c   Fri Sep  9 17:40:39 2005
@@ -19,6 +19,7 @@
 #include <xen/console.h>
 #include <asm/shadow.h>
 #include <asm/irq.h>
+#include <asm/processor.h>
 #include <public/sched_ctl.h>
 
 #include <asm/mtrr.h>
@@ -34,13 +35,13 @@
 
 static void write_msr_for(void *unused)
 {
-    if (((1 << current->processor) & msr_cpu_mask))
+    if ( ((1 << current->processor) & msr_cpu_mask) )
         (void)wrmsr_user(msr_addr, msr_lo, msr_hi);
 }
 
 static void read_msr_for(void *unused)
 {
-    if (((1 << current->processor) & msr_cpu_mask))
+    if ( ((1 << current->processor) & msr_cpu_mask) )
         (void)rdmsr_user(msr_addr, msr_lo, msr_hi);
 }
 
@@ -188,9 +189,11 @@
         pi->total_pages      = max_page;
         pi->free_pages       = avail_domheap_pages();
         pi->cpu_khz          = cpu_khz;
-
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
+        memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
         ret = 0;
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+           ret = -EFAULT;
     }
     break;
     
diff -r 31c257b9a360 -r 813c37b68376 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Sep  9 17:36:39 2005
+++ b/xen/arch/x86/mm.c Fri Sep  9 17:40:39 2005
@@ -3185,7 +3185,7 @@
     struct pfn_info *page;
     l1_pgentry_t     pte;
     l2_pgentry_t    *pl2e, l2e;
-    int              which;
+    int              which, flags;
     unsigned long    l2_idx;
 
     if ( unlikely(shadow_mode_enabled(d)) )
@@ -3206,8 +3206,24 @@
     pfn  = l1e_get_pfn(pte);
     page = &frame_table[pfn];
 
+#ifdef CONFIG_X86_64
+#define WRPT_PTE_FLAGS (_PAGE_RW | _PAGE_PRESENT | _PAGE_USER)
+#else
+#define WRPT_PTE_FLAGS (_PAGE_RW | _PAGE_PRESENT)
+#endif
+
+    /*
+     * Check the required flags for a valid wrpt mapping. If the page is
+     * already writable then we can return straight to the guest (SMP race).
+     * We decide whether or not to propagate the fault by testing for write
+     * permissions in page directories by writing back to the linear mapping.
+     */
+    if ( (flags = l1e_get_flags(pte) & WRPT_PTE_FLAGS) == WRPT_PTE_FLAGS )
+        return !__put_user(
+            pte.l1, &linear_pg_table[l1_linear_offset(addr)].l1);
+
     /* We are looking only for read-only mappings of p.t. pages. */
-    if ( ((l1e_get_flags(pte) & (_PAGE_RW|_PAGE_PRESENT)) != _PAGE_PRESENT) ||
+    if ( ((flags | _PAGE_RW) != WRPT_PTE_FLAGS) ||
          ((page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table) ||
          ((page->u.inuse.type_info & PGT_count_mask) == 0) ||
          (page_get_owner(page) != d) )
diff -r 31c257b9a360 -r 813c37b68376 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Fri Sep  9 17:36:39 2005
+++ b/xen/arch/x86/setup.c      Fri Sep  9 17:40:39 2005
@@ -12,6 +12,8 @@
 #include <xen/trace.h>
 #include <xen/multiboot.h>
 #include <xen/domain_page.h>
+#include <xen/compile.h>
+#include <public/version.h>
 #include <asm/bitops.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
@@ -529,6 +531,46 @@
     startup_cpu_idle_loop();
 }
 
+void arch_get_xen_caps(xen_capabilities_info_t info)
+{
+    char *p = info;
+
+#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
+
+    p += sprintf(p, "xen_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
+    if ( hvm_enabled )
+        p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
+
+#elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
+
+    p += sprintf(p, "xen_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
+    if ( hvm_enabled )
+    {
+        //p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
+        //p += sprintf(p, "hvm_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
+    }
+
+#elif defined(CONFIG_X86_64)
+
+    p += sprintf(p, "xen_%d.%d_x86_64 ", XEN_VERSION, XEN_SUBVERSION);
+    if ( hvm_enabled )
+    {
+        //p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
+        //p += sprintf(p, "hvm_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
+        p += sprintf(p, "hvm_%d.%d_x86_64 ", XEN_VERSION, XEN_SUBVERSION);
+    }
+
+#else
+
+    p++;
+
+#endif
+    
+    *(p-1) = 0;
+
+    BUG_ON((p - info) > sizeof(info));
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 31c257b9a360 -r 813c37b68376 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Fri Sep  9 17:36:39 2005
+++ b/xen/arch/x86/traps.c      Fri Sep  9 17:40:39 2005
@@ -470,20 +470,32 @@
     return EXCRET_fault_fixed;
 }
 
-asmlinkage int do_page_fault(struct cpu_user_regs *regs)
-{
-    unsigned long addr, fixup;
-    struct vcpu *v = current;
+#ifdef HYPERVISOR_VIRT_END
+#define IN_HYPERVISOR_RANGE(va) \
+    (((va) >= HYPERVISOR_VIRT_START) && ((va) < HYPERVISOR_VIRT_END))
+#else
+#define IN_HYPERVISOR_RANGE(va) \
+    (((va) >= HYPERVISOR_VIRT_START))
+#endif
+
+static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
+{
+    struct vcpu   *v = current;
     struct domain *d = v->domain;
 
-    __asm__ __volatile__ ("mov %%cr2,%0" : "=r" (addr) : );
-
-    DEBUGGER_trap_entry(TRAP_page_fault, regs);
-
-    perfc_incrc(page_faults);
-
-    if ( likely(VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
-                !shadow_mode_enabled(d)) )
+    if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
+    {
+        if ( shadow_mode_external(d) && GUEST_CONTEXT(v, regs) )
+            return shadow_fault(addr, regs);
+        if ( (addr >= PERDOMAIN_VIRT_START) && (addr < PERDOMAIN_VIRT_END) )
+            return handle_perdomain_mapping_fault(
+                addr - PERDOMAIN_VIRT_START, regs);
+    }
+    else if ( unlikely(shadow_mode_enabled(d)) )
+    {
+        return shadow_fault(addr, regs);
+    }
+    else if ( likely(VM_ASSIST(d, VMASST_TYPE_writable_pagetables)) )
     {
         LOCK_BIGLOCK(d);
         if ( unlikely(d->arch.ptwr[PTWR_PT_ACTIVE].l1va) &&
@@ -495,14 +507,9 @@
             return EXCRET_fault_fixed;
         }
 
-        if ( ((addr < HYPERVISOR_VIRT_START) 
-#if defined(__x86_64__)
-              || (addr >= HYPERVISOR_VIRT_END)
-#endif        
-            )     
-             &&
-             KERNEL_MODE(v, regs) &&
-             ((regs->error_code & 3) == 3) && /* write-protection fault */
+        if ( KERNEL_MODE(v, regs) &&
+             /* Protection violation on write? No reserved-bit violation? */
+             ((regs->error_code & 0xb) == 0x3) &&
              ptwr_do_page_fault(d, addr, regs) )
         {
             UNLOCK_BIGLOCK(d);
@@ -511,43 +518,51 @@
         UNLOCK_BIGLOCK(d);
     }
 
-    if ( unlikely(shadow_mode_enabled(d)) &&
-         ((addr < HYPERVISOR_VIRT_START) ||
-#if defined(__x86_64__)
-          (addr >= HYPERVISOR_VIRT_END) ||
-#endif
-          (shadow_mode_external(d) && GUEST_CONTEXT(v, regs))) &&
-         shadow_fault(addr, regs) )
-        return EXCRET_fault_fixed;
-
-    if ( unlikely(addr >= PERDOMAIN_VIRT_START) &&
-         unlikely(addr < PERDOMAIN_VIRT_END) &&
-         handle_perdomain_mapping_fault(addr - PERDOMAIN_VIRT_START, regs) )
-        return EXCRET_fault_fixed;
-
-    if ( !GUEST_MODE(regs) )
-        goto xen_fault;
+    return 0;
+}
+
+/*
+ * #PF error code:
+ *  Bit 0: Protection violation (=1) ; Page not present (=0)
+ *  Bit 1: Write access
+ *  Bit 2: Supervisor mode
+ *  Bit 3: Reserved bit violation
+ *  Bit 4: Instruction fetch
+ */
+asmlinkage int do_page_fault(struct cpu_user_regs *regs)
+{
+    unsigned long addr, fixup;
+    int rc;
+
+    __asm__ __volatile__ ("mov %%cr2,%0" : "=r" (addr) : );
+
+    DEBUGGER_trap_entry(TRAP_page_fault, regs);
+
+    perfc_incrc(page_faults);
+
+    if ( unlikely((rc = fixup_page_fault(addr, regs)) != 0) )
+        return rc;
+
+    if ( unlikely(!GUEST_MODE(regs)) )
+    {
+        if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
+        {
+            perfc_incrc(copy_user_faults);
+            regs->eip = fixup;
+            return 0;
+        }
+
+        DEBUGGER_trap_fatal(TRAP_page_fault, regs);
+
+        show_registers(regs);
+        show_page_walk(addr);
+        panic("CPU%d FATAL PAGE FAULT\n"
+              "[error_code=%04x]\n"
+              "Faulting linear address: %p\n",
+              smp_processor_id(), regs->error_code, addr);
+    }
 
     propagate_page_fault(addr, regs->error_code);
-    return 0;
-
- xen_fault:
-
-    if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
-    {
-        perfc_incrc(copy_user_faults);
-        regs->eip = fixup;
-        return 0;
-    }
-
-    DEBUGGER_trap_fatal(TRAP_page_fault, regs);
-
-    show_registers(regs);
-    show_page_walk(addr);
-    panic("CPU%d FATAL PAGE FAULT\n"
-          "[error_code=%04x]\n"
-          "Faulting linear address: %p\n",
-          smp_processor_id(), regs->error_code, addr);
     return 0;
 }
 
diff -r 31c257b9a360 -r 813c37b68376 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        Fri Sep  9 17:36:39 2005
+++ b/xen/arch/x86/vmx.c        Fri Sep  9 17:40:39 2005
@@ -43,6 +43,8 @@
 #endif
 
 #include <public/io/ioreq.h>
+
+int hvm_enabled;
 
 #ifdef CONFIG_VMX
 
@@ -344,6 +346,8 @@
     }
 
     vmx_save_init_msrs();
+
+    hvm_enabled = 1;
 
     return 1;
 }
diff -r 31c257b9a360 -r 813c37b68376 xen/common/Makefile
--- a/xen/common/Makefile       Fri Sep  9 17:36:39 2005
+++ b/xen/common/Makefile       Fri Sep  9 17:40:39 2005
@@ -19,3 +19,6 @@
 
 clean:
        rm -f *.o *~ core
+
+# Object file contains changeset and compiler information.
+kernel.o: $(BASEDIR)/include/xen/compile.h
diff -r 31c257b9a360 -r 813c37b68376 xen/common/kernel.c
--- a/xen/common/kernel.c       Fri Sep  9 17:36:39 2005
+++ b/xen/common/kernel.c       Fri Sep  9 17:40:39 2005
@@ -113,14 +113,24 @@
 
     case XENVER_capabilities:
     {
-        struct xen_capabilities_info info;
-        
-        /* FIXME */
-        info.arch = 0;
-        info.pae = 0;
+        xen_capabilities_info_t info;
+        extern void arch_get_xen_caps(xen_capabilities_info_t info);
+
+        memset(info, 0, sizeof(info));
+        arch_get_xen_caps(info);
+
+        if ( copy_to_user(arg, info, sizeof(info)) )
+            return -EFAULT;
+        return 0;
+    }
+    
+    case XENVER_parameters:
+    {
+        xen_parameters_info_t info = { .virt_start = HYPERVISOR_VIRT_START };
         if ( copy_to_user(arg, &info, sizeof(info)) )
             return -EFAULT;
         return 0;
+        
     }
     
     case XENVER_changeset:
diff -r 31c257b9a360 -r 813c37b68376 xen/drivers/char/Makefile
--- a/xen/drivers/char/Makefile Fri Sep  9 17:36:39 2005
+++ b/xen/drivers/char/Makefile Fri Sep  9 17:40:39 2005
@@ -8,4 +8,5 @@
 clean:
        rm -f *.o *~ core
 
+# Object file contains changeset and compiler information.
 console.o: $(BASEDIR)/include/xen/compile.h
diff -r 31c257b9a360 -r 813c37b68376 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Fri Sep  9 17:36:39 2005
+++ b/xen/include/asm-x86/mm.h  Fri Sep  9 17:40:39 2005
@@ -98,9 +98,10 @@
  /* 16-bit count of uses of this frame as its current type. */
 #define PGT_count_mask      ((1U<<16)-1)
 
-#define PGT_mfn_mask        ((1U<<20)-1) /* mfn mask for shadow types */
-
-#define PGT_score_shift     20
+ /* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */
+#define PGT_mfn_mask        ((1U<<23)-1)
+
+#define PGT_score_shift     23
 #define PGT_score_mask      (((1U<<4)-1)<<PGT_score_shift)
 
  /* Cleared when the owning guest 'frees' this page. */
diff -r 31c257b9a360 -r 813c37b68376 xen/include/asm-x86/vmx.h
--- a/xen/include/asm-x86/vmx.h Fri Sep  9 17:36:39 2005
+++ b/xen/include/asm-x86/vmx.h Fri Sep  9 17:40:39 2005
@@ -27,6 +27,8 @@
 #include <asm/i387.h>
 
 #include <public/io/ioreq.h>
+
+extern int hvm_enabled;
 
 extern void vmx_asm_vmexit_handler(struct cpu_user_regs);
 extern void vmx_asm_do_resume(void);
diff -r 31c257b9a360 -r 813c37b68376 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Fri Sep  9 17:36:39 2005
+++ b/xen/include/public/dom0_ops.h     Fri Sep  9 17:40:39 2005
@@ -213,6 +213,7 @@
     u32      cpu_khz;
     unsigned long total_pages;
     unsigned long free_pages;
+    u32      hw_cap[8];
 } dom0_physinfo_t;
 
 /*
diff -r 31c257b9a360 -r 813c37b68376 xen/include/public/version.h
--- a/xen/include/public/version.h      Fri Sep  9 17:36:39 2005
+++ b/xen/include/public/version.h      Fri Sep  9 17:40:39 2005
@@ -29,12 +29,14 @@
 } xen_compile_info_t;
 
 #define XENVER_capabilities 3
-typedef struct xen_capabilities_info {
-    int pae;
-    int arch;
-} xen_capabilities_info_t;
+typedef char xen_capabilities_info_t[1024];
 
 #define XENVER_changeset 4
 typedef char xen_changeset_info_t[64];
 
+#define XENVER_parameters 5
+typedef struct xen_parameters_info {
+    unsigned long virt_start;
+} xen_parameters_info_t;
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.