ia64/xen-unstable

changeset 1847:f2435a0ddc1d

bitkeeper revision 1.1108.2.12 (40fe3dbaxIWEKBVXUkHDWE0aDdMw5w)

Fix the Xen specific idle loop for good.
author cl349@freefall.cl.cam.ac.uk
date Wed Jul 21 09:56:10 2004 +0000 (2004-07-21)
parents a10feaf36803
children 8f45c4cafc5c
files linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6.7-xen-sparse/arch/xen/kernel/process.c
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Wed Jul 21 09:54:10 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Wed Jul 21 09:56:10 2004 +0000
     1.3 @@ -474,28 +474,23 @@ static inline u64 __jiffies_to_st(unsign
     1.4   * 
     1.5   * It must be called with interrupts disabled.
     1.6   */
     1.7 -extern spinlock_t timerlist_lock;
     1.8  int set_timeout_timer(void)
     1.9  {
    1.10 -    u64 alarm = 0;
    1.11 -    int ret = 0;
    1.12 -    int cpu = smp_processor_id();
    1.13 -
    1.14 -    spin_lock(&timerlist_lock);
    1.15 +	u64 alarm = 0;
    1.16 +	int ret = 0;
    1.17  
    1.18 -    /*
    1.19 -     * This is safe against long blocking (since calculations are not based on 
    1.20 -     * TSC deltas). It is also safe against warped system time since
    1.21 -     * suspend-resume is cooperative and we would first get locked out. It is 
    1.22 -     * safe against normal updates of jiffies since interrupts are off.
    1.23 -     */
    1.24 -    alarm = __jiffies_to_st(next_timer_interrupt());
    1.25 +	/*
    1.26 +	 * This is safe against long blocking (since calculations are
    1.27 +	 * not based on TSC deltas). It is also safe against warped
    1.28 +	 * system time since suspend-resume is cooperative and we
    1.29 +	 * would first get locked out. It is safe against normal
    1.30 +	 * updates of jiffies since interrupts are off.
    1.31 +	 */
    1.32 +	alarm = __jiffies_to_st(next_timer_interrupt());
    1.33  
    1.34 -    /* Failure is pretty bad, but we'd best soldier on. */
    1.35 -    if ( HYPERVISOR_set_timer_op(alarm) != 0 )
    1.36 -        ret = -1;
    1.37 -    
    1.38 -    spin_unlock(&timerlist_lock);
    1.39 +	/* Failure is pretty bad, but we'd best soldier on. */
    1.40 +	if ( HYPERVISOR_set_timer_op(alarm) != 0 )
    1.41 +		ret = -1;
    1.42  
    1.43 -    return ret;
    1.44 +	return ret;
    1.45  }
     2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/kernel/process.c	Wed Jul 21 09:54:10 2004 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/kernel/process.c	Wed Jul 21 09:56:10 2004 +0000
     2.3 @@ -6,12 +6,16 @@
     2.4  #include <linux/init.h>
     2.5  #include <linux/platform.h>
     2.6  #include <linux/pm.h>
     2.7 +#include <linux/rcupdate.h>
     2.8  
     2.9 +extern int set_timeout_timer(void);
    2.10  
    2.11  void xen_cpu_idle (void)
    2.12  {
    2.13 +	int cpu = smp_processor_id();
    2.14 +
    2.15  	local_irq_disable();
    2.16 -	if (need_resched() || !list_empty(&RCU_curlist(cpu)))
    2.17 +	if (need_resched() || !list_empty(&RCU_curlist(cpu))) {
    2.18  		local_irq_enable();
    2.19  		return;
    2.20  	}