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] merge

# HG changeset patch
# User Michael.Fetterman@xxxxxxxxxxxx
# Node ID f544934dd0b6ffa5f6b15a6aa7f15668de5fb885
# Parent  055efdd6b7c5ed07ac6903923634637793ff9106
# Parent  c665ab5a6b442710d9543e002d430d1319eabb15
merge

diff -r 055efdd6b7c5 -r f544934dd0b6 .hgignore
--- a/.hgignore Tue Nov  8 02:35:25 2005
+++ b/.hgignore Tue Nov  8 12:30:05 2005
@@ -17,9 +17,9 @@
 ^docs/.*\.pdf$
 ^docs/.*\.ps$
 ^docs/.*\.toc$
+^docs/api/.*$
 ^docs/figs/xenserver\.eps$
 ^docs/html/.*$
-^docs/api/.*$
 ^docs/interface/WARNINGS$
 ^docs/interface/images\.pl$
 ^docs/interface/images\.tex$
@@ -47,9 +47,9 @@
 ^extras/mini-os/h/xen-public$
 ^extras/mini-os/mini-os\..*$
 ^install/.*$
+^linux-[^/]*-xen/.*$
 ^linux-[^/]*-xen0/.*$
 ^linux-[^/]*-xenU/.*$
-^linux-[^/]*-xen/.*$
 ^linux-[^/]*\.patch$
 ^mkddbxen$
 ^netbsd-[^/]*-tools/.*$
@@ -62,6 +62,7 @@
 ^patches/tmp/.*$
 ^pristine-.*$
 ^ref-.*$
+^tools/.*/TAGS$
 ^tools/.*/build/lib.*/.*\.py$
 ^tools/blktap/Makefile\.smh$
 ^tools/blktap/blkcow$
@@ -71,37 +72,37 @@
 ^tools/blktap/blkgnbd$
 ^tools/blktap/blkimg$
 ^tools/blktap/bstest$
-^tools/blktap/vdi\.dot$
-^tools/blktap/vdi\.ps$
+^tools/blktap/parallax/blockstored$
+^tools/blktap/parallax/parallax$
 ^tools/blktap/parallax/vdi_create$
 ^tools/blktap/parallax/vdi_fill$
 ^tools/blktap/parallax/vdi_list$
 ^tools/blktap/parallax/vdi_snap$
+^tools/blktap/parallax/vdi_snap_delete$
 ^tools/blktap/parallax/vdi_snap_list$
-^tools/blktap/parallax/vdi_snap_delete$
 ^tools/blktap/parallax/vdi_tree$
 ^tools/blktap/parallax/vdi_validate$
-^tools/blktap/parallax/parallax$
-^tools/blktap/parallax/blockstored$
 ^tools/blktap/ublkback/ublkback$
+^tools/blktap/vdi\.dot$
+^tools/blktap/vdi\.ps$
 ^tools/blktap/xen/.*$
 ^tools/check/\..*$
+^tools/console/xenconsole$
 ^tools/console/xenconsoled$
-^tools/console/xenconsole$
+^tools/debugger/gdb/gdb-6\.2\.1-linux-i386-xen/.*$
+^tools/debugger/gdb/gdb-6\.2\.1/.*$
 ^tools/debugger/gdb/gdb-6\.2\.1\.tar\.bz2$
-^tools/debugger/gdb/gdb-6\.2\.1/.*$
-^tools/debugger/gdb/gdb-6\.2\.1-linux-i386-xen/.*$
-^tools/debugger/pdb/pdb$
+^tools/debugger/pdb/._bcdi/.*$
 ^tools/debugger/pdb/linux-[0-9.]*-module/.*\.ko$
 ^tools/debugger/pdb/linux-[0-9.]*-module/.*\.mod.c$
+^tools/debugger/pdb/linux-[0-9.]*-module/.tmp_versions/.*$
 ^tools/debugger/pdb/linux-[0-9.]*-module/\..*\.cmd$
-^tools/debugger/pdb/linux-[0-9.]*-module/.tmp_versions/.*$
-^tools/debugger/pdb/._bcdi/.*$
-^tools/firmware/acpi/acpigen$
+^tools/debugger/pdb/pdb$
+^tools/firmware/.*/biossums$
 ^tools/firmware/.*\.bin$
 ^tools/firmware/.*\.sym$
-^tools/firmware/.*/biossums$
 ^tools/firmware/.*bios/.*bios.*\.txt$
+^tools/firmware/acpi/acpigen$
 ^tools/firmware/rombios/BIOS-bochs-latest$
 ^tools/firmware/rombios/_rombios_\.c$
 ^tools/firmware/rombios/rombios\.s$
