ia64/xen-unstable

changeset 10288:808430428622

Use DEFINE_SPINLOCK consistently throughout Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 01 21:49:25 2006 +0100 (2006-06-01)
parents 8c6ff337d164
children 9f937ecc4f54
files xen/arch/x86/cpu/mtrr/main.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/i8259.c xen/arch/x86/microcode.c xen/arch/x86/smp.c xen/arch/x86/time.c xen/arch/x86/x86_32/domain_page.c xen/common/dom0_ops.c xen/common/page_alloc.c xen/common/perfc.c xen/common/trace.c xen/common/xmalloc.c xen/drivers/char/console.c xen/include/xen/console.h
line diff
     1.1 --- a/xen/arch/x86/cpu/mtrr/main.c	Thu Jun 01 21:34:47 2006 +0100
     1.2 +++ b/xen/arch/x86/cpu/mtrr/main.c	Thu Jun 01 21:49:25 2006 +0100
     1.3 @@ -43,7 +43,7 @@
     1.4  #include "mtrr.h"
     1.5  
     1.6  /* No blocking mutexes in Xen. Spin instead. */
     1.7 -#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
     1.8 +#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
     1.9  #define down(_m) spin_lock(_m)
    1.10  #define up(_m) spin_unlock(_m)
    1.11  #define lock_cpu_hotplug() ((void)0)
     2.1 --- a/xen/arch/x86/hvm/svm/svm.c	Thu Jun 01 21:34:47 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu Jun 01 21:49:25 2006 +0100
     2.3 @@ -84,28 +84,26 @@ struct svm_percore_globals svm_globals[N
     2.4  /*
     2.5   * Initializes the POOL of ASID used by the guests per core.
     2.6   */
     2.7 -void asidpool_init( int core )
     2.8 +void asidpool_init(int core)
     2.9  {
    2.10      int i;
    2.11 -    svm_globals[core].ASIDpool.asid_lock = SPIN_LOCK_UNLOCKED;
    2.12 -    spin_lock(&svm_globals[core].ASIDpool.asid_lock);
    2.13 +
    2.14 +    spin_lock_init(&svm_globals[core].ASIDpool.asid_lock);
    2.15 +
    2.16      /* Host ASID is always in use */
    2.17      svm_globals[core].ASIDpool.asid[INITIAL_ASID] = ASID_INUSE;
    2.18 -    for( i=1; i<ASID_MAX; i++ )
    2.19 -    {
    2.20 +    for ( i = 1; i < ASID_MAX; i++ )
    2.21         svm_globals[core].ASIDpool.asid[i] = ASID_AVAILABLE;
    2.22 -    }
    2.23 -    spin_unlock(&svm_globals[core].ASIDpool.asid_lock);
    2.24  }
    2.25  
    2.26  
    2.27  /* internal function to get the next available ASID */
    2.28 -static int asidpool_fetch_next( struct vmcb_struct *vmcb, int core )
    2.29 +static int asidpool_fetch_next(struct vmcb_struct *vmcb, int core)
    2.30  {
    2.31      int i;   
    2.32 -    for( i = 1; i < ASID_MAX; i++ )
    2.33 +    for ( i = 1; i < ASID_MAX; i++ )
    2.34      {
    2.35 -        if( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
    2.36 +        if ( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
    2.37          {
    2.38              vmcb->guest_asid = i;
    2.39              svm_globals[core].ASIDpool.asid[i] = ASID_INUSE;
     3.1 --- a/xen/arch/x86/i8259.c	Thu Jun 01 21:34:47 2006 +0100
     3.2 +++ b/xen/arch/x86/i8259.c	Thu Jun 01 21:49:25 2006 +0100
     3.3 @@ -102,7 +102,7 @@ BUILD_SMP_INTERRUPT(thermal_interrupt,TH
     3.4   * moves to arch independent land
     3.5   */
     3.6  
     3.7 -spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
     3.8 +static DEFINE_SPINLOCK(i8259A_lock);
     3.9  
    3.10  static void disable_8259A_vector(unsigned int vector)
    3.11  {
     4.1 --- a/xen/arch/x86/microcode.c	Thu Jun 01 21:34:47 2006 +0100
     4.2 +++ b/xen/arch/x86/microcode.c	Thu Jun 01 21:49:25 2006 +0100
     4.3 @@ -83,7 +83,7 @@
     4.4  #include <asm/processor.h>
     4.5  
     4.6  #define pr_debug(x...) ((void)0)
     4.7 -#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
     4.8 +#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
     4.9  #define down(_m) spin_lock(_m)
    4.10  #define up(_m) spin_unlock(_m)
    4.11  #define vmalloc(_s) xmalloc_bytes(_s)
     5.1 --- a/xen/arch/x86/smp.c	Thu Jun 01 21:34:47 2006 +0100
     5.2 +++ b/xen/arch/x86/smp.c	Thu Jun 01 21:49:25 2006 +0100
     5.3 @@ -161,7 +161,7 @@ void send_IPI_mask_phys(cpumask_t mask, 
     5.4      local_irq_restore(flags);
     5.5  }
     5.6  
     5.7 -static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED;
     5.8 +static DEFINE_SPINLOCK(flush_lock);
     5.9  static cpumask_t flush_cpumask;
    5.10  static unsigned long flush_va;
    5.11  
     6.1 --- a/xen/arch/x86/time.c	Thu Jun 01 21:34:47 2006 +0100
     6.2 +++ b/xen/arch/x86/time.c	Thu Jun 01 21:49:25 2006 +0100
     6.3 @@ -40,10 +40,10 @@ boolean_param("hpet_force", opt_hpet_for
     6.4  
     6.5  unsigned long cpu_khz;  /* CPU clock frequency in kHz. */
     6.6  unsigned long hpet_address;
     6.7 -spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
     6.8 +DEFINE_SPINLOCK(rtc_lock);
     6.9  unsigned long volatile jiffies;
    6.10  static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
    6.11 -static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
    6.12 +static DEFINE_SPINLOCK(wc_lock);
    6.13  
    6.14  struct time_scale {
    6.15      int shift;
    6.16 @@ -67,7 +67,7 @@ static struct cpu_time cpu_time[NR_CPUS]
    6.17  static s_time_t stime_platform_stamp;
    6.18  static u64 platform_timer_stamp;
    6.19  static struct time_scale platform_timer_scale;
    6.20 -static spinlock_t platform_timer_lock = SPIN_LOCK_UNLOCKED;
    6.21 +static DEFINE_SPINLOCK(platform_timer_lock);
    6.22  static u64 (*read_platform_count)(void);
    6.23  
    6.24  /*
     7.1 --- a/xen/arch/x86/x86_32/domain_page.c	Thu Jun 01 21:34:47 2006 +0100
     7.2 +++ b/xen/arch/x86/x86_32/domain_page.c	Thu Jun 01 21:49:25 2006 +0100
     7.3 @@ -183,7 +183,7 @@ void mapcache_init(struct domain *d)
     7.4  static unsigned long inuse[BITS_TO_LONGS(GLOBALMAP_BITS)];
     7.5  static unsigned long garbage[BITS_TO_LONGS(GLOBALMAP_BITS)];
     7.6  static unsigned int inuse_cursor;
     7.7 -static spinlock_t globalmap_lock = SPIN_LOCK_UNLOCKED;
     7.8 +static DEFINE_SPINLOCK(globalmap_lock);
     7.9  
    7.10  void *map_domain_page_global(unsigned long pfn)
    7.11  {
     8.1 --- a/xen/common/dom0_ops.c	Thu Jun 01 21:34:47 2006 +0100
     8.2 +++ b/xen/common/dom0_ops.c	Thu Jun 01 21:49:25 2006 +0100
     8.3 @@ -95,7 +95,7 @@ long do_dom0_op(XEN_GUEST_HANDLE(dom0_op
     8.4      long ret = 0;
     8.5      struct dom0_op curop, *op = &curop;
     8.6      void *ssid = NULL; /* save security ptr between pre and post/fail hooks */
     8.7 -    static spinlock_t dom0_lock = SPIN_LOCK_UNLOCKED;
     8.8 +    static DEFINE_SPINLOCK(dom0_lock);
     8.9  
    8.10      if ( !IS_PRIV(current->domain) )
    8.11          return -EPERM;
     9.1 --- a/xen/common/page_alloc.c	Thu Jun 01 21:34:47 2006 +0100
     9.2 +++ b/xen/common/page_alloc.c	Thu Jun 01 21:49:25 2006 +0100
     9.3 @@ -59,7 +59,7 @@ custom_param("lowmem_emergency_pool", pa
     9.4  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
     9.5  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
     9.6  
     9.7 -static spinlock_t page_scrub_lock = SPIN_LOCK_UNLOCKED;
     9.8 +static DEFINE_SPINLOCK(page_scrub_lock);
     9.9  LIST_HEAD(page_scrub_list);
    9.10  
    9.11  /*********************
    9.12 @@ -250,7 +250,7 @@ static struct list_head heap[NR_ZONES][M
    9.13  
    9.14  static unsigned long avail[NR_ZONES];
    9.15  
    9.16 -static spinlock_t heap_lock = SPIN_LOCK_UNLOCKED;
    9.17 +static DEFINE_SPINLOCK(heap_lock);
    9.18  
    9.19  void end_boot_allocator(void)
    9.20  {
    10.1 --- a/xen/common/perfc.c	Thu Jun 01 21:34:47 2006 +0100
    10.2 +++ b/xen/common/perfc.c	Thu Jun 01 21:49:25 2006 +0100
    10.3 @@ -209,7 +209,7 @@ static int perfc_copy_info(XEN_GUEST_HAN
    10.4  /* Dom0 control of perf counters */
    10.5  int perfc_control(dom0_perfccontrol_t *pc)
    10.6  {
    10.7 -    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
    10.8 +    static DEFINE_SPINLOCK(lock);
    10.9      u32 op = pc->op;
   10.10      int rc;
   10.11  
    11.1 --- a/xen/common/trace.c	Thu Jun 01 21:34:47 2006 +0100
    11.2 +++ b/xen/common/trace.c	Thu Jun 01 21:49:25 2006 +0100
    11.3 @@ -173,7 +173,7 @@ void init_trace_bufs(void)
    11.4   */
    11.5  int tb_control(dom0_tbufcontrol_t *tbc)
    11.6  {
    11.7 -    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
    11.8 +    static DEFINE_SPINLOCK(lock);
    11.9      int rc = 0;
   11.10  
   11.11      spin_lock(&lock);
    12.1 --- a/xen/common/xmalloc.c	Thu Jun 01 21:34:47 2006 +0100
    12.2 +++ b/xen/common/xmalloc.c	Thu Jun 01 21:49:25 2006 +0100
    12.3 @@ -35,7 +35,7 @@
    12.4  #include <xen/prefetch.h>
    12.5  
    12.6  static LIST_HEAD(freelist);
    12.7 -static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED;
    12.8 +static DEFINE_SPINLOCK(freelist_lock);
    12.9  
   12.10  struct xmalloc_hdr
   12.11  {
    13.1 --- a/xen/drivers/char/console.c	Thu Jun 01 21:34:47 2006 +0100
    13.2 +++ b/xen/drivers/char/console.c	Thu Jun 01 21:49:25 2006 +0100
    13.3 @@ -53,7 +53,7 @@ static char printk_prefix[16] = "";
    13.4  static int sercon_handle = -1;
    13.5  static int vgacon_enabled = 0;
    13.6  
    13.7 -spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
    13.8 +static DEFINE_SPINLOCK(console_lock);
    13.9  
   13.10  /*
   13.11   * *******************************************************
   13.12 @@ -563,7 +563,7 @@ static char        *debugtrace_buf; /* D
   13.13  static unsigned int debugtrace_prd; /* Producer index     */
   13.14  static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes;
   13.15  static unsigned int debugtrace_used;
   13.16 -static spinlock_t   debugtrace_lock = SPIN_LOCK_UNLOCKED;
   13.17 +static DEFINE_SPINLOCK(debugtrace_lock);
   13.18  integer_param("debugtrace", debugtrace_kilobytes);
   13.19  
   13.20  void debugtrace_dump(void)
   13.21 @@ -675,7 +675,7 @@ void panic(const char *fmt, ...)
   13.22      va_list args;
   13.23      char buf[128];
   13.24      unsigned long flags;
   13.25 -    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
   13.26 +    static DEFINE_SPINLOCK(lock);
   13.27      extern void machine_restart(char *);
   13.28      
   13.29      debugtrace_dump();
    14.1 --- a/xen/include/xen/console.h	Thu Jun 01 21:34:47 2006 +0100
    14.2 +++ b/xen/include/xen/console.h	Thu Jun 01 21:49:25 2006 +0100
    14.3 @@ -10,8 +10,6 @@
    14.4  #include <xen/spinlock.h>
    14.5  #include <xen/guest_access.h>
    14.6  
    14.7 -extern spinlock_t console_lock;
    14.8 -
    14.9  void set_printk_prefix(const char *prefix);
   14.10  
   14.11  long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);