mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: x86_64: could increment fp when getting wchan?
Date: Fri, 21 Jan 2011 15:05:24 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1101211501180.2971@localhost6.localdomain6> (raw)
In-Reply-To: <AANLkTi=kcpiXAFAy9c31qU+4u=BHckSec29C5Khm3gxC@mail.gmail.com>

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


      reply	other threads:[~2011-01-21 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 13:54 Hillf Danton
2011-01-21 14:05 ` Thomas Gleixner [this message]

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=alpine.LFD.2.00.1101211501180.2971@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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®