ia64/xen-unstable

changeset 4290:0c7d16e71835

bitkeeper revision 1.1236.1.124 (42429eb8uGingMvF7MF3Py6CUzFBzA)

NMI watchdog hooks off ac_timer softirq rather than apic timer irq.
In extreme situations we may service ac_timer events without ever
actually taking an apic interrupt.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Mar 24 11:04:24 2005 +0000 (2005-03-24)
parents 0bfb769b2d64
children 48ddf32dad5b 46155de3064d
files xen/arch/x86/apic.c xen/arch/x86/nmi.c xen/common/ac_timer.c xen/include/asm-x86/apic.h xen/include/xen/ac_timer.h
line diff
     1.1 --- a/xen/arch/x86/apic.c	Thu Mar 24 09:13:47 2005 +0000
     1.2 +++ b/xen/arch/x86/apic.c	Thu Mar 24 11:04:24 2005 +0000
     1.3 @@ -722,15 +722,10 @@ int reprogram_ac_timer(s_time_t timeout)
     1.4      return 1;
     1.5  }
     1.6  
     1.7 -unsigned int apic_timer_irqs [NR_CPUS];
     1.8 -
     1.9  void smp_apic_timer_interrupt(struct xen_regs * regs)
    1.10  {
    1.11      ack_APIC_irq();
    1.12 -
    1.13 -    apic_timer_irqs[smp_processor_id()]++;
    1.14      perfc_incrc(apic_timer);
    1.15 -
    1.16      raise_softirq(AC_TIMER_SOFTIRQ);
    1.17  }
    1.18  
     2.1 --- a/xen/arch/x86/nmi.c	Thu Mar 24 09:13:47 2005 +0000
     2.2 +++ b/xen/arch/x86/nmi.c	Thu Mar 24 11:04:24 2005 +0000
     2.3 @@ -271,7 +271,7 @@ void nmi_watchdog_tick (struct xen_regs 
     2.4  {
     2.5      int sum, cpu = smp_processor_id();
     2.6  
     2.7 -    sum = apic_timer_irqs[cpu];
     2.8 +    sum = ac_timers[cpu].softirqs;
     2.9  
    2.10      if ( (last_irq_sums[cpu] == sum) && watchdog_on )
    2.11      {
     3.1 --- a/xen/common/ac_timer.c	Thu Mar 24 09:13:47 2005 +0000
     3.2 +++ b/xen/common/ac_timer.c	Thu Mar 24 11:04:24 2005 +0000
     3.3 @@ -34,14 +34,7 @@
     3.4  
     3.5  #define DEFAULT_HEAP_LIMIT 127
     3.6  
     3.7 -/* A timer list per CPU */
     3.8 -typedef struct ac_timers_st
     3.9 -{
    3.10 -    spinlock_t        lock;
    3.11 -    struct ac_timer **heap;
    3.12 -} __cacheline_aligned ac_timers_t;
    3.13 -static ac_timers_t ac_timers[NR_CPUS];
    3.14 -
    3.15 +struct ac_timers ac_timers[NR_CPUS];
    3.16  
    3.17  /****************************************************************************
    3.18   * HEAP OPERATIONS.
    3.19 @@ -214,6 +207,8 @@ static void ac_timer_softirq_action(void
    3.20      s_time_t         now;
    3.21      void             (*fn)(unsigned long);
    3.22  
    3.23 +    ac_timers[cpu].softirqs++;
    3.24 +
    3.25      spin_lock_irq(&ac_timers[cpu].lock);
    3.26      
    3.27      do {
    3.28 @@ -277,8 +272,10 @@ void __init ac_timer_init(void)
    3.29  
    3.30      for ( i = 0; i < smp_num_cpus; i++ )
    3.31      {
    3.32 -        ac_timers[i].heap = xmalloc_array(struct ac_timer *, DEFAULT_HEAP_LIMIT+1);
    3.33 -        if ( ac_timers[i].heap == NULL ) BUG();
    3.34 +        ac_timers[i].heap = xmalloc_array(
    3.35 +            struct ac_timer *, DEFAULT_HEAP_LIMIT+1);
    3.36 +        BUG_ON(ac_timers[i].heap == NULL);
    3.37 +
    3.38          SET_HEAP_SIZE(ac_timers[i].heap, 0);
    3.39          SET_HEAP_LIMIT(ac_timers[i].heap, DEFAULT_HEAP_LIMIT);
    3.40          spin_lock_init(&ac_timers[i].lock);
     4.1 --- a/xen/include/asm-x86/apic.h	Thu Mar 24 09:13:47 2005 +0000
     4.2 +++ b/xen/include/asm-x86/apic.h	Thu Mar 24 11:04:24 2005 +0000
     4.3 @@ -83,12 +83,7 @@ extern int APIC_init_uniprocessor (void)
     4.4  extern void disable_APIC_timer(void);
     4.5  extern void enable_APIC_timer(void);
     4.6  
     4.7 -/*extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);*/
     4.8 -/*extern void apic_pm_unregister(struct pm_dev*);*/
     4.9 -
    4.10  extern unsigned int watchdog_on;
    4.11 -
    4.12 -extern unsigned int apic_timer_irqs [NR_CPUS];
    4.13  extern int check_nmi_watchdog (void);
    4.14  
    4.15  extern unsigned int nmi_watchdog;
     5.1 --- a/xen/include/xen/ac_timer.h	Thu Mar 24 09:13:47 2005 +0000
     5.2 +++ b/xen/include/xen/ac_timer.h	Thu Mar 24 11:04:24 2005 +0000
     5.3 @@ -19,6 +19,7 @@
     5.4  #ifndef _AC_TIMER_H_
     5.5  #define _AC_TIMER_H_
     5.6  
     5.7 +#include <xen/spinlock.h>
     5.8  #include <xen/time.h>
     5.9  
    5.10  struct ac_timer {
    5.11 @@ -87,6 +88,13 @@ extern void mod_ac_timer(struct ac_timer
    5.12  
    5.13  extern int reprogram_ac_timer(s_time_t timeout);
    5.14  
    5.15 +struct ac_timers {
    5.16 +    spinlock_t        lock;
    5.17 +    struct ac_timer **heap;
    5.18 +    unsigned int      softirqs;
    5.19 +} __cacheline_aligned;
    5.20 +extern struct ac_timers ac_timers[];
    5.21 +
    5.22  #endif /* _AC_TIMER_H_ */
    5.23  
    5.24  /*