aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m32r/system.h
diff options
context:
space:
mode:
authorHirokazu Takata <takata.hirokazu@renesas.com>2007-05-11 01:22:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 11:29:33 -0400
commit43c09ce7927912c7867617cba0a265beea38a154 (patch)
tree0b0a8b8e9a5f9b2e1fe7aa058378f23321f2a910 /include/asm-m32r/system.h
parent44316634460a6b368ad3160da6cba3b4725a1433 (diff)
m32r: fix switch_to macro to push/pop frame pointer if needed
This patch fixes a rarely-happened but severe scheduling problem of the recent m32r kernel of 2.6.17-rc3 or later. In the following previous m32r patch, the switch_to macro was modified not to do unnecessary push/pop operations for tuning. > [PATCH] m32r: update switch_to macro for tuning > 4127272c38619c56f0c1aa01d01c7bd757db70a1 In this modification, only 'lr' and 'sp' registers are push/pop'ed, assuming that the m32r kernel is always compiled with -fomit-frame-pointer option. However, in 2.6 kernel, kernel/sched.c is irregularly compiled with -fno-omit-frame-pointer if CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER is not defined. -- kernel/Makefile -- : ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is # needed for x86 only. Why this used to be enabled for all architectures is beyond # me. I suspect most platforms don't need this, but until we know that for sure # I turn this off for IA-64 only. Andreas Schwab says it's also needed on m68k # to get a correct value for the wait-channel (WCHAN in ps). --davidm CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer endif : --- Therefore, for the recent m32r kernel, we have to push/pop 'fp' (frame pointer) if CONFIG_FRAME_POINTER is defined or CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER is not defined. Signed-off-by: Hitoshi Yamamoto <hitoshiy@linux-m32r.org> Signed-off-by: Hirokazu Takata <takata@linux-m32r.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-m32r/system.h')
-rw-r--r--include/asm-m32r/system.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index f62f5c9abba6..b291b2f72954 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -21,12 +21,22 @@
21 * `next' and `prev' should be struct task_struct, but it isn't always defined 21 * `next' and `prev' should be struct task_struct, but it isn't always defined
22 */ 22 */
23 23
24#if defined(CONFIG_FRAME_POINTER) || \
25 !defined(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER)
26#define M32R_PUSH_FP " push fp\n"
27#define M32R_POP_FP " pop fp\n"
28#else
29#define M32R_PUSH_FP ""
30#define M32R_POP_FP ""
31#endif
32
24#define switch_to(prev, next, last) do { \ 33#define switch_to(prev, next, last) do { \
25 __asm__ __volatile__ ( \ 34 __asm__ __volatile__ ( \
26 " seth lr, #high(1f) \n" \ 35 " seth lr, #high(1f) \n" \
27 " or3 lr, lr, #low(1f) \n" \ 36 " or3 lr, lr, #low(1f) \n" \
28 " st lr, @%4 ; store old LR \n" \ 37 " st lr, @%4 ; store old LR \n" \
29 " ld lr, @%5 ; load new LR \n" \ 38 " ld lr, @%5 ; load new LR \n" \
39 M32R_PUSH_FP \
30 " st sp, @%2 ; store old SP \n" \ 40 " st sp, @%2 ; store old SP \n" \
31 " ld sp, @%3 ; load new SP \n" \ 41 " ld sp, @%3 ; load new SP \n" \
32 " push %1 ; store `prev' on new stack \n" \ 42 " push %1 ; store `prev' on new stack \n" \
@@ -34,6 +44,7 @@
34 " .fillinsn \n" \ 44 " .fillinsn \n" \
35 "1: \n" \ 45 "1: \n" \
36 " pop %0 ; restore `__last' from new stack \n" \ 46 " pop %0 ; restore `__last' from new stack \n" \
47 M32R_POP_FP \
37 : "=r" (last) \ 48 : "=r" (last) \
38 : "0" (prev), \ 49 : "0" (prev), \
39 "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \ 50 "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \