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] Initial fullshadow checkin.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Initial fullshadow checkin.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Mon, 14 Mar 2005 22:07:47 +0000
Delivery-date: Tue, 05 Apr 2005 16:07:23 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1236.32.2, 2005/03/14 22:07:47+00:00, mafetter@xxxxxxxxxxxxxxxx

        Initial fullshadow checkin.
        
        Things still to do:
        - reuse snapshots intelligently.
        - minimize tlb flushes during resync.
        - figure out when to free up no-longer-used L2 shadows, and
          generally deal with out-of-memory kinds of problems.
        
        Some basic guidelines:
        - With fullshadow on, you can not trust
          linear_pg_table unless you have first checked whether the VA
          in which you are interested is out-of-sync or not.
        - Significant new functions/macros include:
          page_out_of_sync(mfn): returns true if page is out of sync.
          shadow_mark_out_of_sync: make a page be out of sync (allocating
             any necessary snapshots, etc)
          shadow_out_of_sync(va): returns true if the current mappings
             involved in va are out-of-sync.
          shadow_sync_va(): bring the pages involved in mapping a particular
             va back into sync.  Currently calls shadow_sync_all().
          shadow_sync_all(): bring all pages back in-sync.
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 arch/x86/audit.c               |  817 ++++++++++++++++
 arch/x86/domain.c              |   71 -
 arch/x86/mm.c                  | 1031 ++++++--------------
 arch/x86/shadow.c              | 2019 ++++++++++++++++++++++++++++++++---------
 arch/x86/traps.c               |   11 
 arch/x86/vmx.c                 |   27 
 arch/x86/x86_32/domain_build.c |   14 
 arch/x86/x86_32/domain_page.c  |    2 
 common/dom_mem_ops.c           |   22 
 common/keyhandler.c            |    2 
 common/page_alloc.c            |   19 
 common/schedule.c              |    3 
 include/asm-x86/domain.h       |   22 
 include/asm-x86/mm.h           |   69 +
 include/asm-x86/page.h         |    6 
 include/asm-x86/shadow.h       |  877 ++++++++++++-----
 include/asm-x86/x86_32/page.h  |    2 
 include/xen/domain.h           |    2 
 include/xen/perfc_defn.h       |   50 -
 19 files changed, 3553 insertions(+), 1513 deletions(-)


