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

[Xen-changelog] Fix multi-domain scheduling bug



ChangeSet 1.1509.1.2, 2005/05/23 17:05:04-06:00, djm@xxxxxxxxxxxxxxx

        Fix multi-domain scheduling bug
        Signed-off by: Dan Magenheimer <dan.magenheimer@xxxxxx>



 Makefile                   |    3 +++
 domain.c                   |    1 +
 hypercall.c                |    4 ++++
 patch/linux-2.6.11/entry.S |   25 ++++++++++++-------------
 tools/mkbuildtree          |    1 -
 vcpu.c                     |   29 +++++++++++++++++++++++++++--
 xenmisc.c                  |    9 ++++++---
 7 files changed, 53 insertions(+), 19 deletions(-)


diff -Nru a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile    2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/Makefile    2005-05-26 14:01:26 -04:00
@@ -29,6 +29,9 @@
        $(LD) $(LDFLAGS) -T $(BASEDIR)/arch/$(TARGET_ARCH)/xen.lds.s -N \
                -Map map.out head.o $(ALL_OBJS) -o $(TARGET)-syms
        $(OBJCOPY) -R .note -R .comment -S $(TARGET)-syms $(TARGET)
+       $(NM) -n $(TARGET)-syms | grep -v '\( [aUw] \)\|\(__crc_\)\|\( 
\$[adt]\)'\
+                > $(BASEDIR)/System.map
+
 
 asm-offsets.s: asm-offsets.c $(BASEDIR)/include/asm-ia64/.offsets.h.stamp
        $(CC) $(CFLAGS) -S -o $@ $<
diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/domain.c    2005-05-26 14:01:26 -04:00
@@ -116,6 +116,7 @@
 #endif
            while ( !softirq_pending(cpu) )
                default_idle();
+           raise_softirq(SCHEDULE_SOFTIRQ);
            do_softirq();
        }
 }
diff -Nru a/xen/arch/ia64/hypercall.c b/xen/arch/ia64/hypercall.c
--- a/xen/arch/ia64/hypercall.c 2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/hypercall.c 2005-05-26 14:01:26 -04:00
@@ -41,6 +41,10 @@
                ed->vcpu_info->arch.pending_interruption = 1;
 #endif
                x = pal_emulator_static(regs->r28);
+               if (regs->r28 == PAL_HALT_LIGHT) {
+                       do_sched_op(SCHEDOP_yield);
+                       //break;
+               }
                regs->r8 = x.status; regs->r9 = x.v0;
                regs->r10 = x.v1; regs->r11 = x.v2;
                break;
diff -Nru a/xen/arch/ia64/patch/linux-2.6.11/entry.S 
b/xen/arch/ia64/patch/linux-2.6.11/entry.S
--- a/xen/arch/ia64/patch/linux-2.6.11/entry.S  2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S  2005-05-26 14:01:26 -04:00
@@ -1,5 +1,5 @@
---- 
/home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/kernel/entry.S
      2005-03-01 23:37:50.000000000 -0800
-+++ 
/home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/entry.S     
   2005-05-18 12:40:51.000000000 -0700
+--- ../../linux-2.6.11/arch/ia64/kernel/entry.S        2005-03-02 
00:37:50.000000000 -0700
++++ arch/ia64/entry.S  2005-05-23 16:49:23.000000000 -0600
 @@ -46,6 +46,7 @@
  
  #include "minstate.h"
@@ -97,11 +97,13 @@
        ;;                                      // added stop bits to prevent 
r8 dependency
  END(ia64_ret_from_clone)
        // fall through
-@@ -700,19 +732,25 @@
+@@ -700,19 +732,27 @@
  .work_processed_syscall:
        adds r2=PT(LOADRS)+16,r12
        adds r3=PT(AR_BSPSTORE)+16,r12
-+#ifndef XEN
++#ifdef XEN
++      ;;
++#else
        adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
        ;;
  (p6)  ld4 r31=[r18]                           // load 
current_thread_info()->flags
@@ -123,7 +125,7 @@
        ;;
        // start restoring the state saved on the kernel stack (struct pt_regs):
        ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
-@@ -757,7 +795,11 @@
+@@ -757,7 +797,11 @@
        ;;
        ld8.fill r12=[r2]       // restore r12 (sp)
        ld8.fill r15=[r3]       // restore r15
@@ -135,7 +137,7 @@
        ;;
  (pUStk)       ld4 r3=[r3]             // r3 = cpu_data->phys_stacked_size_p8
  (pUStk) st1 [r14]=r17
-@@ -814,9 +856,18 @@
+@@ -814,9 +858,18 @@
  (pUStk)       cmp.eq.unc p6,p0=r0,r0          // p6 <- pUStk
  #endif
  .work_processed_kernel:
@@ -154,7 +156,7 @@
        adds r21=PT(PR)+16,r12
        ;;
  
-@@ -828,17 +879,20 @@
+@@ -828,17 +881,20 @@
        ld8 r28=[r2],8          // load b6
        adds r29=PT(R24)+16,r12
  
@@ -176,7 +178,7 @@
        ;;
        ld8 r31=[r2],16         // load ar.ssd
        ld8.fill r8=[r3],16
-@@ -934,7 +988,11 @@
+@@ -934,7 +990,11 @@
        shr.u r18=r19,16        // get byte size of existing "dirty" partition
        ;;
        mov r16=ar.bsp          // get existing backing store pointer
@@ -188,7 +190,7 @@
        ;;
        ld4 r17=[r17]           // r17 = cpu_data->phys_stacked_size_p8
  (pKStk)       br.cond.dpnt skip_rbs_switch
-@@ -1069,6 +1127,7 @@
+@@ -1069,6 +1129,7 @@
        mov pr=r31,-1           // I0
        rfi                     // B
  
