From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7E6DC47080 for ; Tue, 1 Jun 2021 15:28:52 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 915066139A for ; Tue, 1 Jun 2021 15:28:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 915066139A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FvbfV2jXkz306R for ; Wed, 2 Jun 2021 01:28:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=srs0=ly5d=k3=goodmis.org=rostedt@kernel.org; receiver=) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Fvbf7371fz2yZF for ; Wed, 2 Jun 2021 01:28:31 +1000 (AEST) Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5720B613AB; Tue, 1 Jun 2021 15:28:26 +0000 (UTC) Date: Tue, 1 Jun 2021 11:28:24 -0400 From: Steven Rostedt To: "Naveen N. Rao" Subject: Re: [RFC PATCH 1/6] trace/stack: Move code to save the stack trace into a separate function Message-ID: <20210601112824.29c5f168@oasis.local.home> In-Reply-To: <6a8b68f8bd64f8c16d97ef943534c639781e7f77.1621577151.git.naveen.n.rao@linux.vnet.ibm.com> References: <6a8b68f8bd64f8c16d97ef943534c639781e7f77.1621577151.git.naveen.n.rao@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Torsten Duwe , Michal Suchanek , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, 21 May 2021 12:18:36 +0530 "Naveen N. Rao" wrote: > In preparation to add support for stack tracer to powerpc, move code to > save stack trace and to calculate the frame sizes into a separate weak > function. Also provide access to some of the data structures used by the > stack trace code so that architectures can update those. > > Signed-off-by: Naveen N. Rao > --- > include/linux/ftrace.h | 8 ++++ > kernel/trace/trace_stack.c | 98 ++++++++++++++++++++------------------ > 2 files changed, 60 insertions(+), 46 deletions(-) > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > index a69f363b61bf73..8263427379f05c 100644 > --- a/include/linux/ftrace.h > +++ b/include/linux/ftrace.h > @@ -368,10 +368,18 @@ static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, > > #ifdef CONFIG_STACK_TRACER > > +#define STACK_TRACE_ENTRIES 500 > + > +extern unsigned long stack_dump_trace[STACK_TRACE_ENTRIES]; > +extern unsigned stack_trace_index[STACK_TRACE_ENTRIES]; > +extern unsigned int stack_trace_nr_entries; > +extern unsigned long stack_trace_max_size; > extern int stack_tracer_enabled; > > int stack_trace_sysctl(struct ctl_table *table, int write, void *buffer, > size_t *lenp, loff_t *ppos); > +void stack_get_trace(unsigned long traced_ip, unsigned long *stack_ref, > + unsigned long stack_size, int *tracer_frame); > > /* DO NOT MODIFY THIS VARIABLE DIRECTLY! */ > DECLARE_PER_CPU(int, disable_stack_tracer); > diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c > index 63c28504205162..5b63dbd37c8c25 100644 > --- a/kernel/trace/trace_stack.c > +++ b/kernel/trace/trace_stack.c > @@ -19,13 +19,11 @@ > > #include "trace.h" > > -#define STACK_TRACE_ENTRIES 500 > +unsigned long stack_dump_trace[STACK_TRACE_ENTRIES]; > +unsigned stack_trace_index[STACK_TRACE_ENTRIES]; > > -static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES]; > -static unsigned stack_trace_index[STACK_TRACE_ENTRIES]; > - > -static unsigned int stack_trace_nr_entries; > -static unsigned long stack_trace_max_size; > +unsigned int stack_trace_nr_entries; > +unsigned long stack_trace_max_size; > static arch_spinlock_t stack_trace_max_lock = > (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; > > @@ -152,49 +150,19 @@ static void print_max_stack(void) > * Although the entry function is not displayed, the first function (sys_foo) > * will still include the stack size of it. > */ > -static void check_stack(unsigned long ip, unsigned long *stack) I just got back from PTO and have a ton of other obligations to attend to before I can dig deeper into this. I'm not opposed to this change, but the stack_tracer has not been getting the love that it deserves and I think you hit one of the issues that needs to be addressed. I'm not sure this is a PPC only issue, and would like to see if I can get more time (or someone else can) to reevaluate the way stack tracer works, and see if it can be made a bit more robust. -- Steve