Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbdLLMMm (ORCPT ); Tue, 12 Dec 2017 07:12:42 -0500 Received: from mx2.suse.de ([195.135.220.15]:37526 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbdLLMMj (ORCPT ); Tue, 12 Dec 2017 07:12:39 -0500 Date: Tue, 12 Dec 2017 13:12:37 +0100 (CET) From: Miroslav Benes To: Torsten Duwe cc: Michael Ellerman , Jiri Kosina , Balbir Singh , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org Subject: Re: [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE In-Reply-To: <20171212113912.GA1907@lst.de> Message-ID: References: <20171004152516.25803-1-kamalesh@linux.vnet.ibm.com> <20171005124313.GA25100@lst.de> <9f388c9a-8d74-865a-b113-f77322918b39@linux.vnet.ibm.com> <20171017144733.GB2136@lst.de> <95e6f942-88b7-0208-0eb0-2f5462aec410@linux.vnet.ibm.com> <20171020120739.GA20306@lst.de> <1508547548.5662.2.camel@gmail.com> <39bb7180-1adf-4df6-c9ba-c6f92754767f@linux.vnet.ibm.com> <20171212113912.GA1907@lst.de> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1678380546-269346294-1513080758=:21907" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2300 Lines: 58 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1678380546-269346294-1513080758=:21907 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 12 Dec 2017, Torsten Duwe wrote: > Hi all, > > The "Power Architecture 64-Bit ELF V2 ABI" says in section 2.3.2.3: > > [...] There are several rules that must be adhered to in order to ensure > reliable and consistent call chain backtracing: > > * Before a function calls any other function, it shall establish its > own stack frame, whose size shall be a multiple of 16 bytes. > > – In instances where a function’s prologue creates a stack frame, the > back-chain word of the stack frame shall be updated atomically with > the value of the stack pointer (r1) when a back chain is implemented. > (This must be supported as default by all ELF V2 ABI-compliant > environments.) > [...] > – The function shall save the link register that contains its return > address in the LR save doubleword of its caller’s stack frame before > calling another function. > > To me this sounds like the equivalent of HAVE_RELIABLE_STACKTRACE. > This patch may be unneccessarily limited to ppc64le, but OTOH the only > user of this flag so far is livepatching, which is only implemented on > PPCs with 64-LE, a.k.a. ELF ABI v2. > > Signed-off-by: Torsten Duwe > > --- > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index c51e6ce42e7a..3e3a6ab2e089 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -218,6 +218,7 @@ config PPC > select HAVE_PERF_USER_STACK_DUMP > select HAVE_RCU_TABLE_FREE if SMP > select HAVE_REGS_AND_STACK_ACCESS_API > + select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN > select HAVE_SYSCALL_TRACEPOINTS > select HAVE_VIRT_CPU_ACCOUNTING > select HAVE_IRQ_TIME_ACCOUNTING I think that this is not enough. You need to also implement save_stack_trace_tsk_reliable() for powerpc defined as __weak in kernel/stacktrace.c. See arch/x86/kernel/stacktrace.c for reference, but I think it would be much much simpler here given the changelog description. Thanks, Miroslav --1678380546-269346294-1513080758=:21907--