diff -Nru a/xen/arch/x86/audit.c b/xen/arch/x86/audit.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/arch/x86/audit.c      2005-04-05 12:07:27 -04:00
@@ -0,0 +1,817 @@
+/******************************************************************************
+ * arch/x86/audit.c
+ * 
+ * Copyright (c) 2002-2005 K A Fraser
+ * Copyright (c) 2004 Christian Limpach
+ * Copyright (c) 2005 Michael A Fetterman
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+//#include <xen/sched.h>
+//#include <xen/errno.h>
+#include <xen/perfc.h>
+//#include <xen/irq.h>
+//#include <xen/softirq.h>
+#include <asm/shadow.h>
+#include <asm/page.h>
+#include <asm/flushtlb.h>
+//#include <asm/io.h>
+//#include <asm/uaccess.h>
+//#include <asm/domain_page.h>
+//#include <asm/ldt.h>
+
+// XXX SMP bug -- these should not be statics...
+//
+static int ttot=0, ctot=0, io_mappings=0, lowmem_mappings=0;
+static int l1, l2, oos_count, page_count;
+
+#define FILE_AND_LINE 1
+
+#if FILE_AND_LINE
+#define adjust(_p, _a) _adjust((_p), (_a), __FILE__, __LINE__)
+#define ADJUST_EXTRA_ARGS ,const char *file, int line
+#define APRINTK(_f, _a...) printk(_f " %s:%d\n", ## _a, file, line)
+#else
+#define adjust _adjust
+#define ADJUST_EXTRA_ARGS
+#define APRINTK(_f, _a...) printk(_f "\n", ##_a)
+#endif
+
+int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
+{
+    int errors = 0;
+    int shadow_enabled = shadow_mode_enabled(d) ? 1 : 0;
+
+    void _adjust(struct pfn_info *page, int adjtype ADJUST_EXTRA_ARGS)
+    {
+        if ( adjtype )
+        {
+            // adjust the type count
+            //
+            int tcount = page->u.inuse.type_info & PGT_count_mask;
+            tcount += dir;
+            ttot++;
+
+            if ( page_get_owner(page) == NULL )
+            {
+                APRINTK("adjust(mfn=%p, dir=%d, adjtype=%d) owner=NULL",
+                        page_to_pfn(page), dir, adjtype, file, line);
+                errors++;
+            }
+
+            if ( tcount < 0 )
+            {
+                APRINTK("Audit %d: type count went below zero mfn=%x t=%x 
ot=%x",
+                        d->id, page-frame_table,
+                        page->u.inuse.type_info,
+                        page->tlbflush_timestamp);
+                errors++;
+            }
+            else if ( (tcount & ~PGT_count_mask) != 0 )
+            {
+                APRINTK("Audit %d: type count overflowed mfn=%x t=%x ot=%x",
+                        d->id, page-frame_table,
+                        page->u.inuse.type_info,
+                        page->tlbflush_timestamp);
+                errors++;
+            }
+            else
+                page->u.inuse.type_info += dir;
+        }
+
+        // adjust the general count
+        //
+        int count = page->count_info & PGC_count_mask;
+        count += dir;
+        ctot++;
+
+        if ( count < 0 )
+        {
+            APRINTK("Audit %d: general count went below zero pfn=%x t=%x 
ot=%x",
+                    d->id, page-frame_table,
+                    page->u.inuse.type_info,
+                    page->tlbflush_timestamp);
+            errors++;
+        }
+        else if ( (count & ~PGT_count_mask) != 0 )
+        {
+            APRINTK("Audit %d: general count overflowed pfn=%x t=%x ot=%x",
+                    d->id, page-frame_table,
+                    page->u.inuse.type_info,
+                    page->tlbflush_timestamp);
+            errors++;
+        }
+        else
+            page->count_info += dir;
+    }
+
+    void adjust_l2_page(unsigned long mfn, int adjtype)
+    {
+        unsigned long *pt = map_domain_mem(mfn << PAGE_SHIFT);
+        int i, limit;
+
+        if ( shadow_mode_external(d) )
+            limit = L2_PAGETABLE_ENTRIES;
+        else
+            limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
+
+        for ( i = 0; i < limit; i++ )
+        {
+            if ( pt[i] & _PAGE_PRESENT )
+            {
+                unsigned long l1mfn = pt[i] >> PAGE_SHIFT;
+                struct pfn_info *l1page = pfn_to_page(l1mfn);
+
+                if ( noisy )
+                {
+                    if ( shadow_enabled )
+                    {
+                        if ( page_get_owner(l1page) != NULL )
+                        {
+                            printk("L2: Bizarre shadow L1 page mfn=%p "
+                                   "belonging to a domain %p (id=%d)\n",
+                                   l1mfn,
+                                   page_get_owner(l1page),
+                                   page_get_owner(l1page)->id);
+                            errors++;
+                            continue;
+                        }
+                    }
+                    else
+                    {
+                        if ( page_get_owner(l1page) != d )
+                        {
+                            printk("L2: Skip bizarre L1 page mfn=%p "
+                                   "belonging to other dom %p (id=%d)\n",
+                                   l1mfn,
+                                   page_get_owner(l1page),
+                                   page_get_owner(l1page)->id);
+                            errors++;
+                            continue;
+                        }
+
+                        u32 page_type = l1page->u.inuse.type_info & 
PGT_type_mask;
+
+                        if ( page_type == PGT_l2_page_table )
+                        {
+                            printk("Audit %d: [%x] Found %s Linear PT "
+                                   "t=%x mfn=%p\n",
+                                   d->id, i, (l1mfn==mfn) ? "Self" : "Other",
+                                   l1page->u.inuse.type_info, l1mfn);
+                        }
+                        else if ( page_type != PGT_l1_page_table )
+                        {
+                            printk("Audit %d: [L2 mfn=%p i=%x] "
+                                   "Expected L1 t=%x mfn=%p\n",
+                                   d->id, mfn, i,
+                                   l1page->u.inuse.type_info, l1mfn);
+                            errors++;
+                        }
+                    }
+                }
+
+                adjust(l1page, adjtype);
+            }
+        }
+
+        unmap_domain_mem(pt);
+    }
+
+    void adjust_l1_page(unsigned long l1mfn)
+    {
+        unsigned long *pt = map_domain_mem(l1mfn << PAGE_SHIFT);
+        int i;
+
+        for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
+        {
+            if ( pt[i] & _PAGE_PRESENT )
+            {
+                unsigned long gmfn = pt[i] >> PAGE_SHIFT;
+                struct pfn_info *gpage = pfn_to_page(gmfn);
+
+                if ( gmfn < 0x100 )
+                {
+                    lowmem_mappings++;
+                    continue;
+                }
+
+                if ( gmfn > max_page )
+                {
+                    io_mappings++;
+                    continue;
+                }
+
+                if ( noisy )
+                {
+                    if ( pt[i] & _PAGE_RW )
+                    {
+                        // If it's not a writable page, complain.
+                        //
+                        if ( !((gpage->u.inuse.type_info & PGT_type_mask) ==
+                               PGT_writable_page) )
+                        {
+                            printk("Audit %d: [l1mfn=%p, i=%x] Illegal RW "
+                                   "t=%x mfn=%p\n",
+                                   d->id, l1mfn, i,
+                                   gpage->u.inuse.type_info, gmfn);
+                            errors++;
+                        }
+
+                        if ( shadow_enabled &&
+                             page_is_page_table(gpage) &&
+                             ! page_out_of_sync(gpage) )
+                        {
+                            printk("Audit %d: [l1mfn=%p, i=%x] Illegal RW of "
+                                   "page table gmfn=%p\n",
+                                   d->id, l1mfn, i, gmfn);
+                            errors++;
+                        }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Initial fullshadow checkin., BitKeeper Bot <=