mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Roland McGrath <roland@redhat.com>
Cc: Jan Beulich <jbeulich@novell.com>,
	heukelum@fastmail.fm, Andi Kleen <andi@firstfloor.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alexander van Heukelum <heukelum@mailshack.com>,
	Glauber Costa <gcosta@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [RFC,v2] x86_64: save_args out of line
Date: Wed, 19 Nov 2008 21:09:59 +0100	[thread overview]
Message-ID: <20081119200959.GA31867@elte.hu> (raw)
In-Reply-To: <20081119103415.GA16516@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> What _clearly_ sucks is the current mess of:
> 
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        ss,0*/
>         pushq %rax /* rsp */
>         CFI_ADJUST_CFA_OFFSET   8
>         CFI_REL_OFFSET  rsp,0
>         pushq $(1<<9) /* eflags - interrupts on */
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        rflags,0*/
>         pushq $__KERNEL_CS /* cs */
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        cs,0*/
>         pushq \child_rip /* rip */
>         CFI_ADJUST_CFA_OFFSET   8
>         CFI_REL_OFFSET  rip,0
>         pushq   %rax /* orig rax */
>         CFI_ADJUST_CFA_OFFSET   8
> 
> Compared to what we could have (stupid mockup):
> 
>         pushq_cf1 %rax			/* rsp */
>         pushq_cf1 $(1<<9)		/* eflags - interrupts on */
>         pushq_cf1 $__KERNEL_CS		/* cs */
>         pushq_cf2 \child_rip		/* rip */
>         pushq_cf1 %rax			/* orig rax */
> 
> Whoever claims that this cannot be automated in _large_ part isnt 
> thinking it through really. Those CFI annotations should never have 
> been added in this form.

Something like this would be a lot cleaner equivalent replacement:

         PUSHQ %rax			/* rsp 			  */
         PUSHQ $(1<<9)			/* eflags - interrupts on */
         PUSHQ $__KERNEL_CS		/* cs 			  */
         PUSHQ \child_rip		/* rip			  */
          cfi_map rip, 0
         PUSHQ %rax			/* orig rax		  */

as most of the really annoying CFI annotations in entry_64.S that 
obscruct code reading are just plain CFA offset modifications related 
to stack shuffling.

[ Sidenote: trying to connect up RIP like that in the FAKE_STACK_FRAME
  is pretty wrong to begin with - the annotation is incomplete up to
  this point. ]

The problems are not caused by the prologue or epilogue annotations, 
nor by any of the trickier stack shuffling annotations we do around 
syscall/sysret and around exception frames. A lot of the frame formats 
we use are special, controlled by hw details and we do have to map 
those details to the debuginfo - it's an inevitably manual piece of 
work.

It's the plain crappy:

        pushq %rdi
        CFI_ADJUST_CFA_OFFSET 8
        call schedule
        popq  %rdi
        CFI_ADJUST_CFA_OFFSET -8

annotation spam that hurts readability the most. The "+8" and "-8" 
CFA-offset lines are completely uninformative and they obsctruct the 
reading of this already very trick type of source code (assembly 
language).

It should be something like this:

        PUSHQ %rdi
        call schedule
        POPQ %rdi

instead.

	Ingo

  reply	other threads:[~2008-11-19 20:10 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
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 [this message]
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=20081119200959.GA31867@elte.hu \
    --to=mingo@elte.hu \
    --cc=andi@firstfloor.org \
    --cc=gcosta@redhat.com \
    --cc=heukelum@fastmail.fm \
    --cc=heukelum@mailshack.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /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®