Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4262133imm; Tue, 25 Sep 2018 14:20:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV635ej+h9pU/cCZoQsX3ktqe0CKdkxgedV6IuoCCmc4FRT9vL1hPWVR9EwheUo7bOgaylAlV X-Received: by 2002:a63:1d3:: with SMTP id 202-v6mr2752461pgb.136.1537910449342; Tue, 25 Sep 2018 14:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537910449; cv=none; d=google.com; s=arc-20160816; b=UEGBMDC5wNjy93tQuYGkY8WKXl0obvALwSBtKp9AzrxsQwtOsZc3/xf8axWGSDrx7m 8P3IhfI4OuAR84Yi0Lgg8p2SoPqZudDkkNvSAfAc0tmfLT/19KBX3mIz2PvLiZJuNWvP a7OsbjoUvm2t7m2qSoypDVu60ax3RAvf77VdXzXO5DuZ8y6E4BPwLipkxzRWbDtngrOg oEeh3uBg7itgz5aRntYImuSpuc89JoNU/hUW/nCxQq3UVeF/XPGR9c7aqrfQIKApNXGl RUXUmbvrVjRWFrqTnDrmWteB9eefCacXubQw8vyVYuKxzI4LFkfio1dfhToTOkopm4x0 WcgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TyjmCDwbtrtBjDf2SQev6uItKKvZJ2dXVmb1GEcvxHY=; b=zzX1MtT2eYPteHurkr4s6Zwcl6/2q+c+IOXP8wvZjMw+IcnND88OKnjIBo+Fp7x+ai ag3TKlaaZ1Gl50JBenn2CxegOw3dN+/sLiZyqlXOgZq6GG71p/ZIYfqPQsDO9IvtWCQU ijBn0STAQRcZ9eX9xBOTAXLaKw2bgQzlk04aYkEtgsfYI04AW7pjDpELGoJeZ9pHzZTb cWtzsPaSMP+0GJD7jxkY2HVl8sp54ady2OCg/sdDcPi8imMy5KXogx+INGbqK/qV3dhT 9w7EWwIpJeOkcwQyr2JcmchbE+C22JERnm+O7BwcAxUlV8I7w1dBhlTtMTBc+80bHRGx txzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=fQMqZscO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8-v6si3372680pgu.347.2018.09.25.14.20.33; Tue, 25 Sep 2018 14:20:49 -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=pass header.i=@agner.ch header.s=dkim header.b=fQMqZscO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbeIZD3z (ORCPT + 99 others); Tue, 25 Sep 2018 23:29:55 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:40384 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726375AbeIZD3z (ORCPT ); Tue, 25 Sep 2018 23:29:55 -0400 Received: from trochilidae.toradex.int (unknown [37.17.239.3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 9C2505C059A; Tue, 25 Sep 2018 23:20:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1537910422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=TyjmCDwbtrtBjDf2SQev6uItKKvZJ2dXVmb1GEcvxHY=; b=fQMqZscOr/sYTzqO31xby/6OErpXJom3XdEaqxA5Bl7CXUt6OIOTuGsqKyTiFSqs5p+ALD OKORXa1yFCINmnwZ3UmmoJ8KXyEo3AwcZP7Zr35UFM27l7jx3lSj1/EF39EmQ8tbVQOHIR DrStCl+CtJBispJiZTsl65/NXZReRMM= From: Stefan Agner To: linux@armlinux.org.uk, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH v2] ARM: use choice for kernel unwinders Date: Tue, 25 Sep 2018 23:20:18 +0200 Message-Id: <20180925212018.27132-1-stefan@agner.ch> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While in theory multiple unwinders could be compiled in, it does not make sense in practise. Use a choice to make the unwinder selection mutually exclusive and mandatory. Already before this commit it has not been possible to deselect FRAME_POINTER. Remove the obsolete comment. Furthermore, to produce a meaningful backtrace with FRAME_POINTER enabled the kernel needs a specific function prologue: mov ip, sp stmfd sp!, {fp, ip, lr, pc} sub fp, ip, #4 To get to the required prologue gcc uses apcs and no-sched-prolog. This compiler options are not available on clang, and clang is not able to generate the required prologue. Make the FRAME_POINTER config symbol depending on !clang. Suggested-by: Arnd Bergmann Signed-off-by: Stefan Agner --- arch/arm/Kconfig.debug | 44 +++++++++++++++++++++++++++--------------- lib/Kconfig.debug | 6 +++--- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index f6fcb8a79889..3408f1ad394c 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -45,30 +45,42 @@ config DEBUG_WX If in doubt, say "Y". -# RMK wants arm kernels compiled with frame pointers or stack unwinding. -# If you know what you are doing and are willing to live without stack -# traces, you can get a slightly smaller kernel by setting this option to -# n, but then RMK will have to kill you ;). -config FRAME_POINTER - bool - depends on !THUMB2_KERNEL - default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER +choice + prompt "Choose kernel unwinder" + default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER + default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + help + This determines which method will be used for unwinding kernel stack + traces for panics, oopses, bugs, warnings, perf, /proc//stack, + livepatch, lockdep, and more. + +config UNWINDER_FRAME_POINTER + bool "Frame pointer unwinder" + depends on !THUMB2_KERNEL && !CC_IS_CLANG + select ARCH_WANT_FRAME_POINTERS + select FRAME_POINTER help - If you say N here, the resulting kernel will be slightly smaller and - faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled, - when a problem occurs with the kernel, the information that is - reported is severely limited. + This option enables the frame pointer unwinder for unwinding + kernel stack traces. -config ARM_UNWIND - bool "Enable stack unwinding support (EXPERIMENTAL)" +config UNWINDER_ARM + bool "ARM EABI stack unwinder" depends on AEABI - default y + select ARM_UNWIND help This option enables stack unwinding support in the kernel using the information automatically generated by the compiler. The resulting kernel image is slightly bigger but the performance is not affected. Currently, this feature - only works with EABI compilers. If unsure say Y. + only works with EABI compilers. + +endchoice + +config ARM_UNWIND + bool + +config FRAME_POINTER + bool config OLD_MCOUNT bool diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 4966c4fbe7f7..8d24f4ed66fd 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1179,7 +1179,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !X86 + select FRAME_POINTER if !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86 select KALLSYMS select KALLSYMS_ALL @@ -1590,7 +1590,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86 + select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 help Provide stacktrace filter for fault-injection capabilities @@ -1599,7 +1599,7 @@ config LATENCYTOP depends on DEBUG_KERNEL depends on STACKTRACE_SUPPORT depends on PROC_FS - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86 + select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 select KALLSYMS select KALLSYMS_ALL select STACKTRACE -- 2.19.0