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

[Xen-changelog] No direct entry to __enter_scheduler allowed. Must always pass through



ChangeSet 1.1367.1.1, 2005/03/25 13:46:20+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        No direct entry to __enter_scheduler allowed. Must always pass through
        softirq handler. Also domain_crash() now returns and defers
        descehduling from local CPU: old behaviour is still provided by
        domain_crash_synchronous().
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/ia64/domain.c         |    5 +-
 arch/x86/domain.c          |    3 +
 arch/x86/mm.c              |   48 ++++------------------------
 arch/x86/shadow.c          |   16 +++++----
 arch/x86/traps.c           |   29 +----------------
 arch/x86/vmx.c             |   19 +++++------
 arch/x86/vmx_intercept.c   |    2 -
 arch/x86/vmx_io.c          |    6 +--
 arch/x86/vmx_platform.c    |   14 ++++----
 arch/x86/x86_32/entry.S    |   24 ++++++++------
 arch/x86/x86_64/entry.S    |   14 ++++----
 common/domain.c            |   28 ++++++++--------
 common/schedule.c          |    9 +----
 drivers/char/console.c     |    2 -
 include/asm-x86/debugger.h |   76 +++++++++++----------------------------------
 include/asm-x86/vmx_vmcs.h |    2 -
 include/xen/sched.h        |   15 +++++++-
 17 files changed, 119 insertions(+), 193 deletions(-)


diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-03-25 09:03:41 -05:00
+++ b/xen/arch/ia64/domain.c    2005-03-25 09:03:41 -05:00
@@ -102,8 +102,9 @@
 {
     /* Just some sanity to ensure that the scheduler is set up okay. */
     ASSERT(current->domain == IDLE_DOMAIN_ID);
-    domain_unpause_by_systemcontroller(current);
-    __enter_scheduler();
+    domain_unpause_by_systemcontroller(current); 
+    raise_softirq(SCHEDULE_SOFTIRQ);
+    do_softirq();
 
     /*
      * Declares CPU setup done to the boot processor.
diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-03-25 09:03:41 -05:00
+++ b/xen/arch/x86/domain.c     2005-03-25 09:03:41 -05:00
@@ -74,7 +74,8 @@
     /* Just some sanity to ensure that the scheduler is set up okay. */
     ASSERT(current->domain->id == IDLE_DOMAIN_ID);
     domain_unpause_by_systemcontroller(current->domain);
-    __enter_scheduler();
+    raise_softirq(SCHEDULE_SOFTIRQ);
+    do_softirq();
 
     /*
      * Declares CPU setup done to the boot processor.
diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-03-25 09:03:41 -05:00
+++ b/xen/arch/x86/mm.c 2005-03-25 09:03:41 -05:00
@@ -1669,8 +1669,8 @@
     if ( unlikely(shadow_mode_enabled(d)) )
         check_pagetable(d, ed->arch.guest_table, "pre-mmu"); /* debug */
 
-    if ( unlikely(shadow_mode_translate(d) ) )
-        domain_crash();
+    if ( unlikely(shadow_mode_translate(d)) )
+        domain_crash_synchronous();
 
     /*
      * If we are resuming after preemption, read how much work we have already
@@ -2033,8 +2033,8 @@
     if ( unlikely(!__addr_ok(va)) )
         return -EINVAL;
 
-    if ( unlikely(shadow_mode_translate(d) ) )
-        domain_crash();
+    if ( unlikely(shadow_mode_translate(d)) )
+        domain_crash_synchronous();
 
     LOCK_BIGLOCK(d);
 
@@ -2312,7 +2312,7 @@
         MEM_LOG("ptwr: Could not read pte at %p\n", ptep);
         /*
          * Really a bug. We could read this PTE during the initial fault,
-         * and pagetables can't have changed meantime. XXX Multi-CPU guests?
+         * and pagetables can't have changed meantime.
          */
         BUG();
     }
@@ -2339,7 +2339,7 @@
         MEM_LOG("ptwr: Could not update pte at %p\n", ptep);
         /*
          * Really a bug. We could write this PTE during the initial fault,
-         * and pagetables can't have changed meantime. XXX Multi-CPU guests?
+         * and pagetables can't have changed meantime.
          */
         BUG();
     }
@@ -2395,6 +2395,7 @@
             unmap_domain_mem(pl1e);
             ptwr_info[cpu].ptinfo[which].l1va = 0;
             domain_crash();
+            return;
         }
         
         if ( unlikely(sl1e != NULL) )
@@ -2688,6 +2689,7 @@
         unmap_domain_mem(ptwr_info[cpu].ptinfo[which].pl1e);
         ptwr_info[cpu].ptinfo[which].l1va = 0;
         domain_crash();
+        return 0;
     }
     
     return EXCRET_fault_fixed;
@@ -2724,40 +2726,6 @@
 /************************************************************************/
 
 #ifndef NDEBUG