@@ -120,20 +121,20 @@
 ^tools/libxc/xen/.*$
 ^tools/misc/cpuperf/cpuperf-perfcntr$
 ^tools/misc/cpuperf/cpuperf-xen$
+^tools/misc/lomount/lomount$
 ^tools/misc/mbootpack/bin2c$
 ^tools/misc/mbootpack/bootsect$
 ^tools/misc/mbootpack/bzimage_header\.c$
 ^tools/misc/mbootpack/mbootpack$
 ^tools/misc/mbootpack/setup$
 ^tools/misc/miniterm/miniterm$
-^tools/misc/lomount/lomount$
 ^tools/misc/xc_shadow$
 ^tools/misc/xen_cpuperf$
 ^tools/misc/xenperf$
+^tools/pygrub/build/.*$
+^tools/python/build/.*$
 ^tools/security/secpol_tool$
 ^tools/security/xen/.*$
-^tools/pygrub/build/.*$
-^tools/python/build/.*$
 ^tools/tests/test_x86_emulator$
 ^tools/vnet/gc$
 ^tools/vnet/gc.*/.*$
@@ -141,8 +142,8 @@
 ^tools/vnet/vnet-module/\..*\.cmd$
 ^tools/vnet/vnet-module/\.tmp_versions/.*$
 ^tools/vnet/vnet-module/vnet_module\.mod\..*$
+^tools/vtpm/tpm_emulator-.*\.tar\.gz$
 ^tools/vtpm/tpm_emulator/.*$
-^tools/vtpm/tpm_emulator-.*\.tar\.gz$
 ^tools/vtpm/vtpm/.*$
 ^tools/vtpm_manager/manager/vtpm_managerd$
 ^tools/xcutils/xc_restore$
@@ -150,13 +151,13 @@
 ^tools/xenstat/xentop/xentop$
 ^tools/xenstore/testsuite/tmp/.*$
 ^tools/xenstore/xen$
-^tools/xenstore/xenstored$
-^tools/xenstore/xenstored_test$
 ^tools/xenstore/xenstore-exists$
 ^tools/xenstore/xenstore-list$
 ^tools/xenstore/xenstore-read$
 ^tools/xenstore/xenstore-rm$
 ^tools/xenstore/xenstore-write$
+^tools/xenstore/xenstored$
+^tools/xenstore/xenstored_test$
 ^tools/xenstore/xs_crashme$
 ^tools/xenstore/xs_random$
 ^tools/xenstore/xs_stress$
diff -r 055efdd6b7c5 -r f544934dd0b6 
linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32
--- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32       Tue Nov 
 8 02:35:25 2005
+++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32       Tue Nov 
 8 12:30:05 2005
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.12-xen0
-# Wed Aug  3 09:54:56 2005
+# Linux kernel version: 2.6.12.6-xen0
+# Mon Nov  7 17:22:05 2005
 #
 CONFIG_XEN=y
 CONFIG_ARCH_XEN=y
@@ -151,11 +151,9 @@
 CONFIG_X86_UP_APIC=y
 CONFIG_X86_UP_IOAPIC=y
 CONFIG_PCI=y
-# CONFIG_PCI_GOBIOS is not set
 # CONFIG_PCI_GOMMCONFIG is not set
 # CONFIG_PCI_GODIRECT is not set
 CONFIG_PCI_GOANY=y
-CONFIG_PCI_BIOS=y
 CONFIG_PCI_DIRECT=y
 CONFIG_PCI_MMCONFIG=y
 # CONFIG_PCIEPORTBUS is not set
@@ -540,7 +538,7 @@
 # CONFIG_IP_NF_MATCH_STATE is not set
 # CONFIG_IP_NF_MATCH_CONNTRACK is not set
 # CONFIG_IP_NF_MATCH_OWNER is not set
-CONFIG_IP_NF_MATCH_PHYSDEV=y
+CONFIG_IP_NF_MATCH_PHYSDEV=m
 # CONFIG_IP_NF_MATCH_ADDRTYPE is not set
 # CONFIG_IP_NF_MATCH_REALM is not set
 # CONFIG_IP_NF_MATCH_SCTP is not set
diff -r 055efdd6b7c5 -r f544934dd0b6 
linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64
--- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64       Tue Nov 
 8 02:35:25 2005
+++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64       Tue Nov 
 8 12:30:05 2005
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.12.4-xen0
-# Mon Aug 15 18:57:19 2005
+# Linux kernel version: 2.6.12.6-xen0
+# Mon Nov  7 17:24:18 2005
 #
 CONFIG_XEN=y
 CONFIG_ARCH_XEN=y
