ia64/xen-unstable

changeset 5102:775c8a5acfc8

bitkeeper revision 1.1509.1.2 (429261a0Qv1Wip4lt2f2ekcSvhVyxA)

Fix multi-domain scheduling bug
Signed-off by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Mon May 23 23:05:04 2005 +0000 (2005-05-23)
parents 6cbe0dc99129
children fa3c1c925b22
files xen/arch/ia64/Makefile xen/arch/ia64/domain.c xen/arch/ia64/hypercall.c xen/arch/ia64/patch/linux-2.6.11/entry.S xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/vcpu.c xen/arch/ia64/xenmisc.c
line diff
     1.1 --- a/xen/arch/ia64/Makefile	Mon May 23 15:10:40 2005 +0000
     1.2 +++ b/xen/arch/ia64/Makefile	Mon May 23 23:05:04 2005 +0000
     1.3 @@ -29,6 +29,9 @@ default: $(OBJS) head.o ia64lib.o xen.ld
     1.4  	$(LD) $(LDFLAGS) -T $(BASEDIR)/arch/$(TARGET_ARCH)/xen.lds.s -N \
     1.5  		-Map map.out head.o $(ALL_OBJS) -o $(TARGET)-syms
     1.6  	$(OBJCOPY) -R .note -R .comment -S $(TARGET)-syms $(TARGET)
     1.7 +	$(NM) -n $(TARGET)-syms | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)'\
     1.8 +		 > $(BASEDIR)/System.map
     1.9 +
    1.10  
    1.11  asm-offsets.s: asm-offsets.c $(BASEDIR)/include/asm-ia64/.offsets.h.stamp
    1.12  	$(CC) $(CFLAGS) -S -o $@ $<
     2.1 --- a/xen/arch/ia64/domain.c	Mon May 23 15:10:40 2005 +0000
     2.2 +++ b/xen/arch/ia64/domain.c	Mon May 23 23:05:04 2005 +0000
     2.3 @@ -116,6 +116,7 @@ void continue_cpu_idle_loop(void)
     2.4  #endif
     2.5  	    while ( !softirq_pending(cpu) )
     2.6  	        default_idle();
     2.7 +	    raise_softirq(SCHEDULE_SOFTIRQ);
     2.8  	    do_softirq();
     2.9  	}
    2.10  }
     3.1 --- a/xen/arch/ia64/hypercall.c	Mon May 23 15:10:40 2005 +0000
     3.2 +++ b/xen/arch/ia64/hypercall.c	Mon May 23 23:05:04 2005 +0000
     3.3 @@ -41,6 +41,10 @@ ia64_hypercall (struct pt_regs *regs)
     3.4  		ed->vcpu_info->arch.pending_interruption = 1;
     3.5  #endif
     3.6  		x = pal_emulator_static(regs->r28);
     3.7 +		if (regs->r28 == PAL_HALT_LIGHT) {
     3.8 +			do_sched_op(SCHEDOP_yield);
     3.9 +			//break;
    3.10 +		}
    3.11  		regs->r8 = x.status; regs->r9 = x.v0;
    3.12  		regs->r10 = x.v1; regs->r11 = x.v2;
    3.13  		break;
     4.1 --- a/xen/arch/ia64/patch/linux-2.6.11/entry.S	Mon May 23 15:10:40 2005 +0000
     4.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S	Mon May 23 23:05:04 2005 +0000
     4.3 @@ -1,5 +1,5 @@
     4.4 ---- /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
     4.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/entry.S	2005-05-18 12:40:51.000000000 -0700
     4.6 +--- ../../linux-2.6.11/arch/ia64/kernel/entry.S	2005-03-02 00:37:50.000000000 -0700
     4.7 ++++ arch/ia64/entry.S	2005-05-23 16:49:23.000000000 -0600
     4.8  @@ -46,6 +46,7 @@
     4.9   
    4.10   #include "minstate.h"
    4.11 @@ -97,11 +97,13 @@
    4.12   	;;					// added stop bits to prevent r8 dependency
    4.13   END(ia64_ret_from_clone)
    4.14   	// fall through
    4.15 -@@ -700,19 +732,25 @@
    4.16 +@@ -700,19 +732,27 @@
    4.17   .work_processed_syscall:
    4.18   	adds r2=PT(LOADRS)+16,r12
    4.19   	adds r3=PT(AR_BSPSTORE)+16,r12
    4.20 -+#ifndef XEN
    4.21 ++#ifdef XEN
    4.22 ++	;;
    4.23 ++#else
    4.24   	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
    4.25   	;;
    4.26   (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
    4.27 @@ -123,7 +125,7 @@
    4.28   	;;
    4.29   	// start restoring the state saved on the kernel stack (struct pt_regs):
    4.30   	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
    4.31 -@@ -757,7 +795,11 @@
    4.32 +@@ -757,7 +797,11 @@
    4.33   	;;
    4.34   	ld8.fill r12=[r2]	// restore r12 (sp)
    4.35   	ld8.fill r15=[r3]	// restore r15
    4.36 @@ -135,7 +137,7 @@
    4.37   	;;
    4.38   (pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
    4.39   (pUStk) st1 [r14]=r17
    4.40 -@@ -814,9 +856,18 @@
    4.41 +@@ -814,9 +858,18 @@
    4.42   (pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
    4.43   #endif
    4.44   .work_processed_kernel:
    4.45 @@ -154,7 +156,7 @@
    4.46   	adds r21=PT(PR)+16,r12
    4.47   	;;
    4.48   
    4.49 -@@ -828,17 +879,20 @@
    4.50 +@@ -828,17 +881,20 @@
    4.51   	ld8 r28=[r2],8		// load b6
    4.52   	adds r29=PT(R24)+16,r12
    4.53   
    4.54 @@ -176,7 +178,7 @@
    4.55   	;;
    4.56   	ld8 r31=[r2],16		// load ar.ssd
    4.57   	ld8.fill r8=[r3],16
    4.58 -@@ -934,7 +988,11 @@
    4.59 +@@ -934,7 +990,11 @@
    4.60   	shr.u r18=r19,16	// get byte size of existing "dirty" partition
    4.61   	;;
    4.62   	mov r16=ar.bsp		// get existing backing store pointer
    4.63 @@ -188,7 +190,7 @@
    4.64   	;;
    4.65   	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
    4.66   (pKStk)	br.cond.dpnt skip_rbs_switch
    4.67 -@@ -1069,6 +1127,7 @@
    4.68 +@@ -1069,6 +1129,7 @@
    4.69   	mov pr=r31,-1		// I0
    4.70   	rfi			// B
    4.71   
    4.72 @@ -196,7 +198,7 @@
    4.73   	/*
    4.74   	 * On entry:
    4.75   	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
    4.76 -@@ -1130,6 +1189,7 @@
    4.77 +@@ -1130,6 +1191,7 @@
    4.78   	ld8 r8=[r2]
    4.79   	ld8 r10=[r3]
    4.80   	br.cond.sptk.many .work_processed_syscall	// re-check
    4.81 @@ -204,7 +206,7 @@
    4.82   
    4.83   END(ia64_leave_kernel)
    4.84   
    4.85 -@@ -1166,6 +1226,7 @@
    4.86 +@@ -1166,6 +1228,7 @@
    4.87   	br.ret.sptk.many rp
    4.88   END(ia64_invoke_schedule_tail)
    4.89   
    4.90 @@ -212,7 +214,7 @@
    4.91   	/*
    4.92   	 * Setup stack and call do_notify_resume_user().  Note that pSys and pNonSys need to
    4.93   	 * be set up by the caller.  We declare 8 input registers so the system call
    4.94 -@@ -1264,6 +1325,7 @@
    4.95 +@@ -1264,6 +1327,7 @@
    4.96   	mov ar.unat=r9
    4.97   	br.many b7
    4.98   END(sys_rt_sigreturn)
    4.99 @@ -220,7 +222,7 @@
   4.100   
   4.101   GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
   4.102   	.prologue
   4.103 -@@ -1278,6 +1340,7 @@
   4.104 +@@ -1278,6 +1342,7 @@
   4.105   	br.cond.sptk.many rp				// goes to ia64_leave_kernel
   4.106   END(ia64_prepare_handle_unaligned)
   4.107   
   4.108 @@ -228,7 +230,7 @@
   4.109   	//
   4.110   	// unw_init_running(void (*callback)(info, arg), void *arg)
   4.111   	//
   4.112 -@@ -1585,3 +1648,4 @@
   4.113 +@@ -1585,3 +1650,4 @@
   4.114   	data8 sys_ni_syscall
   4.115   
   4.116   	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
     5.1 --- a/xen/arch/ia64/tools/mkbuildtree	Mon May 23 15:10:40 2005 +0000
     5.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Mon May 23 23:05:04 2005 +0000
     5.3 @@ -307,7 +307,6 @@ softlink include/linux/timex.h include/a
     5.4  softlink include/linux/topology.h include/asm-ia64/linux/topology.h
     5.5  softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
     5.6  softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
     5.7 -softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
     5.8  
     5.9  null include/asm-ia64/linux/file.h
    5.10  null include/asm-ia64/linux/module.h
     6.1 --- a/xen/arch/ia64/vcpu.c	Mon May 23 15:10:40 2005 +0000
     6.2 +++ b/xen/arch/ia64/vcpu.c	Mon May 23 23:05:04 2005 +0000
     6.3 @@ -638,7 +638,15 @@ IA64FAULT vcpu_get_ivr(VCPU *vcpu, UINT6
     6.4  {
     6.5  	int i;
     6.6  	UINT64 vector, mask;
     6.7 -#if 1
     6.8 +
     6.9 +#define HEARTBEAT_FREQ 16	// period in seconds
    6.10 +#ifdef HEARTBEAT_FREQ
    6.11 +#define N_DOMS 16	// period in seconds
    6.12 +	static long count[N_DOMS] = { 0 };
    6.13 +	REGS *regs = vcpu_regs(vcpu);
    6.14 +	unsigned domid = vcpu->domain->domain_id;
    6.15 +#endif
    6.16 +#ifdef IRQ_DEBUG
    6.17  	static char firstivr = 1;
    6.18  	static char firsttime[256];
    6.19  	if (firstivr) {
    6.20 @@ -654,9 +662,21 @@ IA64FAULT vcpu_get_ivr(VCPU *vcpu, UINT6
    6.21  		*pval = vector;
    6.22  		return IA64_NO_FAULT;
    6.23  	}
    6.24 +#ifdef HEARTBEAT_FREQ
    6.25 +	if (domid >= N_DOMS) domid = N_DOMS-1;
    6.26 +	if (vector == (PSCB(vcpu,itv) & 0xff) &&
    6.27 +	    !(++count[domid] & ((HEARTBEAT_FREQ*1024)-1))) {
    6.28 +		printf("Dom%d heartbeat... iip=%p,psr.i=%d,pend=%d\n",
    6.29 +			domid, regs->cr_iip,
    6.30 +			current->vcpu_info->arch.interrupt_delivery_enabled,
    6.31 +			current->vcpu_info->arch.pending_interruption);
    6.32 +		count[domid] = 0;
    6.33 +		dump_runq();
    6.34 +	}
    6.35 +#endif
    6.36  	// now have an unmasked, pending, deliverable vector!
    6.37  	// getting ivr has "side effects"
    6.38 -#if 0
    6.39 +#ifdef IRQ_DEBUG
    6.40  	if (firsttime[vector]) {
    6.41  		printf("*** First get_ivr on vector=%d,itc=%lx\n",
    6.42  			vector,ia64_get_itc());
    6.43 @@ -989,6 +1009,10 @@ IA64FAULT vcpu_set_itc(VCPU *vcpu, UINT6
    6.44  
    6.45  	UINT64 newnow = val, min_delta;
    6.46  
    6.47 +#define DISALLOW_SETTING_ITC_FOR_NOW
    6.48 +#ifdef DISALLOW_SETTING_ITC_FOR_NOW
    6.49 +printf("vcpu_set_itc: Setting ar.itc is currently disabled\n");
    6.50 +#else
    6.51  	local_irq_disable();
    6.52  	if (olditm) {
    6.53  printf("**** vcpu_set_itc(%lx): vitm changed to %lx\n",val,newnow+d);
    6.54 @@ -1008,6 +1032,7 @@ printf("**** vcpu_set_itc(%lx): vitm cha
    6.55  		//using_xen_as_itm++;
    6.56  	}
    6.57  	local_irq_enable();
    6.58 +#endif
    6.59  	return (IA64_NO_FAULT);
    6.60  }
    6.61  
     7.1 --- a/xen/arch/ia64/xenmisc.c	Mon May 23 15:10:40 2005 +0000
     7.2 +++ b/xen/arch/ia64/xenmisc.c	Mon May 23 23:05:04 2005 +0000
     7.3 @@ -262,8 +262,8 @@ void context_switch(struct exec_domain *
     7.4  static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
     7.5  static int i = 100;
     7.6  int id = ((struct exec_domain *)current)->domain->domain_id & 0xf;
     7.7 -if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
     7.8 -if (!i--) { printk("+",id); cnt[id] = 100; }
     7.9 +if (!cnt[id]--) { printk("%x",id); cnt[id] = 500; }
    7.10 +if (!i--) { printk("+",id); cnt[id] = 1000; }
    7.11  }
    7.12  	clear_bit(_VCPUF_running, &prev->vcpu_flags);
    7.13  	//if (!is_idle_task(next->domain) )
    7.14 @@ -273,7 +273,10 @@ if (!i--) { printk("+",id); cnt[id] = 10
    7.15  		vmx_load_all_rr(current);
    7.16  	return;
    7.17  #else // CONFIG_VTI
    7.18 -	load_region_regs(current);
    7.19 +	if (!is_idle_task(current->domain)) {
    7.20 +		load_region_regs(current);
    7.21 +		if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
    7.22 +	}
    7.23  	if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
    7.24  #endif // CONFIG_VTI
    7.25  }