Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934218AbbGVLwJ (ORCPT ); Wed, 22 Jul 2015 07:52:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41499 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933918AbbGVLwG (ORCPT ); Wed, 22 Jul 2015 07:52:06 -0400 Date: Wed, 22 Jul 2015 06:52:04 -0500 From: Josh Poimboeuf To: Ingo Molnar Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Michal Marek , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , Pedro Alves , X86 ML , live-patching@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH 13/21] x86/asm/crypto: Fix frame pointer usage in aesni-intel_asm.S Message-ID: <20150722115204.GA23235@treble.redhat.com> References: <2ea0f0602978178eafd012e52b8bdb83cfb159d5.1437150175.git.jpoimboe@redhat.com> <20150717194307.GA26757@gmail.com> <20150717203746.GB12761@treble.redhat.com> <20150718025116.GB13059@gmail.com> <20150718035623.GA22664@treble.redhat.com> <20150720075611.GA11874@gmail.com> <20150720135930.GB7326@treble.redhat.com> <20150720172124.GA13344@gmail.com> <20150720180006.GD28075@treble.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150720180006.GD28075@treble.redhat.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2630 Lines: 68 On Mon, Jul 20, 2015 at 01:00:06PM -0500, Josh Poimboeuf wrote: > On Mon, Jul 20, 2015 at 07:21:24PM +0200, Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > Ok, I see how the naming scheme I proposed won't work with all that very well, but > > I'd still suggest using consistently named patterns. > > > > Let me suggest yet another approach. How about open-coding something like this: > > > > FUNCTION_START(func) > > > > push_bp > > mov_sp_bp > > > > ... > > > > pop_bp > > ret > > > > FUNCTION_END(func) > > > > This is just two easy things: > > > > - a redefine of the FUNCTION_ENTRY and ENDPROC names > > > > - the introduction of three quasi-mnemonics: push_bp, mov_sp_bp, pop_bp - which > > all look very similar to a real frame setup sequence, except that we can easily > > make them go away in the !CONFIG_FRAME_POINTERS case. > > > > The advantage of this approach would be: > > > > - it looks pretty 'natural' and very close to how the real disassembly looks > > like in CONFIG_FRAME_POINTERS=y kernels. So while it's not as compact as some > > of the other variants, it's close to what the real instruction sequence looks > > like and that is a positive quality in itself. > > > > - it also makes it apparent 'on sight' that it's probably a bug to have > > unbalanced push/pop sequences in a regular function, to any reasonably alert > > assembly coder. > > > > - if we ever unsupport framepointer kernels in the (far far) future, we can get > > rid of all lines with those 3 mnemonics and be done with it. > > > > - it's finegrained enough so that we can express all the special function/tail > > variants you listed above. > > > > What do you think? > > I agree that the edge cases make FUNCTION_ENTRY and FUNCTION_RETURN less > attractive. Slowly we are circling around to where we started :-) > > Personally, I prefer FRAME/ENDFRAME instead of push_bp/mov_sp_bp/pop_bp, > because it more communicates *what* it's doing rather than how. IMO, > it's easier to grok with a quick glance. Ingo, any chance this last paragraph was a convincing argument to continue to use FRAME/ENDFRAME over push_bp/mov_sp_bp/pop_bp? (I think this is the last outstanding issue from the reviews, so I'm all set to send out a new version of the patches once there's agreement on this issue.) -- 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/