diff options
author | Andi Kleen <ak@suse.de> | 2006-09-26 04:52:28 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:28 -0400 |
commit | 0cb91a2293648507886563ccb91979cfc94d6a4b (patch) | |
tree | f2a994f8b874e3c81c5519d445a0c5fa5522e4b5 /arch/i386/kernel/time.c | |
parent | c16b63e09d9d03158e0a92e961234e94c4862620 (diff) |
[PATCH] i386: Account spinlocks to the caller during profiling for !FP kernels
This ports the algorithm from x86-64 (with improvements) to i386.
Previously this only worked for frame pointer enabled kernels.
But spinlocks have a very simple stack frame that can be manually
analyzed. Do this.
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/kernel/time.c')
-rw-r--r-- | arch/i386/kernel/time.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index edd00f6cee37..5af802ef00b2 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -130,18 +130,33 @@ static int set_rtc_mmss(unsigned long nowtime) | |||
130 | 130 | ||
131 | int timer_ack; | 131 | int timer_ack; |
132 | 132 | ||
133 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) | ||
134 | unsigned long profile_pc(struct pt_regs *regs) | 133 | unsigned long profile_pc(struct pt_regs *regs) |
135 | { | 134 | { |
136 | unsigned long pc = instruction_pointer(regs); | 135 | unsigned long pc = instruction_pointer(regs); |
137 | 136 | ||
138 | if (!user_mode_vm(regs) && in_lock_functions(pc)) | 137 | #ifdef CONFIG_SMP |
138 | if (!user_mode_vm(regs) && in_lock_functions(pc)) { | ||
139 | #ifdef CONFIG_FRAME_POINTER | ||
139 | return *(unsigned long *)(regs->ebp + 4); | 140 | return *(unsigned long *)(regs->ebp + 4); |
140 | 141 | #else | |
142 | unsigned long *sp; | ||
143 | if ((regs->xcs & 3) == 0) | ||
144 | sp = (unsigned long *)®s->esp; | ||
145 | else | ||
146 | sp = (unsigned long *)regs->esp; | ||
147 | /* Return address is either directly at stack pointer | ||
148 | or above a saved eflags. Eflags has bits 22-31 zero, | ||
149 | kernel addresses don't. */ | ||
150 | if (sp[0] >> 22) | ||
151 | return sp[0]; | ||
152 | if (sp[1] >> 22) | ||
153 | return sp[1]; | ||
154 | #endif | ||
155 | } | ||
156 | #endif | ||
141 | return pc; | 157 | return pc; |
142 | } | 158 | } |
143 | EXPORT_SYMBOL(profile_pc); | 159 | EXPORT_SYMBOL(profile_pc); |
144 | #endif | ||
145 | 160 | ||
146 | /* | 161 | /* |
147 | * This is the same as the above, except we _also_ save the current | 162 | * This is the same as the above, except we _also_ save the current |