@@ -92,6 +92,7 @@
 # CONFIG_PREEMPT is not set
 CONFIG_MICROCODE=y
 # CONFIG_X86_CPUID is not set
+CONFIG_SWIOTLB=y
 # CONFIG_NUMA is not set
 # CONFIG_MTRR is not set
 CONFIG_X86_LOCAL_APIC=y
@@ -122,7 +123,6 @@
 # CONFIG_X86_MSR is not set
 # CONFIG_GART_IOMMU is not set
 CONFIG_DUMMY_IOMMU=y
-CONFIG_SWIOTLB=y
 # CONFIG_X86_MCE is not set
 
 #
@@ -480,7 +480,7 @@
 # CONFIG_IP_NF_MATCH_STATE is not set
 # CONFIG_IP_NF_MATCH_CONNTRACK is not set
 # CONFIG_IP_NF_MATCH_OWNER is not set
-CONFIG_IP_NF_MATCH_PHYSDEV=y
+CONFIG_IP_NF_MATCH_PHYSDEV=m
 # CONFIG_IP_NF_MATCH_ADDRTYPE is not set
 # CONFIG_IP_NF_MATCH_REALM is not set
 # CONFIG_IP_NF_MATCH_SCTP is not set
diff -r 055efdd6b7c5 -r f544934dd0b6 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Tue Nov  8 02:35:25 2005
+++ b/tools/libxc/Makefile      Tue Nov  8 12:30:05 2005
@@ -13,7 +13,6 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 SRCS       :=
-BUILD_SRCS :=
 SRCS       += xc_bvtsched.c
 SRCS       += xc_core.c
 SRCS       += xc_domain.c
@@ -24,24 +23,26 @@
 SRCS       += xc_private.c
 SRCS       += xc_sedf.c
 SRCS       += xc_tbuf.c
+
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+SRCS       += xc_ptrace.c
+SRCS       += xc_ptrace_core.c
+endif
+
+BUILD_SRCS :=
 BUILD_SRCS += xc_linux_build.c
 BUILD_SRCS += xc_load_bin.c
 BUILD_SRCS += xc_load_elf.c
+BUILD_SRCS += xg_private.c
 
 ifeq ($(XEN_TARGET_ARCH),ia64)
 BUILD_SRCS += xc_ia64_stubs.c
 else
-ifeq ($(XEN_TARGET_ARCH),x86_32)
-SRCS       += xc_ptrace.c
-SRCS       += xc_ptrace_core.c
-endif
 BUILD_SRCS += xc_load_aout9.c
 BUILD_SRCS += xc_linux_restore.c
 BUILD_SRCS += xc_linux_save.c
 BUILD_SRCS += xc_vmx_build.c
 endif
-
-BUILD_SRCS += xg_private.c
 
 CFLAGS   += -Wall
 CFLAGS   += -Werror
@@ -105,7 +106,7 @@
 .PHONY: TAGS clean rpm install all
 
 TAGS:
-       etags -t $(SRCS) *.h
+       etags -t *.c *.h
 
 clean:
        rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
diff -r 055efdd6b7c5 -r f544934dd0b6 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Tue Nov  8 02:35:25 2005
+++ b/tools/libxc/xc_linux_build.c      Tue Nov  8 12:30:05 2005
@@ -549,11 +549,10 @@
         rc = setup_pg_tables_pae(xc_handle, dom, ctxt,
                                  dsi.v_start, v_end,
                                  page_array, vpt_start, vpt_end);
-    else {
+    else
         rc = setup_pg_tables(xc_handle, dom, ctxt,
                              dsi.v_start, v_end,
                              page_array, vpt_start, vpt_end);
-    }
 #endif
 #if defined(__x86_64__)
     rc = setup_pg_tables_64(xc_handle, dom, ctxt,
@@ -671,8 +670,10 @@
     return 0;
 
  error_out:
-    free(mmu);
-    free(page_array);
+    if ( mmu != NULL )
+        free(mmu);
+    if ( page_array != NULL )
+        free(page_array);
     return -1;
 }
 #endif
@@ -726,7 +727,7 @@
 
     if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
     {   
-        PERROR("xc_linux_build: ctxt mlock failed");
+        PERROR("%s: ctxt mlock failed", __func__);
         return 1;
     }
 
@@ -767,7 +768,8 @@
         close(initrd_fd);
     if ( initrd_gfd )
         gzclose(initrd_gfd);