-
-void ptwr_status(void)
-{
-    unsigned long pte, *ptep, pfn;
-    struct pfn_info *page;
-    int cpu = smp_processor_id();
-
-    ptep = (unsigned long *)&linear_pg_table
-        [ptwr_info[cpu].ptinfo[PTWR_PT_INACTIVE].l1va>>PAGE_SHIFT];
-
-    if ( __get_user(pte, ptep) ) {
-        MEM_LOG("ptwr: Could not read pte at %p\n", ptep);
-        domain_crash();
-    }
-
-    pfn = pte >> PAGE_SHIFT;
-    page = &frame_table[pfn];
-    printk("need to alloc l1 page %p\n", page);
-    /* make pt page writable */
-    printk("need to make read-only l1-page at %p is %p\n",
-           ptep, pte);
-
-    if ( ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va == 0 )
-        return;
-
-    if ( __get_user(pte, (unsigned long *)
-                    ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va) ) {
-        MEM_LOG("ptwr: Could not read pte at %p\n", (unsigned long *)
-                ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va);
-        domain_crash();
-    }
-    pfn = pte >> PAGE_SHIFT;
-    page = &frame_table[pfn];
-}
 
 void audit_pagelist(struct domain *d)
 {
diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     2005-03-25 09:03:41 -05:00
+++ b/xen/arch/x86/shadow.c     2005-03-25 09:03:41 -05:00
@@ -655,15 +655,13 @@
                              &linear_pg_table[va >> PAGE_SHIFT])) )
     {
         SH_VVLOG("shadow_fault - EXIT: read gpte faulted2" );
-        shadow_unlock(d);
-        return 0;
+        goto fail;
     }
 
     if ( unlikely(!(gpte & _PAGE_PRESENT)) )
     {
         SH_VVLOG("shadow_fault - EXIT: gpte not present2 (%lx)",gpte );
-        shadow_unlock(d);
-        return 0;
+        goto fail;
     }
 
     /* Write fault? */
@@ -673,8 +671,7 @@
         {
             /* Write fault on a read-only mapping. */
             SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%lx)", gpte);
-            shadow_unlock(d);
-            return 0;
+            goto fail;
         }
 
         l1pte_write_fault(d, &gpte, &spte);
@@ -691,7 +688,10 @@
     /* XXX Watch out for read-only L2 entries! (not used in Linux). */
     if ( unlikely(__put_user(gpte, (unsigned long *)
                              &linear_pg_table[va >> PAGE_SHIFT])) )
+    {
         domain_crash();
+        goto fail;
+    }
 
     /*
      * Update of shadow PTE can fail because the L1 p.t. is not shadowed,
@@ -712,6 +712,10 @@
 
     check_pagetable(d, ed->arch.guest_table, "post-sf");
     return EXCRET_fault_fixed;
+
+ fail:
+    shadow_unlock(d);
+    return 0;
 }
 
 
diff -Nru a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      2005-03-25 09:03:42 -05:00
+++ b/xen/arch/x86/traps.c      2005-03-25 09:03:42 -05:00
@@ -223,18 +223,7 @@
         show_registers(regs);
         panic("CPU%d FATAL TRAP: vector = 3 (Int3)\n", smp_processor_id());
     } 
-#ifdef DOMU_DEBUG
-    else if ( KERNEL_MODE(ed, regs) && ed->domain->id != 0 ) 
-    {
-        if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->ed_flags) ) {
-            while (ed == current)
-                __enter_scheduler();
-            domain_pause_by_systemcontroller(ed->domain);
-        }
-        
-        return 0;
-    }
-#endif /* DOMU_DEBUG */
+
     ti = current->arch.traps + 3;
     tb->flags = TBF_EXCEPTION;
     tb->cs    = ti->cs;
@@ -950,8 +939,6 @@
     struct exec_domain *ed = current;
     struct trap_bounce *tb = &ed->arch.trap_bounce;
 
-    DEBUGGER_trap_entry(TRAP_debug, regs);
-
     __asm__ __volatile__("mov %%db6,%0" : "=r" (condition));
 
     /* Mask out spurious debug traps due to lazy DR7 setting */
@@ -962,6 +949,8 @@
         goto out;
     }
 
+    DEBUGGER_trap_entry(TRAP_debug, regs);
+
     if ( !GUEST_MODE(regs) )
     {
         /* Clear TF just for absolute sanity. */
@@ -974,19 +963,7 @@
          */
         goto out;
     } 
-#ifdef DOMU_DEBUG
-    else if ( KERNEL_MODE(ed, regs) && ed->domain->id != 0 ) 
-    {
-        regs->eflags &= ~EF_TF;
-        if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->ed_flags) ) {
-            while (ed == current)
-                __enter_scheduler();
-            domain_pause_by_systemcontroller(ed->domain);
-        }
 
-        goto out;
-    }    
-#endif /* DOMU_DEBUG */
     /* Save debug status register where guest OS can peek at it */
     ed->arch.debugreg[6] = condition;
 
diff -Nru a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        2005-03-25 09:03:41 -05:00
+++ b/xen/arch/x86/vmx.c        2005-03-25 09:03:41 -05:00
@@ -22,6 +22,7 @@
 #include <xen/lib.h>
 #include <xen/trace.h>
 #include <xen/sched.h>
+#include <xen/softirq.h>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

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