Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1162913

Re: [PATCH v5 02/10] x86: Compile-time asm code validation

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 02/10] x86: Compile-time asm code validation
Date 2015-06-11 00:20 +0200
Message-ID <pzWvM-2SP-1@gated-at.bofh.it> (permalink)
References (1 earlier) <pzMZu-5IH-63@gated-at.bofh.it> <pzRZ8-4CW-15@gated-at.bofh.it> <pzSsa-5bn-7@gated-at.bofh.it> <pzSLy-5Ou-75@gated-at.bofh.it> <pzTof-6yx-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jun 10, 2015 at 01:58:45PM -0500, Josh Poimboeuf wrote:
> On Wed, Jun 10, 2015 at 11:15:19AM -0700, Andy Lutomirski wrote:
> > On Wed, Jun 10, 2015 at 10:53 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > > On Wed, Jun 10, 2015 at 10:21:36AM -0700, Andy Lutomirski wrote:
> > >> GCC can generate those, and the ia32_ptregs_common label is an example
> > >> of such a thing.
> > >>
> > >> I'd rather have the script understand tail calls and possibly require
> > >> that ia32_ptregs_common have a dummy frame pointer save in front
> > >> before the label if needed.
> > >
> > > Why do you prefer tail calls there?  See patch 3 for how I handled that
> > > for ia32_ptregs_common (I duplicated the code with macros).
> > >
> > > I think adding support for tail calls in the tooling would be tricky.
> > > So I'm just trying to figure out if there's a good reason to keep them.
> > 
> > To save code size by deduplicating common tails.  The code currently
> > does that, and it would be nice to avoid bloating the code to keep the
> > validator happy.
> 
> Well, I wonder whether it's really worth sacrificing code readability
> and consistency, and maybe some improved i-cache locality, to save a few
> hundred bytes of code size.

I should also mention that my proposed ia32_ptregs_common patch, which
duplicated the needed code, was more optimized for performance than code
size.

But if you're more worried about code size, we could turn
ia32_ptregs_common into a proper callable function, and then replace

   jmp ia32_ptregs_common

with:

   call ia32_ptregs_common
   ret

So it becomes a regular call instead of a tail call.  It only adds a few
instructions and the function is self-contained.  Would that be good
enough?

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v5 02/10] x86: Compile-time asm code validation Josh Poimboeuf <jpoimboe@redhat.com> - 2015-06-11 00:20 +0200

csiph-web