diff options
Diffstat (limited to 'arch/mips/kernel/gdb-stub.c')
| -rw-r--r-- | arch/mips/kernel/gdb-stub.c | 23 | 
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c index d3fd1ab1427..96d18c43dca 100644 --- a/arch/mips/kernel/gdb-stub.c +++ b/arch/mips/kernel/gdb-stub.c @@ -176,8 +176,10 @@ int kgdb_enabled;  /*   * spin locks for smp case   */ -static spinlock_t kgdb_lock = SPIN_LOCK_UNLOCKED; -static spinlock_t kgdb_cpulock[NR_CPUS] = { [0 ... NR_CPUS-1] = SPIN_LOCK_UNLOCKED}; +static DEFINE_SPINLOCK(kgdb_lock); +static raw_spinlock_t kgdb_cpulock[NR_CPUS] = { +	[0 ... NR_CPUS-1] = __RAW_SPIN_LOCK_UNLOCKED; +};  /*   * BUFMAX defines the maximum number of characters in inbound/outbound buffers @@ -637,29 +639,32 @@ static struct gdb_bp_save async_bp;   * and only one can be active at a time.   */  extern spinlock_t smp_call_lock; +  void set_async_breakpoint(unsigned long *epc)  {  	/* skip breaking into userland */  	if ((*epc & 0x80000000) == 0)  		return; +#ifdef CONFIG_SMP  	/* avoid deadlock if someone is make IPC */  	if (spin_is_locked(&smp_call_lock))  		return; +#endif  	async_bp.addr = *epc;  	*epc = (unsigned long)async_breakpoint;  } -void kgdb_wait(void *arg) +static void kgdb_wait(void *arg)  {  	unsigned flags;  	int cpu = smp_processor_id();  	local_irq_save(flags); -	spin_lock(&kgdb_cpulock[cpu]); -	spin_unlock(&kgdb_cpulock[cpu]); +	__raw_spin_lock(&kgdb_cpulock[cpu]); +	__raw_spin_unlock(&kgdb_cpulock[cpu]);  	local_irq_restore(flags);  } @@ -707,7 +712,7 @@ void handle_exception (struct gdb_regs *regs)  	 * acquire the CPU spinlocks  	 */  	for (i = num_online_cpus()-1; i >= 0; i--) -		if (spin_trylock(&kgdb_cpulock[i]) == 0) +		if (__raw_spin_trylock(&kgdb_cpulock[i]) == 0)  			panic("kgdb: couldn't get cpulock %d\n", i);  	/* @@ -982,7 +987,7 @@ finish_kgdb:  exit_kgdb_exception:  	/* release locks so other CPUs can go */  	for (i = num_online_cpus()-1; i >= 0; i--) -		spin_unlock(&kgdb_cpulock[i]); +		__raw_spin_unlock(&kgdb_cpulock[i]);  	spin_unlock(&kgdb_lock);  	__flush_cache_all(); @@ -1036,12 +1041,12 @@ void adel(void)   * malloc is needed by gdb client in "call func()", even a private one   * will make gdb happy   */ -static void *malloc(size_t size) +static void * __attribute_used__ malloc(size_t size)  {  	return kmalloc(size, GFP_ATOMIC);  } -static void free(void *where) +static void __attribute_used__ free (void *where)  {  	kfree(where);  }  | 
