From: Andi Kleen <ak@suse.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>, Andrew Morton <akpm@osdl.org>,
Zwane Mwaikambo <zwane@fsmlabs.com>,
linux-kernel@vger.kernel.org, wli@holomorphy.com
Subject: Re: [PATCH] remove LOCK_SECTION from x86_64 spin_lock asm
Date: Thu, 16 Sep 2004 08:44:28 +0200 [thread overview]
Message-ID: <20040916064428.GD12915@wotan.suse.de> (raw)
In-Reply-To: <20040916062759.GA10527@elte.hu>
On Thu, Sep 16, 2004 at 08:27:59AM +0200, Ingo Molnar wrote:
>
> * Andi Kleen <ak@suse.de> wrote:
>
> > Known problem. Interrupts don't save regs->rbp, but the new profile_pc
> > that was introduced recently uses it.
> >
> > One quick fix is to just use SAVE_ALL in the interrupt entry code, but
> > I don't like this because it will affect interrupt latency.
> >
> > The real fix is to fix profile_pc to not reference it.
>
> it would be nice if we could profile the callers of the spinlock
> functions instead of the opaque spinlock functions.
>
> the ebp trick is nice, but forcing a formal stack frame for every
> function has global performance implications. Couldnt we define some
I don't think that is needed anyways. It would seem to
be overkill to me to make a relatively fast path slower
just for the profiler interrupt.
I think the idea was that the spinlock functions should be small
enough that they don't have any stack local variables. In this case
for the standard non FP build you can just use *regs->rsp. The only problem
was with CONFIG_FRAME_POINTER, because then the compiler puts
an additional word onto the stack. I think the right way
is to just correct for this word and still use rsp.
Here's an untested patch to implement this. Does this fix the problem for
you?
-Andi
Index: linux/arch/x86_64/kernel/time.c
===================================================================
--- linux.orig/arch/x86_64/kernel/time.c 2004-09-13 22:19:22.%N +0200
+++ linux/arch/x86_64/kernel/time.c 2004-09-16 08:43:06.%N +0200
@@ -184,9 +184,11 @@
unsigned long profile_pc(struct pt_regs *regs)
{
unsigned long pc = instruction_pointer(regs);
-
+ /* [0] is the frame pointer, [1] is the return address.
+ This assumes that the spinlock function is small enough
+ to not have any stack variables. */
if (in_lock_functions(pc))
- return *(unsigned long *)regs->rbp;
+ return ((unsigned long *)regs->rsp)[1];
return pc;
}
EXPORT_SYMBOL(profile_pc);
next prev parent reply other threads:[~2004-09-16 6:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-15 16:01 [PATCH] remove LOCK_SECTION from x86_64 spin_lock asm Zwane Mwaikambo
2004-09-15 21:45 ` Andrew Morton
2004-09-15 17:55 ` Zwane Mwaikambo
2004-09-15 21:47 ` Ingo Molnar
2004-09-16 6:13 ` Andi Kleen
2004-09-16 6:27 ` Ingo Molnar
2004-09-16 6:44 ` Andi Kleen [this message]
2004-09-16 6:51 ` Ingo Molnar
2004-09-16 6:53 ` Andi Kleen
2004-09-16 6:58 ` Ingo Molnar
2004-09-16 7:09 ` Andi Kleen
2004-09-16 7:19 ` Ingo Molnar
2004-09-16 7:29 ` Andi Kleen
2004-09-16 7:44 ` Ingo Molnar
2004-09-16 7:53 ` Andi Kleen
2004-09-16 9:01 ` Andi Kleen
2004-09-16 12:44 ` Zwane Mwaikambo
2004-09-16 19:30 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2004-09-15 22:42 Andrew Chew
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=20040916064428.GD12915@wotan.suse.de \
--to=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=wli@holomorphy.com \
--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