-    free(image);
+    if ( image != NULL )
+        free(image);
 
 #ifdef __ia64__
     /* based on new_thread in xen/arch/ia64/domain.c */
@@ -856,7 +858,8 @@
         gzclose(initrd_gfd);
     else if ( initrd_fd >= 0 )
         close(initrd_fd);
-    free(image);
+    if ( image != NULL )
+        free(image);
 
     return -1;
 }
diff -r 055efdd6b7c5 -r f544934dd0b6 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Tue Nov  8 02:35:25 2005
+++ b/tools/python/xen/xm/create.py     Tue Nov  8 12:30:05 2005
@@ -756,7 +756,7 @@
 vncpid = None
 
 def spawn_vnc(display):
-    vncargs = (["vncviewer" + "-log", "*:stdout:0",
+    vncargs = (["vncviewer", "-log", "*:stdout:0",
             "-listen", "%d" % (VNC_BASE_PORT + display) ])
     global vncpid    
     vncpid = os.spawnvp(os.P_NOWAIT, "vncviewer", vncargs)
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/acm/acm_core.c
--- a/xen/acm/acm_core.c        Tue Nov  8 02:35:25 2005
+++ b/xen/acm/acm_core.c        Tue Nov  8 12:30:05 2005
@@ -254,7 +254,10 @@
         return ACM_NULL_POINTER_ERROR;
     }
     if ((ssid = xmalloc(struct acm_ssid_domain)) == NULL)
+    {
+        put_domain(subj);
         return ACM_INIT_SSID_ERROR;
+    }
 
     ssid->datatype       = DOMAIN;
     ssid->subject        = subj;
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/audit.c
--- a/xen/arch/x86/audit.c      Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/audit.c      Tue Nov  8 12:30:05 2005
@@ -412,7 +412,7 @@
         for_each_vcpu(d, v)
         {
             if ( pagetable_get_paddr(v->arch.guest_table) )
-                adjust(&frame_table[pagetable_get_pfn(v->arch.guest_table)], 
1);
+                adjust(&frame_table[pagetable_get_pfn(v->arch.guest_table)], 
!shadow_mode_refcounts(d));
             if ( pagetable_get_paddr(v->arch.shadow_table) )
                 adjust(&frame_table[pagetable_get_pfn(v->arch.shadow_table)], 
0);
             if ( v->arch.monitor_shadow_ref )
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c   Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/dom0_ops.c   Tue Nov  8 12:30:05 2005
@@ -263,6 +263,7 @@
         if ( unlikely(num > 1024) )
         {
             ret = -E2BIG;
+            put_domain(d);
             break;
         }
 
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/mm.c Tue Nov  8 12:30:05 2005
@@ -507,7 +507,7 @@
         l2e_get_pfn(l2e), PGT_l1_page_table | vaddr, d);
 
 #if CONFIG_PAGING_LEVELS == 2
-    if (!rc)
+    if ( unlikely(!rc) )
         rc = get_linear_pagetable(l2e, pfn, d);
 #endif
     return rc;
@@ -540,7 +540,7 @@
         l3e_get_pfn(l3e),
         PGT_l2_page_table | vaddr, d);
 #if CONFIG_PAGING_LEVELS == 3
-    if (!rc)
+    if ( unlikely(!rc) )
         rc = get_linear_pagetable(l3e, pfn, d);
 #endif
     return rc;
@@ -575,9 +575,9 @@
         PGT_l3_page_table | vaddr, d);
 
     if ( unlikely(!rc) )
-        return get_linear_pagetable(l4e, pfn, d);
-
-    return 1;
+        rc = get_linear_pagetable(l4e, pfn, d);
+
+    return rc;
 }
 
 #endif /* 4 level */
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/shadow.c     Tue Nov  8 12:30:05 2005
@@ -37,8 +37,10 @@
 
 extern void free_shadow_pages(struct domain *d);
 
+#if 0 // this code has not been updated for 32pae & 64 bit modes
 #if SHADOW_DEBUG
 static void mark_shadows_as_reflecting_snapshot(struct domain *d, unsigned 
long gpfn);
+#endif
 #endif
 
 #if CONFIG_PAGING_LEVELS == 3
@@ -898,8 +900,10 @@
     entry->snapshot_mfn = shadow_make_snapshot(d, gpfn, mfn);
     entry->writable_pl1e = -1;
 
+#if 0 // this code has not been updated for 32pae & 64 bit modes
 #if SHADOW_DEBUG
     mark_shadows_as_reflecting_snapshot(d, gpfn);
+#endif
 #endif
 
     // increment guest's ref count to represent the entry in the