@@ -196,7 +198,7 @@
        /*
         * On entry:
         *      r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
-@@ -1130,6 +1189,7 @@
+@@ -1130,6 +1191,7 @@
        ld8 r8=[r2]
        ld8 r10=[r3]
        br.cond.sptk.many .work_processed_syscall       // re-check
@@ -204,7 +206,7 @@
  
  END(ia64_leave_kernel)
  
-@@ -1166,6 +1226,7 @@
+@@ -1166,6 +1228,7 @@
        br.ret.sptk.many rp
  END(ia64_invoke_schedule_tail)
  
@@ -212,7 +214,7 @@
        /*
         * Setup stack and call do_notify_resume_user().  Note that pSys and 
pNonSys need to
         * be set up by the caller.  We declare 8 input registers so the system 
call
-@@ -1264,6 +1325,7 @@
+@@ -1264,6 +1327,7 @@
        mov ar.unat=r9
        br.many b7
  END(sys_rt_sigreturn)
@@ -220,7 +222,7 @@
  
  GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
        .prologue
-@@ -1278,6 +1340,7 @@
+@@ -1278,6 +1342,7 @@
        br.cond.sptk.many rp                            // goes to 
ia64_leave_kernel
  END(ia64_prepare_handle_unaligned)
  
@@ -228,7 +230,7 @@
        //
        // unw_init_running(void (*callback)(info, arg), void *arg)
        //
-@@ -1585,3 +1648,4 @@
+@@ -1585,3 +1650,4 @@
        data8 sys_ni_syscall
  
        .org sys_call_table + 8*NR_syscalls     // guard against failures to 
increase NR_syscalls
diff -Nru a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree
--- a/xen/arch/ia64/tools/mkbuildtree   2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/tools/mkbuildtree   2005-05-26 14:01:26 -04:00
@@ -307,7 +307,6 @@
 softlink include/linux/topology.h include/asm-ia64/linux/topology.h
 softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
 softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
-softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
 
 null include/asm-ia64/linux/file.h
 null include/asm-ia64/linux/module.h
diff -Nru a/xen/arch/ia64/vcpu.c b/xen/arch/ia64/vcpu.c
--- a/xen/arch/ia64/vcpu.c      2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/vcpu.c      2005-05-26 14:01:27 -04:00
@@ -638,7 +638,15 @@
 {
        int i;
        UINT64 vector, mask;
-#if 1
+
+#define HEARTBEAT_FREQ 16      // period in seconds
+#ifdef HEARTBEAT_FREQ
+#define N_DOMS 16      // period in seconds
+       static long count[N_DOMS] = { 0 };
+       REGS *regs = vcpu_regs(vcpu);
+       unsigned domid = vcpu->domain->domain_id;
+#endif
+#ifdef IRQ_DEBUG
        static char firstivr = 1;
        static char firsttime[256];
        if (firstivr) {
@@ -654,9 +662,21 @@
                *pval = vector;
                return IA64_NO_FAULT;
        }
+#ifdef HEARTBEAT_FREQ
+       if (domid >= N_DOMS) domid = N_DOMS-1;
+       if (vector == (PSCB(vcpu,itv) & 0xff) &&
+           !(++count[domid] & ((HEARTBEAT_FREQ*1024)-1))) {
+               printf("Dom%d heartbeat... iip=%p,psr.i=%d,pend=%d\n",
+                       domid, regs->cr_iip,
+                       current->vcpu_info->arch.interrupt_delivery_enabled,
+                       current->vcpu_info->arch.pending_interruption);
+               count[domid] = 0;
+               dump_runq();
+       }
+#endif
        // now have an unmasked, pending, deliverable vector!
        // getting ivr has "side effects"
-#if 0
+#ifdef IRQ_DEBUG
        if (firsttime[vector]) {
                printf("*** First get_ivr on vector=%d,itc=%lx\n",
                        vector,ia64_get_itc());
@@ -989,6 +1009,10 @@
 
        UINT64 newnow = val, min_delta;
 
+#define DISALLOW_SETTING_ITC_FOR_NOW
+#ifdef DISALLOW_SETTING_ITC_FOR_NOW
+printf("vcpu_set_itc: Setting ar.itc is currently disabled\n");
+#else
        local_irq_disable();
        if (olditm) {
 printf("**** vcpu_set_itc(%lx): vitm changed to %lx\n",val,newnow+d);
@@ -1008,6 +1032,7 @@
                //using_xen_as_itm++;
        }
        local_irq_enable();
+#endif
        return (IA64_NO_FAULT);
 }
 
diff -Nru a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c
--- a/xen/arch/ia64/xenmisc.c   2005-05-26 14:01:26 -04:00
+++ b/xen/arch/ia64/xenmisc.c   2005-05-26 14:01:26 -04:00
@@ -262,8 +262,8 @@
 static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
 static int i = 100;
 int id = ((struct exec_domain *)current)->domain->domain_id & 0xf;
-if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
-if (!i--) { printk("+",id); cnt[id] = 100; }
+if (!cnt[id]--) { printk("%x",id); cnt[id] = 500; }
+if (!i--) { printk("+",id); cnt[id] = 1000; }
 }
        clear_bit(_VCPUF_running, &prev->vcpu_flags);
        //if (!is_idle_task(next->domain) )
@@ -273,7 +273,10 @@
                vmx_load_all_rr(current);
        return;
 #else // CONFIG_VTI
-       load_region_regs(current);
+       if (!is_idle_task(current->domain)) {
+               load_region_regs(current);
+               if (vcpu_timer_expired(current)) vcpu_pend_timer(current);

_______________________________________________
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®.