Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4993196ybi; Tue, 28 May 2019 06:00:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVUmnQjBGnbydMGwYXTJ037AXSJXt8WjhBefBUjijcdRlJCu4i6u8KSsVPAgd4yKFrtvPq X-Received: by 2002:a63:d615:: with SMTP id q21mr128681466pgg.401.1559048442019; Tue, 28 May 2019 06:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559048442; cv=none; d=google.com; s=arc-20160816; b=ARcdV2e/YCX3Z27RsTuFM7dLPvnYNJD704xpbCNOJ9b2t7wWV0MSssxAg+zK2U9tBg FVrnxBje78uodkQI9GEhGyRLscaRf3dp88pYWdD0aIFcqv23tUPrrJGl3+izx0HBEPWM R8Gs0aG1rVmjen7hj4vJub31eu5X60SHSx/ix6sLpSq2HRLPr7EPefujjgDxlOH/QX46 RrM8Ca9ZibUbgbm1Eoz4VPbqJgcXHkGAyJqYga4Lp/eiVXk6BxgWWOaljMAZK4NDs3v7 WeNM/FTQUHp1RFBxa+MOl7XgUWrQoTPJ/enU67+yQZQNYGN7L2uz+8qOq8JyZ344EpRe E6Sw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=a/ieT0FHPL7E8ODA/cViQ4SbhCIIppPKMg56LoStzhg=; b=BVpJ9UOyskkRkP3u36oG+EM+0L8JqoF+UuHjardry15p+IgKPJgLI21m9Ri7XP7GBt 6cDhtt97Cyge/XAJH8uR8JjwApi/qX+/b4FVLSJ+5oWbx+KO8l0+sOYgi7UOeAbq52// 9aE+oPnhbLCkU7a4veuPVFnCQjfV+nhZkFk8jxNgEB7xCSoqyK+5gSMwbt9nXAZTg4DR rXKcmCfcWQAGZ3yyePJpooDhWfJ8gjy8Fu0DtP/WZ3I8MA5UMva2E9nqEiF5n3/fEX5l 58ebs4bhwS9jcBbzPUlvZ2p+TNeo4lacVL1+S9c092lNqziVI/zDG0my5L5IBh/6JaJR +ePw== ARC-Authentication-Results: i=1; mx.google.com; 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 z12si22156858pgv.400.2019.05.28.06.00.25; Tue, 28 May 2019 06:00:42 -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; 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 S1727388AbfE1M6a (ORCPT + 99 others); Tue, 28 May 2019 08:58:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:60042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727360AbfE1M63 (ORCPT ); Tue, 28 May 2019 08:58:29 -0400 Received: from gandalf.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 AB5292081C; Tue, 28 May 2019 12:58:27 +0000 (UTC) Date: Tue, 28 May 2019 08:58:26 -0400 From: Steven Rostedt To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Masami Hiramatsu , Josh Poimboeuf , Frederic Weisbecker , Andy Lutomirski , Mark Rutland , Namhyung Kim , "Frank Ch. Eigler" Subject: Re: [PATCH 01/16 v3] function_graph: Convert ret_stack to a series of longs Message-ID: <20190528085826.796157de@gandalf.local.home> In-Reply-To: <20190528095043.GA252809@google.com> References: <20190525031633.811342628@goodmis.org> <20190525031745.235716308@goodmis.org> <20190528095043.GA252809@google.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 May 2019 05:50:43 -0400 Joel Fernandes wrote: > On Fri, May 24, 2019 at 11:16:34PM -0400, Steven Rostedt wrote: > > From: "Steven Rostedt (VMware)" > > > > In order to make it possible to have multiple callbacks registered with the > > function_graph tracer, the retstack needs to be converted from an array of > > ftrace_ret_stack structures to an array of longs. This will allow to store > > the list of callbacks on the stack for the return side of the functions. > > > > Signed-off-by: Steven Rostedt (VMware) > > --- > > include/linux/sched.h | 2 +- > > kernel/trace/fgraph.c | 124 ++++++++++++++++++++++++------------------ > > 2 files changed, 71 insertions(+), 55 deletions(-) > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > index 11837410690f..1850d8a3c3f0 100644 > > --- a/include/linux/sched.h > > +++ b/include/linux/sched.h > > @@ -1113,7 +1113,7 @@ struct task_struct { > > int curr_ret_depth; > > > > /* Stack of return addresses for return function tracing: */ > > - struct ftrace_ret_stack *ret_stack; > > + unsigned long *ret_stack; > > Can it be converted to an array of unsigned int so the shadown stack space > can be better used? This way stack overflow chance is lesser if there are too > many registered fgraph users and the function call depth is too deep. > AFAICS from patch 5/13, you need only 32-bits for the ftrace_ret_stack > offset, type and array index, so the upper 32-bit would not be used. > We can look to improve that later on. This is complex enough and I kept some features (like 4 byte minimum) out of this series to keep the complexity down. I believe there are some archs that require 64bit aligned access for 64 bit words and pointers. And the retstack structure still has longs on it. If we need to adapt to making sure we are aligned, I rather keep that complexity out for now. That said, I just did a git grep HAVE_64BIT_ALIGNED_ACCESS and only found the kconfig where it is defined and the ring buffer code that deals with it. We recently removed a bunch of archs, and it could very well be that this requirement no longer exists. Regardless, I've been testing this code quite heavily, and changing the stack from moving up to moving down already put me behind. I'd like to pull this code into linux-next soon. Converting to ints can be done for the release after we get this in. Thanks for reviewing! -- Steve