mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, benh@kernel.crashing.org,
	trini@kernel.crashing.org
Subject: [PATCH][PPC32] Fix preemptible check
Date: Thu, 3 Jun 2004 22:14:48 +1000	[thread overview]
Message-ID: <16575.5688.698371.260931@cargo.ozlabs.ibm.com> (raw)

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: Paul Mackerras <paulus@samba.org>

diff -urN linux-2.5/arch/ppc/kernel/process.c pmac-2.5/arch/ppc/kernel/process.c
--- linux-2.5/arch/ppc/kernel/process.c	2004-05-11 07:53:04.000000000 +1000
+++ pmac-2.5/arch/ppc/kernel/process.c	2004-06-03 12:13:02.000000000 +1000
@@ -163,7 +163,7 @@
 void
 enable_kernel_altivec(void)
 {
-	WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+	WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
 	if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
@@ -180,7 +180,7 @@
 void
 enable_kernel_fp(void)
 {
-	WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+	WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
 	if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
diff -urN linux-2.5/include/asm-ppc/hardirq.h pmac-2.5/include/asm-ppc/hardirq.h
--- linux-2.5/include/asm-ppc/hardirq.h	2003-09-24 10:56:02.000000000 +1000
+++ pmac-2.5/include/asm-ppc/hardirq.h	2004-06-03 21:36:45.938019448 +1000
@@ -83,11 +83,15 @@
 
 #ifdef CONFIG_PREEMPT
 # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
+# define preemptible()	(preempt_count() == 0 && !irqs_disabled())
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+
 #else
 # define in_atomic()	(preempt_count() != 0)
+# define preemptible()	0
 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
 #endif
+
 #define irq_exit()							\
 do {									\
 	preempt_count() -= IRQ_EXIT_OFFSET;				\

                 reply	other threads:[~2004-06-03 12:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16575.5688.698371.260931@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=trini@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®