mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
Use DEFINE_SPINLOCK consistently throughout Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
6af99de37c
commit
8cd06eb323
14 files changed
+25
-29
No files matched your search
@@ -43,7 +43,7 @@
|
||||
#include "mtrr.h"
|
||||
|
||||
/* No blocking mutexes in Xen. Spin instead. */
|
||||
#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
|
||||
#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
|
||||
#define down(_m) spin_lock(_m)
|
||||
#define up(_m) spin_unlock(_m)
|
||||
#define lock_cpu_hotplug() ((void)0)
|
||||
|
||||
@@ -84,28 +84,26 @@ struct svm_percore_globals svm_globals[NR_CPUS];
|
||||
/*
|
||||
* Initializes the POOL of ASID used by the guests per core.
|
||||
*/
|
||||
void asidpool_init( int core )
|
||||
void asidpool_init(int core)
|
||||
{
|
||||
int i;
|
||||
svm_globals[core].ASIDpool.asid_lock = SPIN_LOCK_UNLOCKED;
|
||||
spin_lock(&svm_globals[core].ASIDpool.asid_lock);
|
||||
|
||||
spin_lock_init(&svm_globals[core].ASIDpool.asid_lock);
|
||||
|
||||
/* Host ASID is always in use */
|
||||
svm_globals[core].ASIDpool.asid[INITIAL_ASID] = ASID_INUSE;
|
||||
for( i=1; i<ASID_MAX; i++ )
|
||||
{
|
||||
for ( i = 1; i < ASID_MAX; i++ )
|
||||
svm_globals[core].ASIDpool.asid[i] = ASID_AVAILABLE;
|
||||
}
|
||||
spin_unlock(&svm_globals[core].ASIDpool.asid_lock);
|
||||
}
|
||||
|
||||
|
||||
/* internal function to get the next available ASID */
|
||||
static int asidpool_fetch_next( struct vmcb_struct *vmcb, int core )
|
||||
static int asidpool_fetch_next(struct vmcb_struct *vmcb, int core)
|
||||
{
|
||||
int i;
|
||||
for( i = 1; i < ASID_MAX; i++ )
|
||||
for ( i = 1; i < ASID_MAX; i++ )
|
||||
{
|
||||
if( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
|
||||
if ( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
|
||||
{
|
||||
vmcb->guest_asid = i;
|
||||
svm_globals[core].ASIDpool.asid[i] = ASID_INUSE;
|
||||
|
||||
@@ -102,7 +102,7 @@ BUILD_SMP_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
|
||||
* moves to arch independent land
|
||||
*/
|
||||
|
||||
spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(i8259A_lock);
|
||||
|
||||
static void disable_8259A_vector(unsigned int vector)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
#include <asm/processor.h>
|
||||
|
||||
#define pr_debug(x...) ((void)0)
|
||||
#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
|
||||
#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
|
||||
#define down(_m) spin_lock(_m)
|
||||
#define up(_m) spin_unlock(_m)
|
||||
#define vmalloc(_s) xmalloc_bytes(_s)
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ void send_IPI_mask_phys(cpumask_t mask, int vector)
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(flush_lock);
|
||||
static cpumask_t flush_cpumask;
|
||||
static unsigned long flush_va;
|
||||
|
||||
|
||||
+3
-3
@@ -40,10 +40,10 @@ boolean_param("hpet_force", opt_hpet_force);
|
||||
|
||||
unsigned long cpu_khz; /* CPU clock frequency in kHz. */
|
||||
unsigned long hpet_address;
|
||||
spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
|
||||
DEFINE_SPINLOCK(rtc_lock);
|
||||
unsigned long volatile jiffies;
|
||||
static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
|
||||
static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(wc_lock);
|
||||
|
||||
struct time_scale {
|
||||
int shift;
|
||||
@@ -67,7 +67,7 @@ static struct cpu_time cpu_time[NR_CPUS];
|
||||
static s_time_t stime_platform_stamp;
|
||||
static u64 platform_timer_stamp;
|
||||
static struct time_scale platform_timer_scale;
|
||||
static spinlock_t platform_timer_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(platform_timer_lock);
|
||||
static u64 (*read_platform_count)(void);
|
||||
|
||||
/*
|
||||
|
||||
@@ -183,7 +183,7 @@ void mapcache_init(struct domain *d)
|
||||
static unsigned long inuse[BITS_TO_LONGS(GLOBALMAP_BITS)];
|
||||
static unsigned long garbage[BITS_TO_LONGS(GLOBALMAP_BITS)];
|
||||
static unsigned int inuse_cursor;
|
||||
static spinlock_t globalmap_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(globalmap_lock);
|
||||
|
||||
void *map_domain_page_global(unsigned long pfn)
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ long do_dom0_op(XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
|
||||
long ret = 0;
|
||||
struct dom0_op curop, *op = &curop;
|
||||
void *ssid = NULL; /* save security ptr between pre and post/fail hooks */
|
||||
static spinlock_t dom0_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(dom0_lock);
|
||||
|
||||
if ( !IS_PRIV(current->domain) )
|
||||
return -EPERM;
|
||||
|
||||
@@ -59,7 +59,7 @@ custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool);
|
||||
#define round_pgdown(_p) ((_p)&PAGE_MASK)
|
||||
#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
|
||||
|
||||
static spinlock_t page_scrub_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(page_scrub_lock);
|
||||
LIST_HEAD(page_scrub_list);
|
||||
|
||||
/*********************
|
||||
@@ -250,7 +250,7 @@ static struct list_head heap[NR_ZONES][MAX_ORDER+1];
|
||||
|
||||
static unsigned long avail[NR_ZONES];
|
||||
|
||||
static spinlock_t heap_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(heap_lock);
|
||||
|
||||
void end_boot_allocator(void)
|
||||
{
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ static int perfc_copy_info(XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc)
|
||||
/* Dom0 control of perf counters */
|
||||
int perfc_control(dom0_perfccontrol_t *pc)
|
||||
{
|
||||
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
u32 op = pc->op;
|
||||
int rc;
|
||||
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ void init_trace_bufs(void)
|
||||
*/
|
||||
int tb_control(dom0_tbufcontrol_t *tbc)
|
||||
{
|
||||
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
int rc = 0;
|
||||
|
||||
spin_lock(&lock);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <xen/prefetch.h>
|
||||
|
||||
static LIST_HEAD(freelist);
|
||||
static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(freelist_lock);
|
||||
|
||||
struct xmalloc_hdr
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ static char printk_prefix[16] = "";
|
||||
static int sercon_handle = -1;
|
||||
static int vgacon_enabled = 0;
|
||||
|
||||
spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(console_lock);
|
||||
|
||||
/*
|
||||
* *******************************************************
|
||||
@@ -563,7 +563,7 @@ static char *debugtrace_buf; /* Debug-trace buffer */
|
||||
static unsigned int debugtrace_prd; /* Producer index */
|
||||
static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes;
|
||||
static unsigned int debugtrace_used;
|
||||
static spinlock_t debugtrace_lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(debugtrace_lock);
|
||||
integer_param("debugtrace", debugtrace_kilobytes);
|
||||
|
||||
void debugtrace_dump(void)
|
||||
@@ -675,7 +675,7 @@ void panic(const char *fmt, ...)
|
||||
va_list args;
|
||||
char buf[128];
|
||||
unsigned long flags;
|
||||
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
extern void machine_restart(char *);
|
||||
|
||||
debugtrace_dump();
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <xen/spinlock.h>
|
||||
#include <xen/guest_access.h>
|
||||
|
||||
extern spinlock_t console_lock;
|
||||
|
||||
void set_printk_prefix(const char *prefix);
|
||||
|
||||
long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);
|
||||
|
||||