public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@snapgear.com>
To: torvalds@linux-foundation.org
Cc: akpm@linux-foundation.org, gerg@uclinux.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] m68knommu: ColdFire add support for kernel preemption
Date: Thu, 1 May 2008 12:16:29 +1000	[thread overview]
Message-ID: <200805010216.m412GT6t004096@goober> (raw)

From: Sebastian Siewior <bigeasy@linutronix.de>

As the subject says this patch adds the support for kernel preemption
on m68knommu Coldfire. I thing the same changes could be applied to
68360 & 68328 but since I don't have the HW for testing, I don't touch it.

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
---


diff -Naurp linux-2.6.25/arch/m68knommu/kernel/asm-offsets.c linux-2.6.25-uc0/arch/m68knommu/kernel/asm-offsets.c
--- linux-2.6.25/arch/m68knommu/kernel/asm-offsets.c	2008-04-17 12:49:44.000000000 +1000
+++ linux-2.6.25-uc0/arch/m68knommu/kernel/asm-offsets.c	2008-03-28 15:29:06.000000000 +1000
@@ -91,6 +91,7 @@ int main(void)
 	DEFINE(TI_TASK, offsetof(struct thread_info, task));
 	DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
 	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
+	DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count));
 	DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
 
 	return 0;
diff -Naurp linux-2.6.25/arch/m68knommu/platform/coldfire/entry.S linux-2.6.25-uc0/arch/m68knommu/platform/coldfire/entry.S
--- linux-2.6.25/arch/m68knommu/platform/coldfire/entry.S	2008-04-17 12:49:44.000000000 +1000
+++ linux-2.6.25-uc0/arch/m68knommu/platform/coldfire/entry.S	2008-05-01 11:58:21.000000000 +1000
@@ -106,6 +106,22 @@ ret_from_exception:
 	btst	#5,%sp@(PT_SR)		/* check if returning to kernel */
 	jeq	Luser_return		/* if so, skip resched, signals */
 
+#ifdef CONFIG_PREEMPT
+	movel	%sp,%d1			/* get thread_info pointer */
+	andl	#-THREAD_SIZE,%d1	/* at base of kernel stack */
+	movel	%d1,%a0
+	movel	%a0@(TI_FLAGS),%d1	/* get thread_info->flags */
+	andl	#_TIF_NEED_RESCHED,%d1
+	jeq	Lkernel_return
+
+	movel	%a0@(TI_PREEMPTCOUNT),%d1
+	cmpl	#0,%d1
+	jne	Lkernel_return
+
+	pea	Lkernel_return
+	jmp	preempt_schedule_irq	/* preempt the kernel */
+#endif
+
 Lkernel_return:
 	moveml	%sp@,%d1-%d5/%a0-%a2
 	lea	%sp@(32),%sp		/* space for 8 regs */

             reply	other threads:[~2008-05-01  2:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-01  2:16 Greg Ungerer [this message]
2008-05-01 21:33 ` [PATCH] m68knommu: ColdFire add support for kernel preemption Andrew Morton
2008-05-02  7:19   ` Greg Ungerer
2008-05-02  8:37     ` Sebastian Siewior
2008-05-02 12:22       ` Andrew Morton
2008-06-23  5:32         ` Greg Ungerer
2008-06-23  5:51           ` Andrew Morton
2008-06-23  7:53             ` Stephen Rothwell
2008-06-23 13:23               ` Greg Ungerer
2008-06-23 17:42                 ` Andrew Morton
2008-06-23 23:47                 ` Stephen Rothwell

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=200805010216.m412GT6t004096@goober \
    --to=gerg@snapgear.com \
    --cc=akpm@linux-foundation.org \
    --cc=gerg@uclinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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