From patchwork Mon Nov 29 14:28:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 12693910 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 BB45FC433F5 for ; Mon, 29 Nov 2021 14:30:28 +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=+rKoa5y6qFm5f06gvz8KHj83GZtQkZNgCjgwJq3OGtE=; b=klIAFMLGWbHhMl vFSGTYhwQ1Xs8n6WK4i0Pgm2a/pLmp0uFrHf24Nve9w+p/1jk9UgsCzLUrKufPDpxCwy4MjOAUKlN 5uhb78P35y3zLW5nFlZJgpE+0uS6wRceRGkkQzMckXE1PQ3NQnjJoKe4lPagg74b9hcrdl3Ks34co aye7gQEXBXM6fsco24i+TfLWAx2AiGfCl6jzeD3M201dDPr3x6WA1DjzYvHwT36WIz3u8GgqUzQhD iavvqKy8KVGZV5wFR2OQgzeBBuAful1q5megJb1WIGfwqiROoUPtDAHvaeeDTIdfulND6Byg4XQkw QsSEjlz7deTCsK9VTuPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrheQ-0012E2-94; Mon, 29 Nov 2021 14:29:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrheM-0012Ch-10 for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 14:28:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AFF2D1042; Mon, 29 Nov 2021 06:28:56 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4881E3F766; Mon, 29 Nov 2021 06:28:54 -0800 (PST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: aou@eecs.berkeley.edu, borntraeger@de.ibm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, gor@linux.ibm.com, hca@linux.ibm.com, madvenka@linux.microsoft.com, mark.rutland@arm.com, mhiramat@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, palmer@dabbelt.com, paul.walmsley@sifive.com, peterz@infradead.org, rostedt@goodmis.org, tglx@linutronix.de, will@kernel.org Subject: [PATCH v2 0/9] arm64: stacktrace: unify unwind code Date: Mon, 29 Nov 2021 14:28:40 +0000 Message-Id: <20211129142849.3056714-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211129_062858_185690_8B52B270 X-CRM114-Status: GOOD ( 15.16 ) 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 For historical reasons arm64 has a number of open-coded unwind functions. We'd like to unify these to reduce the amount of unwind code we have to expose, and to make it easier for subsequent patches to rework the unwind code for RELIABLE_STACKTRACE. These patches unify the various unwinders using arch_stack_walk(). So that we can use arch_stack_walk() without having to expose /proc/${PID}/stack, I've picked Peter's patch decoupling ARCH_STACKWALK from STACKTRACE, which was previously posted at: https://lore.kernel.org/lkml/20211022152104.356586621@infradead.org/ As the direction of travel seems to be to not unify the get_wchan() implementations, Peter suggested I pick the patch for now. This is the only patch in the series touching other architectures. The bulk of the series was perviously posted in Madhavan's series adding reliability checks to the unwinder: https://lore.kernel.org/linux-arm-kernel/20211015025847.17694-1-madvenka@linux.microsoft.com/ I have made some minor tweaks and updated each commit message to explain why the transformation is safe. Largely the changes should have no functional effect, but in a couple of cases there is a (benign and/or desirable) functional change, which is described in the relevant commit message. To make it possible for get_wchan() to use arch_stack_walk(), and to correct the expected behaviour of stack_trace_consume_entry_nosched() and stack_trace_save_tsk(), we need to mark arm64's __switch_to() as __sched, for which I've added a preparatory patch. Since v1 [1]: * Add necessary includes of * Remove unnecessary includes of * Rebase to v5.16-rc3 [1] https://lore.kernel.org/r/20211117140737.44420-1-mark.rutland@arm.com/ Thanks, Mark. Madhavan T. Venkataraman (5): arm64: Make perf_callchain_kernel() use arch_stack_walk() arm64: Make __get_wchan() use arch_stack_walk() arm64: Make return_address() use arch_stack_walk() arm64: Make profile_pc() use arch_stack_walk() arm64: Make dump_backtrace() use arch_stack_walk() Mark Rutland (3): arm64: Add comment for stack_info::kr_cur arm64: Mark __switch_to() as __sched arm64: Make some stacktrace functions private Peter Zijlstra (1): arch: Make ARCH_STACKWALK independent of STACKTRACE arch/arm64/include/asm/stacktrace.h | 10 ++--- arch/arm64/kernel/perf_callchain.c | 15 ++------ arch/arm64/kernel/process.c | 45 +++++++++++++--------- arch/arm64/kernel/return_address.c | 8 +--- arch/arm64/kernel/stacktrace.c | 60 +++++++---------------------- arch/arm64/kernel/time.c | 25 ++++++------ arch/powerpc/kernel/Makefile | 3 +- arch/riscv/kernel/stacktrace.c | 4 -- arch/s390/kernel/Makefile | 3 +- arch/x86/kernel/Makefile | 2 +- include/linux/stacktrace.h | 35 +++++++++-------- 11 files changed, 83 insertions(+), 127 deletions(-)