Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754467AbdCHVhP (ORCPT ); Wed, 8 Mar 2017 16:37:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50730 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754162AbdCHVhN (ORCPT ); Wed, 8 Mar 2017 16:37:13 -0500 Date: Wed, 8 Mar 2017 15:29:59 -0600 From: Josh Poimboeuf To: Linus Torvalds Cc: Andy Lutomirski , Pavel Machek , kernel list , Ingo Molnar , Andrew Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , Peter Anvin , Peter Zijlstra , Thomas Gleixner , Steven Rostedt Subject: Re: v4.10: kernel stack frame pointer .. has bad value (null) Message-ID: <20170308212959.ctb2ktqkg5l6r2xj@treble> References: <20170225050439.7dplheb6nyne4nkm@treble> <20170302234514.3qcqdozibcltkdai@treble> <20170306163807.GA20689@amd> <20170307173821.yknj5htr7plgdwxv@treble> <20170307182855.262ezbon2pm67qfd@treble> <20170308173703.2h57rsltma3smbcm@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 08 Mar 2017 21:30:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1852 Lines: 48 [adding Steven Rostedt to CC as an FYI] On Wed, Mar 08, 2017 at 10:25:01AM -0800, Linus Torvalds wrote: > On Wed, Mar 8, 2017 at 9:37 AM, Josh Poimboeuf wrote: > > - CONFIG_FUNCTION_GRAPH_TRACER sets it on x86-32 because of a gcc bug > > where the stack gets aligned before the mcount call. This issue > > should be mostly obsolete as most modern compilers now have -mfentry. > > We could make it dependent on CC_USING_FENTRY. > > Yeah. At some point we might even upgrade the compiler requirements to > no longer accept the mcount model. The plot slightly thickens... So I was mistaken about this problem not existing with newer versions of gcc, because the x86-32 ftrace code doesn't use -mfentry. It still relies on mcount. So CONFIG_FUNCTION_GRAPH_TRACER will still need -maccumulate-outgoing-args for *all* versions of gcc on x86-32. (Of course, that situation would improve if ftrace on x86-32 were ported to use -mfentry.) Also, since -Os tells gcc to ignore -maccumulate-outgoing-args, this means that CONFIG_FUNCTION_GRAPH_TRACER with mcount needs a dependency on CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE. I suspect these issues also affect x86-64 with gcc 4.4.x and 4.5.x, which corresponds to the window after the funky DRAP prologue was introduced but before -mfentry was introduced. In summary, here are the changes I'm looking at: - set -maccumulate-outgoing-args if CONFIG_FUNCTION_GRAPH_TRACER && !CC_USING_ENTRY (for both 32- and 64-bit) - somehow make CONFIG_FUNCTION_GRAPH_TRACER depend on either CC_USING_FENTRY or CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE (for both 32- and 64-bit) (not sure how to do that -- maybe just fail the build in the graph tracer + mcount + '-Os' case) - set -maccumulate-outgoing-args if CONFIG_JUMP_LABEL && gcc < 4.5.2 (for both 32-bit and 64-bit) -- Josh