From: "Alexander van Heukelum" <heukelum@fastmail.fm>
To: "Andi Kleen" <andi@firstfloor.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
"LKML" <linux-kernel@vger.kernel.org>,
"Andi Kleen" <andi@firstfloor.org>,
"Alexander van Heukelum" <heukelum@lusi.uni-sb.de>,
"Glauber Costa" <gcosta@redhat.com>
Subject: Re: [RFC] x86: save_args out of line
Date: Mon, 17 Nov 2008 16:37:37 +0100 [thread overview]
Message-ID: <1226936257.32609.1285214311@webmail.messagingengine.com> (raw)
In-Reply-To: <20081117125317.GK6703@one.firstfloor.org>
On Mon, 17 Nov 2008 13:53:17 +0100, "Andi Kleen" <andi@firstfloor.org>
said:
> On Sun, Nov 16, 2008 at 03:29:01PM +0100, Alexander van Heukelum wrote:
> > From: Alexander van Heukelum <heukelum@sleipnir.lusi.uni-sb.de>
> >
> > The macro "interrupt" in entry_64.S generates a lot of code. This
> > patch moves most of its contents into an external function. It
> > saves anywhere between 500 and 2500 bytes of text depending on the
> > configuration.
>
> The only duplication is in the apicinterrupt entry points which
> have expanded recently (when I wrote all that there weren't as many)
>
> I think it would be cleaner to just have a common apic_interrupt
> entry point similar to how the exceptions work that try to factor
> out "interrupt" like this. As more and more of them get added
> (I have another new one in recent) patches that will likely
> save more space.
>
> The only ugly part is that passing the handler to the common
> stub requires the manual pt_regs setup that the exception
> handler currently does. Because that could be factored
> out in a new macro. Or just copied (I have heard complaints
> in the past that the file has too many macros already)
Hi Andi,
I liked this way of calling an external function, because it
circumvents exactly most of this ugly setup. For two bytes
extra per stub, one can make this setup function a completely
normal one (without relocating the return address on the stack).
I intended the stubs to fit in one cache line (32 bytes) as it
does not make much sense to make them smaller than that. A
further advantage is that no indirect call is needed, but maybe
this is not as slow anymore as it used to be? B.t.w., I intended
to change the exception handler stubs in a similar way to get
rid of the indirect call.
> > There is a comment in the original code about saving rbp twice, but
> > I don't understand what the code tries to do. First of all, the
>
> To be honest I didn't understand this one either when it was added. In
> standard frame pointer format rbp has to be at the place pointed to by
> the real
> rbp register with the return address directly on top of it. But pushing
> %rbp below the pt_regs doesn't put it into this format, because
> the return address is at the wrong place.
The second copy of %rbp is indeed placed at the 'correct' position
inside the pt_regs struct. However, at this point only a partial
stack frame is saved: the C argument registers and the scratch
registers. r12-r15,ebp,and rbx will be saved only later if necessary.
A problem could arise if some code uses pt_regs.bp of this partial
stack frame, because it will contain a bogus value. Glauber's patch
makes pt_regs.bp contain the right value most of the time... Which
means that if the patch fixed something for him, the problem has only
been made unlikely to happen. The place where things should be fixed
are the places where pt_regs.bp is used, but not filled in.
Greetings,
Alexander
> -Andi
--
Alexander van Heukelum
heukelum@fastmail.fm
--
http://www.fastmail.fm - Access your email from home and the web
next prev parent reply other threads:[~2008-11-17 15:37 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-16 14:29 [PATCH] trivial, entry_64: remove whitespace at end of lines Alexander van Heukelum
2008-11-16 14:29 ` [RFC] x86: save_args out of line Alexander van Heukelum
2008-11-17 12:14 ` Glauber Costa
2008-11-17 15:13 ` Alexander van Heukelum
2008-11-17 12:53 ` Andi Kleen
2008-11-17 15:37 ` Alexander van Heukelum [this message]
2008-11-17 18:23 ` Andi Kleen
2008-11-17 19:22 ` Cyrill Gorcunov
2008-11-17 19:29 ` Cyrill Gorcunov
2008-11-17 19:49 ` Alexander van Heukelum
2008-11-17 19:54 ` Cyrill Gorcunov
2008-11-17 19:43 ` Alexander van Heukelum
2008-11-17 19:49 ` Cyrill Gorcunov
2008-11-17 17:52 ` [RFC,v2] x86_64: " Alexander van Heukelum
2008-11-18 8:09 ` Jan Beulich
2008-11-18 11:16 ` Alexander van Heukelum
2008-11-18 12:51 ` Jan Beulich
2008-11-18 14:03 ` Ingo Molnar
2008-11-18 14:52 ` Jan Beulich
2008-11-18 15:00 ` Ingo Molnar
2008-11-18 22:53 ` Roland McGrath
2008-11-18 23:35 ` Andi Kleen
2008-11-18 23:36 ` Jeremy Fitzhardinge
2008-11-18 23:44 ` H. Peter Anvin
2008-11-19 0:08 ` Jeremy Fitzhardinge
2008-11-18 23:45 ` Roland McGrath
2008-11-19 0:06 ` Andi Kleen
2008-11-19 0:01 ` H. Peter Anvin
2008-11-19 10:34 ` Ingo Molnar
2008-11-19 20:09 ` Ingo Molnar
2008-11-19 0:18 ` [PATCH/RFC] Move entry_64.S register saving out of the macros Alexander van Heukelum
2008-11-19 17:54 ` H. Peter Anvin
2008-11-19 20:16 ` Ingo Molnar
2008-11-20 13:40 ` [PATCH] x86: clean up after: move " Alexander van Heukelum
2008-11-20 14:01 ` Andi Kleen
2008-11-20 15:04 ` Ingo Molnar
2008-11-20 15:26 ` Alexander van Heukelum
2008-11-20 15:39 ` Ingo Molnar
2008-11-20 15:50 ` [PATCH] x86: clean up after: move entry_64.S register savingout " Jan Beulich
2008-11-20 15:57 ` [PATCH] x86: clean up after: move entry_64.S register saving out " Alexander van Heukelum
2008-11-20 16:07 ` Cyrill Gorcunov
2008-11-20 16:29 ` Alexander van Heukelum
2008-11-20 17:24 ` Ingo Molnar
2008-11-21 15:41 ` [PATCH] x86: Introduce save_rest and restructure the PTREGSCALL macro in entry_64.S Alexander van Heukelum
2008-11-21 15:43 ` [PATCH] x86: entry_64.S: Factor out save_paranoid and paranoid_exit Alexander van Heukelum
2008-11-21 15:44 ` [PATCH] Split out some macro's and move common code to paranoid_exit Alexander van Heukelum
2008-11-21 16:06 ` Ingo Molnar
2008-11-23 9:08 ` [PATCH] x86: include ENTRY/END in entry handlers in entry_64.S Alexander van Heukelum
2008-11-23 9:15 ` [PATCH] x86: KPROBE_ENTRY should be paired wth KPROBE_END Alexander van Heukelum
2008-11-23 13:27 ` Ingo Molnar
2008-11-23 13:51 ` Cyrill Gorcunov
2008-11-23 14:12 ` Cyrill Gorcunov
2008-11-23 14:55 ` Ingo Molnar
2008-11-23 15:04 ` Cyrill Gorcunov
2008-11-23 15:04 ` Alexander van Heukelum
2008-11-23 15:12 ` Cyrill Gorcunov
2008-11-23 15:31 ` Ingo Molnar
2008-11-23 15:41 ` Cyrill Gorcunov
2008-11-23 15:37 ` Cyrill Gorcunov
2008-11-23 16:29 ` Ingo Molnar
2008-11-24 9:17 ` Jan Beulich
2008-11-24 10:26 ` Alexander van Heukelum
2008-11-24 10:35 ` Jan Beulich
2008-11-24 12:24 ` [PATCH] x86_64: get rid of the use of KPROBE_ENTRY / KPROBE_END Alexander van Heukelum
2008-11-24 13:33 ` Jan Beulich
2008-11-24 14:38 ` [PATCH] i386: " Alexander van Heukelum
2008-11-23 9:21 ` [PATCH] x86: include ENTRY/END in entry handlers in entry_64.S Cyrill Gorcunov
2008-11-23 11:23 ` Alexander van Heukelum
2008-11-23 11:35 ` Cyrill Gorcunov
2008-11-23 20:13 ` H. Peter Anvin
2008-11-24 10:06 ` Alexander van Heukelum
2008-11-24 18:07 ` H. Peter Anvin
2008-11-23 13:23 ` Ingo Molnar
2008-11-17 9:47 ` [PATCH] trivial, entry_64: remove whitespace at end of lines Ingo Molnar
2008-11-17 15:14 ` Alexander van Heukelum
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=1226936257.32609.1285214311@webmail.messagingengine.com \
--to=heukelum@fastmail.fm \
--cc=andi@firstfloor.org \
--cc=gcosta@redhat.com \
--cc=heukelum@lusi.uni-sb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.