From: Tejun Heo <tj@home-tj.org>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, zwane@fsmlabs.com
Subject: Re: [PATCH] Interrupt entry CONFIG_FRAME_POINTER fix
Date: Sun, 12 Sep 2004 23:38:25 +0900 [thread overview]
Message-ID: <20040912143825.GA17260@home-tj.org> (raw)
In-Reply-To: <20040912132454.6cf1d60c.ak@suse.de>
Hi,
On Sun, Sep 12, 2004 at 01:24:54PM +0200, Andi Kleen wrote:
> I don't think your patch is correct, you don't restore rbp ever and
> it gets corrupted.
R15 R14 R13 R12 RBP RBX are callee-saved and they aren't
saved/restored during kernel entry unless they are explicitly needed
(ptrace, etc..). interrupt macro which I modified is used only for
IRQ handling and apic interrupts, both of which aren't supposed to
modify any of above registers.
So, in the original code, when CONFIG_DEBUG is off only caller-saved
registers are saved and restored, and when the option is on, SAVE_ALL
is used but it's saved only to link back to the original stack such
that the debugger can track back into the previous frame. The current
code contains a line to restore rbp in ret_from_interrupt (other
calle-saved registers are not restored), but I don't think that line
is necessary. Unless somebody explicitly changes regs->rbp, the value
would be always the same, and if somebody is allowed to modify the
contents of regs when CONFIG_DEBUG is turned on, we should be
restoring all the callee-saved registers not just rbp.
> I think the correct change is to fix profile_pc() to not reference
> rbp,
I thought about that, but CONFIG_FRAME_POINTER is a debug feature
anyway, and it seemed reasonable to allow frame linking on interrupts
when the option turned on (x86 also supports back linking when
CONFIG_FRAME_POINTER is turned on).
> but just hardcode the rsp offset for the FP and non FP cases (8
> and 0)
You lost me here. regs->rbp is used in profile_pc() if the interrupt
occurs while the kernel is running spinlock codes. To attribute ticks
spent during spinlock operations to the locking/unlocking function,
profile_pc() reads the return value of the frame which was running
before the interrupt occurs. Are you saying that we can track back
into the previous frame without saving rbp? We can read the next
frame's(do_IRQ's) rbp storage area, but that doesn't seem to be a very
good idea to me.
--
tejun
next prev parent reply other threads:[~2004-09-12 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-12 9:16 [PATCH] Interrupt entry CONFIG_FRAME_POINTER fix Tejun Heo
2004-09-12 11:24 ` Andi Kleen
2004-09-12 14:38 ` Tejun Heo [this message]
2004-09-12 17:10 ` Zwane Mwaikambo
2004-09-12 18:11 ` Tejun Heo
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=20040912143825.GA17260@home-tj.org \
--to=tj@home-tj.org \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=zwane@fsmlabs.com \
/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