ia64/xen-unstable

changeset 18389:2eefc8294358

x86: Signal softirq-context calibration with an actual first-class
softirq handle rather than kludging it with set_timer().

Should be faster and is definitely clearer. Also avoids us using
set_timer() in IRQ context (which is currently broken but soon won't
be).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Aug 27 10:12:49 2008 +0100 (2008-08-27)
parents 2986c11b7edf
children 14a9a1629590
files xen/arch/x86/time.c xen/include/asm-x86/softirq.h
line diff
     1.1 --- a/xen/arch/x86/time.c	Wed Aug 27 10:11:33 2008 +0100
     1.2 +++ b/xen/arch/x86/time.c	Wed Aug 27 10:12:49 2008 +0100
     1.3 @@ -840,12 +840,11 @@ struct cpu_calibration {
     1.4      u64 local_tsc_stamp;
     1.5      s_time_t stime_local_stamp;
     1.6      s_time_t stime_master_stamp;
     1.7 -    struct timer softirq_callback;
     1.8  };
     1.9  static DEFINE_PER_CPU(struct cpu_calibration, cpu_calibration);
    1.10  
    1.11  /* Softirq handler for per-CPU time calibration. */
    1.12 -static void local_time_calibration(void *unused)
    1.13 +static void local_time_calibration(void)
    1.14  {
    1.15      struct cpu_time *t = &this_cpu(cpu_time);
    1.16      struct cpu_calibration *c = &this_cpu(cpu_calibration);
    1.17 @@ -1022,8 +1021,7 @@ static void time_calibration_rendezvous(
    1.18      c->stime_local_stamp = get_s_time();
    1.19      c->stime_master_stamp = r->master_stime;
    1.20  
    1.21 -    /* Callback in softirq context as soon as possible. */
    1.22 -    set_timer(&c->softirq_callback, c->stime_local_stamp);
    1.23 +    raise_softirq(TIME_CALIBRATE_SOFTIRQ);
    1.24  }
    1.25  
    1.26  static void time_calibration(void *unused)
    1.27 @@ -1049,9 +1047,6 @@ void init_percpu_time(void)
    1.28      t->stime_master_stamp = now;
    1.29      t->stime_local_stamp  = now;
    1.30  
    1.31 -    init_timer(&this_cpu(cpu_calibration).softirq_callback,
    1.32 -               local_time_calibration, NULL, smp_processor_id());
    1.33 -
    1.34      if ( smp_processor_id() == 0 )
    1.35      {
    1.36          init_timer(&calibration_timer, time_calibration, NULL, 0);
    1.37 @@ -1069,6 +1064,8 @@ int __init init_xen_time(void)
    1.38      if ( cpuid_edx(0x80000007) & (1u<<8) )
    1.39          tsc_invariant = 1;
    1.40  
    1.41 +    open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
    1.42 +
    1.43      init_percpu_time();
    1.44  
    1.45      stime_platform_stamp = 0;
    1.46 @@ -1176,7 +1173,7 @@ int time_suspend(void)
    1.47      }
    1.48  
    1.49      /* Better to cancel calibration timer for accuracy. */
    1.50 -    kill_timer(&this_cpu(cpu_calibration).softirq_callback);
    1.51 +    clear_bit(TIME_CALIBRATE_SOFTIRQ, &softirq_pending(smp_processor_id()));
    1.52  
    1.53      return 0;
    1.54  }
     2.1 --- a/xen/include/asm-x86/softirq.h	Wed Aug 27 10:11:33 2008 +0100
     2.2 +++ b/xen/include/asm-x86/softirq.h	Wed Aug 27 10:12:49 2008 +0100
     2.3 @@ -1,7 +1,8 @@
     2.4  #ifndef __ASM_SOFTIRQ_H__
     2.5  #define __ASM_SOFTIRQ_H__
     2.6  
     2.7 -#define NMI_MCE_SOFTIRQ     (NR_COMMON_SOFTIRQS + 0)
     2.8 +#define NMI_MCE_SOFTIRQ        (NR_COMMON_SOFTIRQS + 0)
     2.9 +#define TIME_CALIBRATE_SOFTIRQ (NR_COMMON_SOFTIRQS + 1)
    2.10  
    2.11  #define NR_ARCH_SOFTIRQS    1
    2.12