linux-kernel-test/arch/microblaze/include/asm/system.h
Michal Simek bf2d809668 microblaze: Lockdep support
Microblaze needs to do lock_init very soon because MMU init calls lock functions.

Here is the explanation from Peter Zijlstra why we have to enable
__ARCH_WANTS_INTERRUPTS_ON_CTSW.

"So we schedule while holding rq->lock (for obvious reasons), but since
lockdep tracks held locks per tasks, we need to transfer the held state
from the prev to the next task. We do this by explicity calling
spin_release(&rq->lock) in context_switch() right before switch_to(),
and calling spin_acquire(&rq->lock) in
finish_task_switch()->finish_lock_switch().

Now, for some reason lockdep thinks that interrupts got enabled over the
context switch (git grep __ARCH_WANTS_INTERRUPTS_ON_CTSW arch/microblaze
doesn't seem to turn up anything).

Clearly trying to acquire the rq->lock with interrupts enabled is a bad
idea and lockdep warns you about this."

Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-12-14 08:40:09 +01:00

97 lines
2.2 KiB
C

/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#ifndef _ASM_MICROBLAZE_SYSTEM_H
#define _ASM_MICROBLAZE_SYSTEM_H
#include <asm/registers.h>
#include <asm/setup.h>
#include <asm/irqflags.h>
#include <asm-generic/cmpxchg.h>
#include <asm-generic/cmpxchg-local.h>
#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
struct task_struct;
struct thread_info;
extern struct task_struct *_switch_to(struct thread_info *prev,
struct thread_info *next);
#define switch_to(prev, next, last) \
do { \
(last) = _switch_to(task_thread_info(prev), \
task_thread_info(next)); \
} while (0)
#define smp_read_barrier_depends() do {} while (0)
#define read_barrier_depends() do {} while (0)
#define nop() asm volatile ("nop")
#define mb() barrier()
#define rmb() mb()
#define wmb() mb()
#define set_mb(var, value) do { var = value; mb(); } while (0)
#define set_wmb(var, value) do { var = value; wmb(); } while (0)
#define smp_mb() mb()
#define smp_rmb() rmb()
#define smp_wmb() wmb()
void show_trace(struct task_struct *task, unsigned long *stack);
void __bad_xchg(volatile void *ptr, int size);
static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
int size)
{
unsigned long ret;
unsigned long flags;
switch (size) {
case 1:
local_irq_save(flags);
ret = *(volatile unsigned char *)ptr;
*(volatile unsigned char *)ptr = x;
local_irq_restore(flags);
break;
case 4:
local_irq_save(flags);
ret = *(volatile unsigned long *)ptr;
*(volatile unsigned long *)ptr = x;
local_irq_restore(flags);
break;
default:
__bad_xchg(ptr, size), ret = 0;
break;
}
return ret;
}
void disable_hlt(void);
void enable_hlt(void);
void default_idle(void);
#define xchg(ptr, x) \
((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
void free_init_pages(char *what, unsigned long begin, unsigned long end);
void free_initmem(void);
extern char *klimit;
extern void ret_from_fork(void);
#ifdef CONFIG_DEBUG_FS
extern struct dentry *of_debugfs_root;
#endif
#define arch_align_stack(x) (x)
#endif /* _ASM_MICROBLAZE_SYSTEM_H */