* x86_64: could increment fp when getting wchan?
@ 2011-01-21 13:54 Hillf Danton
2011-01-21 14:05 ` Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2011-01-21 13:54 UTC (permalink / raw)
To: linux-kernel, x86
When getting wchan (wait channel?) the stack of given task is scanned
for IP that is not in the scheduling area. What looks odd is the IP
could be checked as many times as allowed in the loop without changing
the location on stack. Could the IP be checked up stair the stack?
Hillf
---
--- a/arch/x86/kernel/process_64.c 2011-01-05 08:50:20.000000000 +0800
+++ b/arch/x86/kernel/process_64.c 2011-01-21 21:46:04.000000000 +0800
@@ -543,7 +543,7 @@ unsigned long get_wchan(struct task_stru
ip = *(u64 *)(fp+8);
if (!in_sched_functions(ip))
return ip;
- fp = *(u64 *)fp;
+ fp += 8;
} while (count++ < 16);
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: x86_64: could increment fp when getting wchan?
2011-01-21 13:54 x86_64: could increment fp when getting wchan? Hillf Danton
@ 2011-01-21 14:05 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2011-01-21 14:05 UTC (permalink / raw)
To: Hillf Danton; +Cc: linux-kernel, x86
On Fri, 21 Jan 2011, Hillf Danton wrote:
> When getting wchan (wait channel?) the stack of given task is scanned
> for IP that is not in the scheduling area. What looks odd is the IP
> could be checked as many times as allowed in the loop without changing
> the location on stack. Could the IP be checked up stair the stack?
Errm.
> Hillf
> ---
>
> --- a/arch/x86/kernel/process_64.c 2011-01-05 08:50:20.000000000 +0800
> +++ b/arch/x86/kernel/process_64.c 2011-01-21 21:46:04.000000000 +0800
> @@ -543,7 +543,7 @@ unsigned long get_wchan(struct task_stru
> ip = *(u64 *)(fp+8);
IP (Return address) is read from stack via fp (Frame pointer)
> if (!in_sched_functions(ip))
> return ip;
> - fp = *(u64 *)fp;
Now fp is set to the next stack frame, so the next loop will read a
different IP.
> + fp += 8;
> } while (count++ < 16);
> return 0;
> }
Thanks,
tglx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-21 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 13:54 x86_64: could increment fp when getting wchan? Hillf Danton
2011-01-21 14:05 ` Thomas Gleixner
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®