@@ -1317,18 +1321,17 @@
 
         if ( !smfn )
         {
+            // For heavy weight shadows: no need to update refcounts if
+            // there's no shadow page.
+            //
             if ( shadow_mode_refcounts(d) )
                 continue;
 
-            // For light weight shadows, even when no shadow page exists,
-            // we need to resync the refcounts to the new contents of the
-            // guest page.
-            // This only applies when we have writable page tables.
+            // For light weight shadows: only need up resync the refcounts to
+            // the new contents of the guest page iff this it has the right
+            // page type.
             //
-            if ( !shadow_mode_write_all(d) &&
-                 !((stype == PGT_l1_shadow) &&
-                   VM_ASSIST(d, VMASST_TYPE_writable_pagetables)) )
-                // Page is not writable -- no resync necessary
+            if ( stype != ( pfn_to_page(entry->gmfn)->u.inuse.type_info & 
PGT_type_mask) )
                 continue;
         }
 
@@ -1365,8 +1368,8 @@
             guest_l1_pgentry_t *snapshot1 = snapshot;
             int unshadow_l1 = 0;
 
-            ASSERT(VM_ASSIST(d, VMASST_TYPE_writable_pagetables) ||
-                   shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_l1(d) ||
+                   shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
 
             if ( !shadow_mode_refcounts(d) )
                 revalidate_l1(d, (l1_pgentry_t *)guest1, (l1_pgentry_t 
*)snapshot1);
@@ -1427,7 +1430,7 @@
             l2_pgentry_t *shadow2 = shadow;
             l2_pgentry_t *snapshot2 = snapshot;
 
-            ASSERT(shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
             BUG_ON(!shadow_mode_refcounts(d)); // not yet implemented
 
             changed = 0;
@@ -1473,7 +1476,7 @@
             l2_pgentry_t *snapshot2 = snapshot;
             l1_pgentry_t *shadow2 = shadow;
 
-            ASSERT(shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
             BUG_ON(!shadow_mode_refcounts(d)); // not yet implemented
 
             changed = 0;
@@ -1822,8 +1825,13 @@
                 goto fail;
             }
         }
-
-        if ( !l1pte_write_fault(v, &gpte, &spte, va) )
+        else if ( unlikely(!shadow_mode_wr_pt_pte(d) && 
mfn_is_page_table(l1e_get_pfn(gpte))) )
+        {
+            SH_LOG("l1pte_write_fault: no write access to page table page");
+            domain_crash_synchronous();
+        }
+
+        if ( unlikely(!l1pte_write_fault(v, &gpte, &spte, va)) )
         {
             SH_VVLOG("shadow_fault - EXIT: l1pte_write_fault failed");
             perfc_incrc(write_fault_bail);
@@ -2072,6 +2080,7 @@
 /************************************************************************/
 /************************************************************************/
 
+#if 0 // this code has not been updated for 32pae & 64 bit modes
 #if SHADOW_DEBUG
 
 // The following is entirely for _check_pagetable()'s benefit.
@@ -2118,8 +2127,8 @@
 // BUG: these are not SMP safe...
 static int sh_l2_present;
 static int sh_l1_present;
-char * sh_check_name;
-int shadow_status_noswap;
+static char *sh_check_name;
+// int shadow_status_noswap; // declared in shadow32.c
 
 #define v2m(_v, _adr) ({                                                     \
     unsigned long _a  = (unsigned long)(_adr);                               \
@@ -2218,11 +2227,11 @@
 
     guest_writable =
         (l1e_get_flags(eff_guest_pte) & _PAGE_RW) ||
-        (VM_ASSIST(d, VMASST_TYPE_writable_pagetables) && (level == 1) && 
mfn_out_of_sync(eff_guest_mfn));
+        (shadow_mode_write_l1(d) && (level == 1) && 
mfn_out_of_sync(eff_guest_mfn));
 
     if ( (l1e_get_flags(shadow_pte) & _PAGE_RW ) && !guest_writable )
     {
-        printk("eff_guest_pfn=%lx eff_guest_mfn=%lx shadow_mfn=%lx t=0x%08x 
page_table_page=%d\n",
+        printk("eff_guest_pfn=%lx eff_guest_mfn=%lx shadow_mfn=%lx t=0x%08lx 
page_table_page=%d\n",
                eff_guest_pfn, eff_guest_mfn, shadow_mfn,
                frame_table[eff_guest_mfn].u.inuse.type_info,
                page_table_page);
@@ -2233,7 +2242,7 @@
          (l1e_get_flags(shadow_pte) & _PAGE_RW ) &&
          !(guest_writable && (l1e_get_flags(eff_guest_pte) & _PAGE_DIRTY)) )
     {
-        printk("eff_guest_pfn=%lx eff_guest_mfn=%lx shadow_mfn=%lx t=0x%08x 
page_table_page=%d\n",
+        printk("eff_guest_pfn=%lx eff_guest_mfn=%lx shadow_mfn=%lx t=0x%08lx 
page_table_page=%d\n",
                eff_guest_pfn, eff_guest_mfn, shadow_mfn,
                frame_table[eff_guest_mfn].u.inuse.type_info,
                page_table_page);
@@ -2393,13 +2402,12 @@
 }
 #undef FAILPT
 
-static int _check_pagetable(struct vcpu *v, char *s)
+int _check_pagetable(struct vcpu *v, char *s)
 {
     struct domain *d = v->domain;
 #if defined (__x86_64__)
     pagetable_t pt = ((v->arch.flags & TF_kernel_mode)?
-                      pagetable_get_pfn(v->arch.guest_table) :
-                      pagetable_get_pfn(v->arch.guest_table_user));
+                      v->arch.guest_table : v->arch.guest_table_user);
 #else
     pagetable_t pt = v->arch.guest_table;
 #endif
@@ -2539,6 +2547,7 @@
 }
 
 #endif // SHADOW_DEBUG
+#endif // this code has not been updated for 32pae & 64 bit modes
 
 #if CONFIG_PAGING_LEVELS == 3
 static unsigned long shadow_l3_table(
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/shadow32.c   Tue Nov  8 12:30:05 2005
@@ -624,6 +624,14 @@
     // under us...  First, collect the list of pinned pages, then
     // free them.
     //
+    // FIXME: it would be good to just free all the pages referred to in
+    // the hash table without going through each of them to decrement their
+    // reference counts.  In shadow_mode_refcount(), we've gotta do the hard
+    // work, but only for L1 shadows.  If we're not in refcount mode, then
+    // there's no real hard work to do at all.  Need to be careful with the
+    // writable_pte_predictions and snapshot entries in the hash table, but
+    // that's about it.
+    //
     for ( i = 0; i < shadow_ht_buckets; i++ )
     {
         u32 count;
@@ -634,17 +642,51 @@
             continue;
 
         count = 0;
-        for ( x = &d->arch.shadow_ht[i]; x != NULL; x = x->next )
-            if ( MFN_PINNED(x->smfn) )
-                count++;
+
+        for ( x = &d->arch.shadow_ht[i]; x != NULL; x = x->next ) {
+           /* Skip entries that are writable_pred) */
+           switch(x->gpfn_and_flags & PGT_type_mask){
+               case PGT_l1_shadow:
+               case PGT_l2_shadow:
+               case PGT_l3_shadow:
+               case PGT_l4_shadow:
+               case PGT_hl2_shadow:
+                   if ( MFN_PINNED(x->smfn) )
+                       count++;
+                   break;
+               case PGT_snapshot:
+               case PGT_writable_pred:
+                   break;
+               default:
+                   BUG();
+
+           }
+       }
+
         if ( !count )
             continue;
 
         mfn_list = xmalloc_array(unsigned long, count);
         count = 0;
-        for ( x = &d->arch.shadow_ht[i]; x != NULL; x = x->next )
-            if ( MFN_PINNED(x->smfn) )
-                mfn_list[count++] = x->smfn;
+        for ( x = &d->arch.shadow_ht[i]; x != NULL; x = x->next ) {
+           /* Skip entries that are writable_pred) */
+           switch(x->gpfn_and_flags & PGT_type_mask){
+               case PGT_l1_shadow:
+               case PGT_l2_shadow:
+               case PGT_l3_shadow:
+               case PGT_l4_shadow:
+               case PGT_hl2_shadow:
+                   if ( MFN_PINNED(x->smfn) )
+                       mfn_list[count++] = x->smfn;
+                   break;
+               case PGT_snapshot:
+               case PGT_writable_pred:
+                   break;
+               default:
+                   BUG();
+
+           }
+       }
 
         while ( count )
         {
@@ -779,6 +821,7 @@
     unsigned long va = pfn << PAGE_SHIFT;
 
     ASSERT(tabpfn != 0);
+    ASSERT(shadow_lock_is_acquired(d));
 
     l2 = map_domain_page_with_cache(tabpfn, l2cache);
     l2e = l2[l2_table_offset(va)];
@@ -2037,7 +2080,12 @@
         while ( count )
         {
             count--;
+            /* delete_shadow_status() may do a shadow_audit(), so we need to
+             * keep an accurate count of writable_pte_predictions to keep it
+             * happy.
+             */
             delete_shadow_status(d, gpfn_list[count], 0, PGT_writable_pred);
+            perfc_decr(writable_pte_predictions);
         }
 
         xfree(gpfn_list);
@@ -2273,18 +2321,17 @@
 
         if ( !smfn )
         {
+            // For heavy weight shadows: no need to update refcounts if
+            // there's no shadow page.
+            //
             if ( shadow_mode_refcounts(d) )
                 continue;
 
-            // For light weight shadows, even when no shadow page exists,
-            // we need to resync the refcounts to the new contents of the
-            // guest page.
-            // This only applies when we have writable page tables.
+            // For light weight shadows: only need up resync the refcounts to
+            // the new contents of the guest page iff this it has the right
+            // page type.
             //
-            if ( !shadow_mode_write_all(d) &&
-                 !((stype == PGT_l1_shadow) &&
-                   VM_ASSIST(d, VMASST_TYPE_writable_pagetables)) )
-                // Page is not writable -- no resync necessary
+            if ( stype != ( pfn_to_page(entry->gmfn)->u.inuse.type_info & 
PGT_type_mask) )
                 continue;
         }
 
@@ -2312,8 +2359,8 @@
             l1_pgentry_t *snapshot1 = snapshot;
             int unshadow_l1 = 0;
 
-            ASSERT(VM_ASSIST(d, VMASST_TYPE_writable_pagetables) ||
-                   shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_l1(d) ||
+                   shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
 
             if ( !shadow_mode_refcounts(d) )
                 revalidate_l1(d, guest1, snapshot1);
@@ -2380,7 +2427,7 @@
             l2_pgentry_t *shadow2 = shadow;
             l2_pgentry_t *snapshot2 = snapshot;
 
-            ASSERT(shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
             BUG_ON(!shadow_mode_refcounts(d)); // not yet implemented
 
             changed = 0;
@@ -2426,7 +2473,7 @@
             l2_pgentry_t *snapshot2 = snapshot;
             l1_pgentry_t *shadow2 = shadow;
             
-            ASSERT(shadow_mode_write_all(d));
+            ASSERT(shadow_mode_write_all(d) || shadow_mode_wr_pt_pte(d));
             BUG_ON(!shadow_mode_refcounts(d)); // not yet implemented
 
             changed = 0;
@@ -2619,8 +2666,13 @@
                 goto fail;
             }
         }
-
-        if ( !l1pte_write_fault(v, &gpte, &spte, va) )
+        else if ( unlikely(!shadow_mode_wr_pt_pte(d) && 
mfn_is_page_table(l1e_get_pfn(gpte))) )
+        {
+            SH_LOG("l1pte_write_fault: no write access to page table page");
+            domain_crash_synchronous();
+        }
+
+        if ( unlikely(!l1pte_write_fault(v, &gpte, &spte, va)) )
         {
             SH_VVLOG("shadow_fault - EXIT: l1pte_write_fault failed");
             perfc_incrc(write_fault_bail);
@@ -2954,7 +3006,7 @@
 // BUG: these are not SMP safe...
 static int sh_l2_present;
 static int sh_l1_present;
-char * sh_check_name;
+static char *sh_check_name;
 int shadow_status_noswap;
 
 #define v2m(_v, _adr) ({                                                     \
@@ -3054,7 +3106,7 @@
 
     guest_writable =
         (l1e_get_flags(eff_guest_pte) & _PAGE_RW) ||
-        (VM_ASSIST(d, VMASST_TYPE_writable_pagetables) && (level == 1) && 
mfn_out_of_sync(eff_guest_mfn));
+        (shadow_mode_write_l1(d) && (level == 1) && 
mfn_out_of_sync(eff_guest_mfn));
 
     if ( (l1e_get_flags(shadow_pte) & _PAGE_RW ) && !guest_writable )
     {
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        Tue Nov  8 02:35:25 2005
+++ b/xen/arch/x86/vmx.c        Tue Nov  8 12:30:05 2005
@@ -79,7 +79,7 @@
          * the shared 1:1 page table initially. It shouldn't hurt */
         shadow_mode_enable(v->domain,
                            SHM_enable|SHM_refcounts|
-                           SHM_translate|SHM_external);
+                           SHM_translate|SHM_external|SHM_wr_pt_pte);
     }
 
     vmx_switch_on = 1;
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        Tue Nov  8 02:35:25 2005
+++ b/xen/include/asm-x86/page.h        Tue Nov  8 12:30:05 2005
@@ -271,6 +271,9 @@
 #define _PAGE_PAT      0x080U
 #define _PAGE_PSE      0x080U
 #define _PAGE_GLOBAL   0x100U
+#define _PAGE_AVAIL0   0x200U
+#define _PAGE_AVAIL1   0x400U
+#define _PAGE_AVAIL2   0x800U
 #define _PAGE_AVAIL    0xE00U
 
 #define __PAGE_HYPERVISOR \
diff -r 055efdd6b7c5 -r f544934dd0b6 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Tue Nov  8 02:35:25 2005
+++ b/xen/include/asm-x86/shadow.h      Tue Nov  8 12:30:05 2005
@@ -45,15 +45,21 @@
 #define SHM_write_all (1<<2) /* allow write access to all guest pt pages,
                                 regardless of pte write permissions */
 #define SHM_log_dirty (1<<3) /* enable log dirty mode */
-#define SHM_translate (1<<4) /* do p2m tranaltion on guest tables */
-#define SHM_external  (1<<5) /* external page table, not used by Xen */
+#define SHM_translate (1<<4) /* Xen does p2m translation, not guest */
+#define SHM_external  (1<<5) /* Xen does not steal address space from the
+                                domain for its own booking; requires VT or
+                                similar mechanisms */
+#define SHM_wr_pt_pte (1<<6) /* guest allowed to set PAGE_RW bit in PTEs which
+                                point to page table pages. */
 
 #define shadow_mode_enabled(_d)   ((_d)->arch.shadow_mode)
 #define shadow_mode_refcounts(_d) ((_d)->arch.shadow_mode & SHM_refcounts)
+#define shadow_mode_write_l1(_d)  (VM_ASSIST(_d, 
VMASST_TYPE_writable_pagetables))
 #define shadow_mode_write_all(_d) ((_d)->arch.shadow_mode & SHM_write_all)
 #define shadow_mode_log_dirty(_d) ((_d)->arch.shadow_mode & SHM_log_dirty)
 #define shadow_mode_translate(_d) ((_d)->arch.shadow_mode & SHM_translate)
 #define shadow_mode_external(_d)  ((_d)->arch.shadow_mode & SHM_external)
+#define shadow_mode_wr_pt_pte(_d) ((_d)->arch.shadow_mode & SHM_wr_pt_pte)
 
 #define shadow_linear_pg_table ((l1_pgentry_t *)SH_LINEAR_PT_VIRT_START)
 #define __shadow_linear_l2_table ((l2_pgentry_t *)(SH_LINEAR_PT_VIRT_START + \
@@ -324,8 +330,7 @@
 
 #if SHADOW_DEBUG
 extern int shadow_status_noswap;
-#define _SHADOW_REFLECTS_SNAPSHOT ( 9)
-#define SHADOW_REFLECTS_SNAPSHOT  (1u << _SHADOW_REFLECTS_SNAPSHOT)
+#define SHADOW_REFLECTS_SNAPSHOT _PAGE_AVAIL0
 #endif
 
 #ifdef VERBOSE
@@ -1474,7 +1479,8 @@
             if ( stype != PGT_writable_pred )
                 BUG(); // we should never replace entries into the hash table
             x->smfn = smfn;
-            put_page(pfn_to_page(gmfn)); // already had a ref...
+            if ( stype != PGT_writable_pred )
+                put_page(pfn_to_page(gmfn)); // already had a ref...
             goto done;
         }
 
@@ -1656,14 +1662,18 @@
          (type == PGT_writable_page) )
         type = shadow_max_pgtable_type(d, gpfn, NULL);
 
-    if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
-         (type == PGT_l1_page_table) &&
-         (va < HYPERVISOR_VIRT_START) &&
-         KERNEL_MODE(v, regs) )
-        return 1;
-
-    if ( shadow_mode_write_all(d) &&
-         type && (type <= PGT_l4_page_table) &&
+    // Strange but true: writable page tables allow kernel-mode access
+    // to L1 page table pages via write-protected PTEs...  Similarly, write 
+    // access to all page table pages is granted for shadow_mode_write_all
+    // clients.
+    //
+    if ( ((shadow_mode_write_l1(d) && (type == PGT_l1_page_table)) ||
+          (shadow_mode_write_all(d) && type && (type <= PGT_l4_page_table))) &&
+         ((va < HYPERVISOR_VIRT_START)
+#if defined(__x86_64__)
+          || (va >= HYPERVISOR_VIRT_END)
+#endif
+             ) &&
          KERNEL_MODE(v, regs) )
         return 1;
 

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

<Prev in Thread] Current Thread [Next in Thread>