Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753732AbbGFRkT (ORCPT ); Mon, 6 Jul 2015 13:40:19 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:34845 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752308AbbGFRkP (ORCPT ); Mon, 6 Jul 2015 13:40:15 -0400 Date: Mon, 6 Jul 2015 19:40:11 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Andy Lutomirski , "linux-kernel@vger.kernel.org" , X86 ML , Linus Torvalds , Jan Kara , Borislav Petkov , Denys Vlasenko Subject: Re: [PATCH] x86: Fix detection of GCC -mpreferred-stack-boundary support Message-ID: <20150706174011.GB30566@gmail.com> References: <20150706134423.GA8094@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Content-Length: 1614 Lines: 36 * Andy Lutomirski wrote: > > My reasoning: on modern uarchs there's no penalty for 32-bit misalignment of > > 64-bit variables, only if they cross 64-byte cache lines, which should be rare > > with a chance of 1:16. This small penalty (of at most +1 cycle in some > > circumstances IIRC) should be more than counterbalanced by the compression of > > the stack by 5% on average. > > I'll counter with: what's the benefit? There are no operations that will > naturally change RSP by anything that isn't a multiple of 8 (there's no pushl in > 64-bit mode, or at least not on AMD chips -- the Intel manual is a bit vague on > this point), so we'll end up with RSP being a multiple of 8 regardless. Even if > we somehow shaved 4 bytes off in asm, that still wouldn't buy us anything, as a > dangling 4 bytes at the bottom of the stack isn't useful for anything. Yeah, so it might be utilized in frame-pointer less builds (which we might be able to utilize in the future if sane Dwarf code comes around), which does not use push/pop to manage the stack but often has patterns like: ffffffff8102aa90 : ffffffff8102aa90: 48 83 ec 18 sub $0x18,%rsp and uses MOVs to manage the stack. Those kinds of stack frames could be 4-byte granular as well. But yeah ... it's pretty marginal. Thanks, Ingo -- 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/