From patchwork Tue Jan 25 13:41:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 12723780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B49AC433EF for ; Tue, 25 Jan 2022 13:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=meuwhf2HfEzreaQ9P61JEvPh8QwZafTNuf5Hdfov4Co=; b=rDVAjghllulC7y PzIgap1IHikRElc6JslUiccpzFP2hlJVVstonsp7ZSMGHL6iNg7SKurWKBsPaDjcrv+FLsCdA8zNy I6qZd7WJ2sZO2Jf1XLBWYQdqa4/CQLYZGdOvbWBhW019sc8a1aBRXDkro5fwi1toctskba8oPyzno RGIWSPU789eGV23L7pOgiPSKEjQoghaLHMCVLcoH31jgHuhOLg2DQ97oA3QCP9JkjrAkbCalZteIx WZa0BNtEnFdPzoGx2Lm1Xhj1TFndTHJYEbXuLyRDDI7fRAMqC4iElA7xJiRu5sqvKQr+7zQGn60up 1btarfQwm3+swj/SLDUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCM5Z-007y4r-V2; Tue, 25 Jan 2022 13:42:26 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCM5V-007y4C-IA for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 13:42:23 +0000 Received: by mail-lf1-x12e.google.com with SMTP id x11so56905388lfa.2 for ; Tue, 25 Jan 2022 05:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ojgoY+KUyxiibIuMzhCoB4rg4Imbet3s08pVEvqDBx4=; b=MCM1/8M2NziPVqX0m7+Em5anPyiici4oInyCSDGq1B9pO+aAEzN2h2Dzvpo3t+VI7I oRGU/8VsEo8r4qMnyUXsm2xz6Y2Lmg20iikDL2yKiIsixm61mQ8I2Xm6vSNplDt3zO5A OjwKla8MRgABnfFfJOI+jWnbhVvwwcLh6XzpHTR6pTxT2NB7sLy4tKIP8yRiyp4cJDm+ QCIRw5xL7NzZf/4F8KPjDcbsvHKR6R8uVhgr1yYXtmk45R3Yb9UsyssQ/ZTtk/QvtDh2 J3SIh1JIARoz9pnbf4EPxnvjGffo8SlKScOmzj64s+OQkfR/Yz0D7PydYbtJoPm+fINz B0lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ojgoY+KUyxiibIuMzhCoB4rg4Imbet3s08pVEvqDBx4=; b=jZ0dEI8Jcob+RbolBKBdglqO6hU9FdrL0a9gGku599OutPe9TipK8iT/i/EDrxAY3h 4lvcZBc5Y7W5Za+8bkujk+fJxo3vwT1SXP84X0JE8l7Qi1Cu9t5VdqLfzxIDW7tAE8wf n1wxsZFh6joafWRrDMOmqKHTGTjT4R9XWvcFqARVbUWVSyw17ThWgNotmgYPDcFeiwMd a9l6R7gMf0LEPf2xxEVVJIJEbkAlOii+wHkaFxTDH/SjNH0R+ePYU+KepTMtsREuA/0K qf3th+y1VvN240/CuMJvncPszDdWqhGTrnnpvRKMqh2cLto1HcpM9+Io+mGKlBD3IXXq mqdg== X-Gm-Message-State: AOAM531EU3f40wTnqZwDm0hf5sWGiKcG6a10fPyYYIp92zvrUbYSVj/f 9QtTH2hojSNSnfgfCuDNixdTwDdJgLnMWw== X-Google-Smtp-Source: ABdhPJwzWP0Vkniwk8qfbEF+/pX9FC2wXrfjLy0kl++aFH5+MySBTQVWDICmbqT5iD62u8EWPoGZfQ== X-Received: by 2002:a05:6512:1506:: with SMTP id bq6mr17300338lfb.444.1643118138782; Tue, 25 Jan 2022 05:42:18 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id p16sm895859ljn.55.2022.01.25.05.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 05:42:18 -0800 (PST) From: Anders Roxell To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Stefan Agner , Arnd Bergmann , Russell King , Anders Roxell Subject: [4.9 PATCH] ARM: 8800/1: use choice for kernel unwinders Date: Tue, 25 Jan 2022 14:41:48 +0100 Message-Id: <20220125134148.3390940-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_054221_636790_3D47DC35 X-CRM114-Status: GOOD ( 21.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Stefan Agner commit f9b58e8c7d031b0daa5c9a9ee27f5a4028ba53ac upstream. 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 Reviewed-by: Arnd Bergmann Signed-off-by: Russell King Signed-off-by: Anders Roxell --- 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 8349a171a8f3..e1d21c6449ea 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -15,30 +15,42 @@ config ARM_PTDUMP kernel. If in doubt, say "N" -# 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 bc5ff3a53d4a..e7addfcd302f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1091,7 +1091,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE + select FRAME_POINTER if !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !SCORE select KALLSYMS select KALLSYMS_ALL @@ -1670,7 +1670,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 && !SCORE + select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !SCORE help Provide stacktrace filter for fault-injection capabilities @@ -1679,7 +1679,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 + select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC select KALLSYMS select KALLSYMS_ALL select STACKTRACE