Commit 717f8850 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc32: Fix preemptible check

Ben H added a check in a couple of places to make sure that we had
preemption disabled when we call enable_kernel_{fp,altivec}.
Unfortunately the check he used trips in the case when
CONFIG_PREEMPT=n.  This patch fixes it by defining a preemptible()
macro (which reduces to 0 when CONFIG_PREEMPT=n) and doing
WARN_ON(preemptible()).
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9dfbbd91
...@@ -163,7 +163,7 @@ dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) ...@@ -163,7 +163,7 @@ dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
void void
enable_kernel_altivec(void) enable_kernel_altivec(void)
{ {
WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); WARN_ON(preemptible());
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
...@@ -180,7 +180,7 @@ EXPORT_SYMBOL(enable_kernel_altivec); ...@@ -180,7 +180,7 @@ EXPORT_SYMBOL(enable_kernel_altivec);
void void
enable_kernel_fp(void) enable_kernel_fp(void)
{ {
WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); WARN_ON(preemptible());
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
......
...@@ -83,11 +83,15 @@ typedef struct { ...@@ -83,11 +83,15 @@ typedef struct {
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
# define preemptible() (preempt_count() == 0 && !irqs_disabled())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else #else
# define in_atomic() (preempt_count() != 0) # define in_atomic() (preempt_count() != 0)
# define preemptible() 0
# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
#endif #endif
#define irq_exit() \ #define irq_exit() \
do { \ do { \
preempt_count() -= IRQ_EXIT_OFFSET; \ preempt_count() -= IRQ_EXIT_OFFSET; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment