ia64/xen-unstable

changeset 1300:22991e70f58f

bitkeeper revision 1.862 (407bfad05PmdmZtBnhfJMLp1dqPBYQ)

Various cleanups. Also fix a bug in Xenolinux timer interrupt.
author kaf24@scramble.cl.cam.ac.uk
date Tue Apr 13 14:36:00 2004 +0000 (2004-04-13)
parents fbb0f8e4a3f6
children d8fc9ec791e9
files xen/common/schedule.c xen/include/xen/event.h xenolinux-2.4.25-sparse/arch/xen/kernel/entry.S xenolinux-2.4.25-sparse/arch/xen/kernel/time.c xenolinux-2.4.25-sparse/include/asm-xen/system.h
line diff
     1.1 --- a/xen/common/schedule.c	Fri Apr 09 11:24:54 2004 +0000
     1.2 +++ b/xen/common/schedule.c	Tue Apr 13 14:36:00 2004 +0000
     1.3 @@ -558,8 +558,6 @@ static void t_timer_fn(unsigned long unu
     1.4  
     1.5      TRACE_0D(TRC_SCHED_T_TIMER_FN);
     1.6  
     1.7 -    TRACE_0D(TRC_SCHED_T_TIMER_FN);
     1.8 -
     1.9      if ( !is_idle_task(p) )
    1.10          send_guest_virq(p, VIRQ_TIMER);
    1.11  
     2.1 --- a/xen/include/xen/event.h	Fri Apr 09 11:24:54 2004 +0000
     2.2 +++ b/xen/include/xen/event.h	Tue Apr 13 14:36:00 2004 +0000
     2.3 @@ -56,7 +56,7 @@ static inline void evtchn_set_pending(st
     2.4           !test_and_set_bit(port>>5, &s->evtchn_pending_sel) )
     2.5      {
     2.6          /* The VCPU pending flag must be set /after/ update to evtchn-pend. */
     2.7 -        p->shared_info->vcpu_data[0].evtchn_upcall_pending = 1;
     2.8 +        s->vcpu_data[0].evtchn_upcall_pending = 1;
     2.9          guest_schedule_to_run(p);
    2.10      }
    2.11  }
     3.1 --- a/xenolinux-2.4.25-sparse/arch/xen/kernel/entry.S	Fri Apr 09 11:24:54 2004 +0000
     3.2 +++ b/xenolinux-2.4.25-sparse/arch/xen/kernel/entry.S	Tue Apr 13 14:36:00 2004 +0000
     3.3 @@ -15,7 +15,7 @@
     3.4   * I changed all the .align's to 4 (16 byte alignment), as that's faster
     3.5   * on a 486.
     3.6   *
     3.7 - * Stack layout in 'ret_from_system_call':
     3.8 + * Stack layout in 'ret_to_user':
     3.9   * 	ptrace needs to have all regs on the stack.
    3.10   *	if the order here is changed, it needs to be
    3.11   *	updated in fork.c:copy_process, signal.c:do_signal,
    3.12 @@ -157,7 +157,7 @@ ENTRY(lcall7)
    3.13  	call *%edx
    3.14  	addl $4, %esp
    3.15  	popl %eax
    3.16 -	jmp ret_from_sys_call
    3.17 +	jmp ret_to_user
    3.18  
    3.19  ENTRY(lcall27)
    3.20  	pushfl			# We get a different stack layout with call
    3.21 @@ -181,7 +181,7 @@ ENTRY(lcall27)
    3.22  	call *%edx
    3.23  	addl $4, %esp
    3.24  	popl %eax
    3.25 -	jmp ret_from_sys_call
    3.26 +	jmp ret_to_user
    3.27  
    3.28  ENTRY(ret_from_fork)
    3.29  	pushl %ebx
    3.30 @@ -190,7 +190,7 @@ ENTRY(ret_from_fork)
    3.31  	GET_CURRENT(%ebx)
    3.32  	testb $0x02,tsk_ptrace(%ebx)	# PT_TRACESYS
    3.33  	jne tracesys_exit
    3.34 -	jmp	ret_from_sys_call
    3.35 +	jmp ret_to_user
    3.36  
    3.37  /*
    3.38   * Return to user mode is not as complex as all this looks,
    3.39 @@ -208,15 +208,15 @@ ENTRY(system_call)
    3.40  	jae badsys
    3.41  	call *SYMBOL_NAME(sys_call_table)(,%eax,4)
    3.42  	movl %eax,EAX(%esp)		# save the return value
    3.43 -ENTRY(ret_from_sys_call)
    3.44 +ret_to_user:
    3.45          movl SYMBOL_NAME(HYPERVISOR_shared_info),%esi
    3.46          movb $1,evtchn_upcall_mask(%esi) # make tests atomic
    3.47 -ret_syscall_tests:
    3.48 +ret_to_user_nocli:
    3.49  	cmpl $0,need_resched(%ebx)
    3.50 -	jne reschedule
    3.51 +	jne  reschedule
    3.52  	cmpl $0,sigpending(%ebx)
    3.53  	je   safesti                    # ensure need_resched updates are seen
    3.54 -signal_return:
    3.55 +/*signal_return:*/
    3.56  	movb $0,evtchn_upcall_mask(%esi) # reenable event callbacks
    3.57  	movl %esp,%eax
    3.58  	xorl %edx,%edx
    3.59 @@ -238,10 +238,10 @@ tracesys:
    3.60  	movl %eax,EAX(%esp)		# save the return value
    3.61  tracesys_exit:
    3.62  	call SYMBOL_NAME(syscall_trace)
    3.63 -	jmp ret_from_sys_call
    3.64 +	jmp ret_to_user
    3.65  badsys:
    3.66  	movl $-ENOSYS,EAX(%esp)
    3.67 -	jmp ret_from_sys_call
    3.68 +	jmp ret_to_user
    3.69  
    3.70  	ALIGN
    3.71  ENTRY(ret_from_intr)
    3.72 @@ -249,14 +249,14 @@ ENTRY(ret_from_intr)
    3.73  ret_from_exception:
    3.74  	movb CS(%esp),%al
    3.75  	testl $2,%eax
    3.76 -	jne ret_from_sys_call
    3.77 +	jne ret_to_user
    3.78  	jmp restore_all
    3.79  
    3.80  	ALIGN
    3.81  reschedule:
    3.82          movb $0,evtchn_upcall_mask(%esi)  # reenable event callbacks
    3.83  	call SYMBOL_NAME(schedule)        # test
    3.84 -	jmp  ret_from_sys_call
    3.85 +	jmp  ret_to_user
    3.86  
    3.87  ENTRY(divide_error)
    3.88  	pushl $0		# no error code
    3.89 @@ -316,7 +316,7 @@ 11:     push %esp
    3.90          movl SYMBOL_NAME(HYPERVISOR_shared_info),%esi
    3.91          movb CS(%esp),%cl
    3.92  	test $2,%cl          # slow return to ring 2 or 3
    3.93 -	jne  ret_syscall_tests
    3.94 +	jne  ret_to_user_nocli
    3.95  safesti:movb $0,evtchn_upcall_mask(%esi) # reenable event callbacks
    3.96  scrit:  /**** START OF CRITICAL REGION ****/
    3.97          testb $0xFF,evtchn_upcall_pending(%esi)
     4.1 --- a/xenolinux-2.4.25-sparse/arch/xen/kernel/time.c	Fri Apr 09 11:24:54 2004 +0000
     4.2 +++ b/xenolinux-2.4.25-sparse/arch/xen/kernel/time.c	Tue Apr 13 14:36:00 2004 +0000
     4.3 @@ -492,8 +492,7 @@ static inline void do_timer_interrupt(in
     4.4  static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
     4.5  {
     4.6      write_lock(&xtime_lock);
     4.7 -    while ( !TIME_VALUES_UP_TO_DATE )
     4.8 -        do_timer_interrupt(irq, NULL, regs);
     4.9 +    do_timer_interrupt(irq, NULL, regs);
    4.10      write_unlock(&xtime_lock);
    4.11  }
    4.12  
     5.1 --- a/xenolinux-2.4.25-sparse/include/asm-xen/system.h	Fri Apr 09 11:24:54 2004 +0000
     5.2 +++ b/xenolinux-2.4.25-sparse/include/asm-xen/system.h	Tue Apr 13 14:36:00 2004 +0000
     5.3 @@ -351,9 +351,13 @@ do {                                    
     5.4  
     5.5  #define __save_and_sti(x)                                                     \
     5.6  do {                                                                          \
     5.7 +    shared_info_t *_shared = HYPERVISOR_shared_info;                          \
     5.8      barrier();                                                                \
     5.9 -    (x) = HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask;            \
    5.10 -    HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask = 0;              \
    5.11 +    (x) = _shared->vcpu_data[0].evtchn_upcall_mask;                           \
    5.12 +    _shared->vcpu_data[0].evtchn_upcall_mask = 0;                             \
    5.13 +    barrier(); /* unmask then check (avoid races) */                          \
    5.14 +    if ( unlikely(_shared->vcpu_data[0].evtchn_upcall_pending) )              \
    5.15 +        evtchn_do_upcall(NULL);                                               \
    5.16  } while (0)
    5.17  
    5.18  #define local_irq_save(x)       __save_and_cli(x)