From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751623AbbEQTS7 (ORCPT ); Sun, 17 May 2015 15:18:59 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:50028 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbbEQTSu (ORCPT ); Sun, 17 May 2015 15:18:50 -0400 X-Originating-IP: 50.43.43.179 Date: Sun, 17 May 2015 12:18:44 -0700 From: Josh Triplett To: Ingo Molnar Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86: Align jump targets to 1 byte boundaries Message-ID: <20150517191844.GA8326@x> References: <20150514181707.GA21728@gmail.com> <20150515154540.GA12500@x> <20150517053429.GA17002@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150517053429.GA17002@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 17, 2015 at 07:34:29AM +0200, Ingo Molnar wrote: > > * Josh Triplett wrote: > > > On Mon, Sep 17, 2001 at 07:00:00AM +0000, Ingo Molnar wrote: > > > * Denys Vlasenko wrote: > > > > > What do you guys think about this? I think we should seriously > > > > > consider relaxing our alignment defaults. > > > > > > > > Looks like nobody objected. I think it's ok to submit > > > > this patch for real. > > > > > > Yeah, so my plan is to apply the following three changes from that > > > discussion: > > > > > > --- tip.orig/arch/x86/Makefile > > > +++ tip/arch/x86/Makefile > > > -77,6 +77,15 else > > > KBUILD_AFLAGS += -m64 > > > KBUILD_CFLAGS += -m64 > > > > > > + # Pack jump targets tightly, don't align them to the default 16 bytes: > > > + KBUILD_CFLAGS += -falign-jumps=1 > > > + > > > + # Pack functions tightly as well: > > > + KBUILD_CFLAGS += -falign-functions=1 > > > + > > > + # Pack loops tightly as well: > > > + KBUILD_CFLAGS += -falign-loops=1 > > > + > > > # Don't autogenerate traditional x87 instructions > > > KBUILD_CFLAGS += $(call cc-option,-mno-80387) > > > KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) > > > > It looks like the patch you applied to the tip tree only included one of > > these (-falign-junmps=1), not the other two. > > It's three separate patches, in case there are any regressions. Fair enough. At the time I sent my mail, only the first of the three had shown up on LKML. > > Also, you've only applied these to 64-bit; could you please apply > > them to both 32-bit and 64-bit, since many embedded systems aiming > > for small code size use 32-bit? (Unless 32-bit already defaults to > > these.) > > First things first - 64-bit is getting far more testing these days > than 32-bit. What testing do you want to see on these patches before applying them to 32-bit as well? > > Have you considered including -falign-labels=1 as well? Does that > > make a difference on top of the other three. > > So isn't the default on x86 for -falign-labels already 1? GCC's manual says that -O2 and above turn on -falign-labels, which has a machine-specific default alignment. A fair bit of digging turned up gcc/config/i386/i386.c, which does seem to have processor-specific defaults for the other three but not for align-labels. So it looks like it does indeed use the general default of 1. Nevermind. - Josh Triplett