[POWERPC] irqtrace support for 64-bit powerpc
This adds the low level irq tracing hooks to the powerpc architecture needed to enable full lockdep functionality. This is partly based on Johannes Berg's initial version. I removed the asm trampoline that isn't needed (thus improving performance) and modified all sorts of bits and pieces, reworking most of the assembly, etc... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
fd3e0bbc60
commit
945feb174b
11 changed files with 136 additions and 54 deletions
|
|
@ -228,18 +228,18 @@ label##_pSeries: \
|
|||
BEGIN_FW_FTR_SECTION; \
|
||||
stb r11,PACAHARDIRQEN(r13); \
|
||||
END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES); \
|
||||
TRACE_DISABLE_INTS; \
|
||||
BEGIN_FW_FTR_SECTION; \
|
||||
mfmsr r10; \
|
||||
ori r10,r10,MSR_EE; \
|
||||
mtmsrd r10,1; \
|
||||
END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
|
||||
|
||||
#else
|
||||
#define DISABLE_INTS \
|
||||
li r11,0; \
|
||||
stb r11,PACASOFTIRQEN(r13); \
|
||||
stb r11,PACAHARDIRQEN(r13)
|
||||
|
||||
stb r11,PACAHARDIRQEN(r13); \
|
||||
TRACE_DISABLE_INTS
|
||||
#endif /* CONFIG_PPC_ISERIES */
|
||||
|
||||
#define ENABLE_INTS \
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ static inline unsigned long local_get_flags(void)
|
|||
return flags;
|
||||
}
|
||||
|
||||
static inline unsigned long local_irq_disable(void)
|
||||
static inline unsigned long raw_local_irq_disable(void)
|
||||
{
|
||||
unsigned long flags, zero;
|
||||
|
||||
|
|
@ -39,14 +39,15 @@ static inline unsigned long local_irq_disable(void)
|
|||
return flags;
|
||||
}
|
||||
|
||||
extern void local_irq_restore(unsigned long);
|
||||
extern void raw_local_irq_restore(unsigned long);
|
||||
extern void iseries_handle_interrupts(void);
|
||||
|
||||
#define local_irq_enable() local_irq_restore(1)
|
||||
#define local_save_flags(flags) ((flags) = local_get_flags())
|
||||
#define local_irq_save(flags) ((flags) = local_irq_disable())
|
||||
#define raw_local_irq_enable() raw_local_irq_restore(1)
|
||||
#define raw_local_save_flags(flags) ((flags) = local_get_flags())
|
||||
#define raw_local_irq_save(flags) ((flags) = raw_local_irq_disable())
|
||||
|
||||
#define irqs_disabled() (local_get_flags() == 0)
|
||||
#define raw_irqs_disabled() (local_get_flags() == 0)
|
||||
#define raw_irqs_disabled_flags(flags) ((flags) == 0)
|
||||
|
||||
#define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
|
||||
#define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
|
||||
|
|
|
|||
|
|
@ -2,30 +2,43 @@
|
|||
* include/asm-powerpc/irqflags.h
|
||||
*
|
||||
* IRQ flags handling
|
||||
*
|
||||
* This file gets included from lowlevel asm headers too, to provide
|
||||
* wrapped versions of the local_irq_*() APIs, based on the
|
||||
* raw_local_irq_*() macros from the lowlevel headers.
|
||||
*/
|
||||
#ifndef _ASM_IRQFLAGS_H
|
||||
#define _ASM_IRQFLAGS_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/*
|
||||
* Get definitions for raw_local_save_flags(x), etc.
|
||||
*/
|
||||
#include <asm-powerpc/hw_irq.h>
|
||||
|
||||
/*
|
||||
* Do the CPU's IRQ-state tracing from assembly code. We call a
|
||||
* C function, so save all the C-clobbered registers:
|
||||
*/
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS
|
||||
|
||||
#error No support on PowerPC yet for CONFIG_TRACE_IRQFLAGS
|
||||
|
||||
#else
|
||||
# define TRACE_IRQS_ON
|
||||
# define TRACE_IRQS_OFF
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS
|
||||
/*
|
||||
* Most of the CPU's IRQ-state tracing is done from assembly code; we
|
||||
* have to call a C function so call a wrapper that saves all the
|
||||
* C-clobbered registers.
|
||||
*/
|
||||
#define TRACE_ENABLE_INTS bl .trace_hardirqs_on
|
||||
#define TRACE_DISABLE_INTS bl .trace_hardirqs_off
|
||||
#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
|
||||
cmpdi en, 0; \
|
||||
bne 95f; \
|
||||
stb en,PACASOFTIRQEN(r13); \
|
||||
bl .trace_hardirqs_off; \
|
||||
b skip; \
|
||||
95: bl .trace_hardirqs_on; \
|
||||
li en,1;
|
||||
#define TRACE_AND_RESTORE_IRQ(en) \
|
||||
TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
|
||||
96: stb en,PACASOFTIRQEN(r13)
|
||||
#else
|
||||
#define TRACE_ENABLE_INTS
|
||||
#define TRACE_DISABLE_INTS
|
||||
#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)
|
||||
#define TRACE_AND_RESTORE_IRQ(en) \
|
||||
stb en,PACASOFTIRQEN(r13)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,11 +32,20 @@ struct rw_semaphore {
|
|||
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
|
||||
spinlock_t wait_lock;
|
||||
struct list_head wait_list;
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
struct lockdep_map dep_map;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
|
||||
#else
|
||||
# define __RWSEM_DEP_MAP_INIT(lockname)
|
||||
#endif
|
||||
|
||||
#define __RWSEM_INITIALIZER(name) \
|
||||
{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
|
||||
LIST_HEAD_INIT((name).wait_list) }
|
||||
{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
|
||||
LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
|
||||
|
||||
#define DECLARE_RWSEM(name) \
|
||||
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
|
||||
|
|
@ -46,12 +55,15 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
|
|||
extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
|
||||
extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
|
||||
|
||||
static inline void init_rwsem(struct rw_semaphore *sem)
|
||||
{
|
||||
sem->count = RWSEM_UNLOCKED_VALUE;
|
||||
spin_lock_init(&sem->wait_lock);
|
||||
INIT_LIST_HEAD(&sem->wait_list);
|
||||
}
|
||||
extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
|
||||
struct lock_class_key *key);
|
||||
|
||||
#define init_rwsem(sem) \
|
||||
do { \
|
||||
static struct lock_class_key __key; \
|
||||
\
|
||||
__init_rwsem((sem), #sem, &__key); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* lock for reading
|
||||
|
|
@ -78,7 +90,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
|
|||
/*
|
||||
* lock for writing
|
||||
*/
|
||||
static inline void __down_write(struct rw_semaphore *sem)
|
||||
static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
|
|
@ -88,6 +100,11 @@ static inline void __down_write(struct rw_semaphore *sem)
|
|||
rwsem_down_write_failed(sem);
|
||||
}
|
||||
|
||||
static inline void __down_write(struct rw_semaphore *sem)
|
||||
{
|
||||
__down_write_nested(sem, 0);
|
||||
}
|
||||
|
||||
static inline int __down_write_trylock(struct rw_semaphore *sem)
|
||||
{
|
||||
int tmp;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
* (the type definitions are in asm/spinlock_types.h)
|
||||
*/
|
||||
#include <linux/irqflags.h>
|
||||
#ifdef CONFIG_PPC64
|
||||
#include <asm/paca.h>
|
||||
#include <asm/hvcall.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue