Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1309543yba; Sun, 14 Apr 2019 06:36:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaXYwfzpn1aj8dxO6tY+ANgC/O9da7PknNEONoXiivxFu9irp+gkf2F+ctj4RZ4cj+ft22 X-Received: by 2002:a17:902:e01:: with SMTP id 1mr70147203plw.128.1555249016319; Sun, 14 Apr 2019 06:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555249016; cv=none; d=google.com; s=arc-20160816; b=nNrklqKEDyELirKRwyI1EUAQlc04XMKR/67uWGQQnUttuV2WaCrhHEcx39Jn3KVUUd szLEfqAIXKkGCtgWJu6KZE/pE6BjYjYyk79GEfLspuKtN/1EoBsB4N17WM1E6E3zHIVY 9N9Iif3K/zpvINQeP08W0u/5RftzRvZWXI0B8RAEvY0e/zrmgZV7cUEJkPRc7U3VZXjU QtHaoml0ifadeKesvNXk12FWCjHsIgCv0vedeiZbX70OjLpA93OlnNn1rA/dQ3CEs7aN qwfkwjvfuF6A0/Q16YeMRzyHZ6MOLR3Qb5LDlioLi06NgoIsV8iNFf1wXqvgKmYwIJM5 NJ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XRxwwo7XkDY2FwoD3XpK8KII1drhGl4PvR7q7TcOm7M=; b=yLL5rO23VCXiGv+aL7JEAT9mlS5EtWc6gQ2UznDEMEezSc9uBvmUizjoCGtplGLYDI NDdndmFFWyvRKyewmnv+N939QuW877XBdUDcntrJMuKgO/S5fJDAgMfSK2SAQBfkIjW2 xOTKRgaSCCC5I0f/G21x1cE6+C+p0170EEBi1w11H9zC/g0S915PDQ6dJQKENHIwyzVf jTthbAWcXyV0/8FJAfJPqhqfkpkKUCc6BCLF/SQc+RSRWPDaOIUsbe6EoKiMFeyKMbzb pf/mryf4cs4rCeoJv45o7NmidjMcjxoakcxu++i3c2rTbqjt4qRTzdbzvSc11oI1kJpm IupQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=HC1f8zfJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si41887852pgk.289.2019.04.14.06.36.26; Sun, 14 Apr 2019 06:36:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=HC1f8zfJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726312AbfDNNf3 (ORCPT + 99 others); Sun, 14 Apr 2019 09:35:29 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:58342 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbfDNNf3 (ORCPT ); Sun, 14 Apr 2019 09:35:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XRxwwo7XkDY2FwoD3XpK8KII1drhGl4PvR7q7TcOm7M=; b=HC1f8zfJW6LI6Fn53dl0M7pnm O7BYOaGM6Lfxlmuax8ieq09asiLoeF5HPlJkUtvYZFUk5Vw4J3e33IDAh6fvcASx2m3y0CWvUtP6u rJT7zd+I4OwU0JftAE3ZLMkDopm96tkdjuAWA6MJ1KKkFjLDWx42djcnAaGSB8Vot9dI9AR0durx3 YV85kxGwIr6UDreTDwRR7xAJYCh7O4WA36y0V6chSzunmv6YvjaRe2IYqCi6fdqG3I+Cc58PrXlN2 qVv2/UsfhgNek1VNBGjxBe3bx18O31ZciTKFdZMJL6l/1PT56g/R102IZ/t1SnnBh5rdArniZVL4W xLGIqLs9w==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:55456) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hFfHn-00074U-VQ; Sun, 14 Apr 2019 14:35:08 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1hFfHe-0006em-SF; Sun, 14 Apr 2019 14:34:58 +0100 Date: Sun, 14 Apr 2019 14:34:58 +0100 From: Russell King - ARM Linux admin To: Masami Hiramatsu Cc: Steven Rostedt , Stefan Agner , Arnd Bergmann , Masahiro Yamada , linux-arm-kernel@lists.infradead.org, naresh.kamboju@linaro.org, linux-kernel@vger.kernel.org Subject: Re: Kconfig dependency issue on function-graph tracer and frame pointer on arm Message-ID: <20190414133458.zxdekgx6qwd562qa@shell.armlinux.org.uk> References: <20190414194705.2e10802aca2df36c8f27f349@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190414194705.2e10802aca2df36c8f27f349@kernel.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 14, 2019 at 07:47:05PM +0900, Masami Hiramatsu wrote: > Hello, > > Recently, Naresh reported that the function-graph tracer on the latest > kernel crashes on arm. I could reproduce it and bisected. I finally found > the commit f9b58e8c7d03 ("ARM: 8800/1: use choice for kernel unwinders") > was the first bad commit. I don't think that littering the rest of the kernel Kconfig with ARM specific stuff is really a viable solution to this. If we examine the current situation, we have: - THUMB2_KERNEL selecting ARM_UNWIND when enabled. - UNWINDER_FRAME_POINTER disabled if THUMB2_KERNEL is enabled, provided we're not using Clang. This leaves UNWINDER_ARM as the only choice, which also selects ARM_UNWIND. - The default choice is dependent on the settings of AEABI and FUNCTION_GRAPH_TRACER. - HAVE_FUNCTION_GRAPH_TRACER is disabled if THUMB2_KERNEL is enabled. which seems to be _way_ too messy. Looking back before this commit, the function graph tracer never had a strong dependence on frame pointers being enabled in the kernel, but it seems the code relies upon them (see ftrace_return_to_handler() in kernel/trace/ and return_to_handler in arch/arm/kernel/entry-frace.S). There is also the __ftrace_graph_caller macro which seems to rely on it. Since Clang does not support frame pointers, we shouldn't even offer the function graph tracer for Clang compilers, so let's do that with the first hunk of the patch below. The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case. Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers. So, how about this: diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 850b4805e2d1..9aed25a6019b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 6d6e0330930b..e388af4594a6 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc//stack, @@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernel -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up