ia64/xen-unstable

changeset 10587:4b45f7f62dc7

Fix next_timer_interrupt() in patch and update caller
to deal with the case of existing pending timers.
Fixes a dom0 hang at boot time on some HPs where some
dubious USB code is invoked from pci_init() that
potentially calls msleep(10) a few times.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
author ack@localhost.localdomain
date Wed Jun 28 21:51:01 2006 +0100 (2006-06-28)
parents bd4080876297
children cb9443bfdff8
files linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c patches/linux-2.6.16.13/fix-hz-suspend.patch
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Jun 28 21:03:25 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Jun 28 21:51:01 2006 +0100
     1.3 @@ -989,12 +989,11 @@ static void stop_hz_timer(void)
     1.4  
     1.5  	smp_mb();
     1.6  
     1.7 -	/* Leave ourselves in 'tick mode' if rcu or softirq pending. */
     1.8 -	if (rcu_needs_cpu(cpu) || local_softirq_pending()) {
     1.9 +	/* Leave ourselves in 'tick mode' if rcu or softirq or timer pending. */
    1.10 +	if (rcu_needs_cpu(cpu) || local_softirq_pending() ||
    1.11 +	    (j = next_timer_interrupt(), time_before_eq(j, jiffies))) {
    1.12  		cpu_clear(cpu, nohz_cpu_mask);
    1.13  		j = jiffies + 1;
    1.14 -	} else {
    1.15 -		j = next_timer_interrupt();
    1.16  	}
    1.17  
    1.18  	BUG_ON(HYPERVISOR_set_timer_op(jiffies_to_st(j)) != 0);
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/linux-2.6.16.13/fix-hz-suspend.patch	Wed Jun 28 21:51:01 2006 +0100
     2.3 @@ -0,0 +1,22 @@
     2.4 +diff -pruN ../pristine-linux-2.6.16.13/kernel/timer.c ./kernel/timer.c
     2.5 +--- ../pristine-linux-2.6.16.13/kernel/timer.c	2006-05-02 14:38:44.000000000 -0700
     2.6 ++++ ./kernel/timer.c	2006-06-28 09:57:51.000000000 -0700
     2.7 +@@ -555,7 +555,17 @@ found:
     2.8 + 	}
     2.9 + 	spin_unlock(&base->t_base.lock);
    2.10 + 
    2.11 +-	if (time_before(hr_expires, expires))
    2.12 ++	/*
    2.13 ++	 * If timers are pending, "expires" will be in the recent past
    2.14 ++	 * of "jiffies". If there are no hr_timers registered, "hr_expires"
    2.15 ++	 * will be "jiffies + MAX_JIFFY_OFFSET"; this is *just* short of being
    2.16 ++	 * considered to be before "jiffies". This makes it very likely that
    2.17 ++	 * "hr_expires" *will* be considered to be before "expires".
    2.18 ++	 * So we must check when there are pending timers (expires <= jiffies)
    2.19 ++	 * to ensure that we don't accidently tell the caller that there is
    2.20 ++	 * nothing scheduled until half an epoch (MAX_JIFFY_OFFSET)!
    2.21 ++	 */
    2.22 ++	if (time_before(jiffies, expires) && time_before(hr_expires, expires))
    2.23 + 		return hr_expires;
    2.24 + 
    2.25 + 	return expires;