Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1016339ybi; Tue, 16 Jul 2019 08:25:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ9bRIJzLUDHZTLESt8Fh/6+a6EhcY7YDk07KiC/eSmY18og63qa3Hz36qoIZtSA7S59xx X-Received: by 2002:a17:902:9349:: with SMTP id g9mr35803789plp.262.1563290735158; Tue, 16 Jul 2019 08:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563290735; cv=none; d=google.com; s=arc-20160816; b=GS19SFtCFqcjMKOFBuChhBECnzJsbGkZFBwq3TeDRIhaKQ5HQg+Vc/1fcYp6i23R2m 0D2DaH515mWwv+M+hzi/qyngV2X8ix8xcLWv7F548RZ+4WZB4EWtklKRoaFXItEw6uLr 7RoRQCndwG3Mh/NgmJBIBDlhKNyN0Hh7H/r+Pav2hsnkUTU5UX3NwZael+LSpKq+mXSY Kg0SxcCd5Zl21US0AmJMk/4vykc96lENpST7ByKU0Ws/UJYqVC6cW79Jn2d7VJekwFjQ fQauGMjlYlQaEwYbgOcy98GoBByEOIBppKyCiGpANE9PgrTW3DiYOaY/o6CEFeHN+Wa9 VFXw== 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=OSF+PBj1GP10hXAqZdENYfSq9n+L2QcOjjYf7j/5EkA=; b=NfBtMA5i3J8LPvK3LYeIEBCAzojINTbcHqkC2cnQMZtOhenQshoHKCEspUMPrK8QX9 QqLPUDUkGqtkPwaY+qY5M1munFtFa4FJI8JvuxJhrTUPSd+yuJarSIbAawqbydA6TJF4 gGqNpUZzUyX/2Ltf1PkfCU7UmF4f51YIMMe13e56+AsIxe/dsATR+IEyJc7JLKs2TtD1 KxyPdoaH7fEiwgAfsbh4KCgEaxJfpSHfplf9bJ9eaQM/xzGGDWW9ER5ju06S5ZhchwJt 4at+datbb81THxBxhyPgCBiS0qHOLMxVIeiwbYIH4mU3nv4qICGcc6XRQ8lHMqOUEV17 dk3Q== 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 c139si22570864pfb.140.2019.07.16.08.25.18; Tue, 16 Jul 2019 08:25:35 -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 S2387977AbfGPPYi (ORCPT + 99 others); Tue, 16 Jul 2019 11:24:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:56300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728421AbfGPPYh (ORCPT ); Tue, 16 Jul 2019 11:24:37 -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 86DE1217D9; Tue, 16 Jul 2019 15:24:35 +0000 (UTC) Date: Tue, 16 Jul 2019 11:24:33 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Changbin Du , Will Deacon , mingo@redhat.com, corbet@lwn.net, linux@armlinux.org.uk, catalin.marinas@arm.com, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] tracing/fgraph: support recording function return values Message-ID: <20190716112433.5936c60f@gandalf.local.home> In-Reply-To: <20190716142005.GE3402@hirez.programming.kicks-ass.net> References: <20190713121026.11030-1-changbin.du@gmail.com> <20190715082930.uyxn2kklgw4yri5l@willie-the-truck> <20190715101231.GB3419@hirez.programming.kicks-ass.net> <20190716140817.za4rad3hx76efqgp@mail.google.com> <20190716142005.GE3402@hirez.programming.kicks-ass.net> 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, 16 Jul 2019 16:20:05 +0200 Peter Zijlstra wrote: > On Tue, Jul 16, 2019 at 10:08:18PM +0800, Changbin Du wrote: > > On Mon, Jul 15, 2019 at 12:12:31PM +0200, Peter Zijlstra wrote: > > > > Alternatively, we can have recordmcount (or objtool) mark all functions > > > with a return value when the build has DEBUG_INFO on. The dwarves know > > > the function signature. > > > > > We can extend the recordmcount tool to search 'subprogram' tag in the DIE tree. > > In below example, the 'DW_AT_type' is the type of function pidfd_create(). > > > > $ readelf -w kernel/pid.o > > [...] > > <1><1b914>: Abbrev Number: 232 (DW_TAG_subprogram) > > <1b916> DW_AT_name : (indirect string, offset: 0x415e): pidfd_create > > <1b91a> DW_AT_decl_file : 1 > > <1b91b> DW_AT_decl_line : 471 > > <1b91d> DW_AT_decl_column : 12 > > <1b91e> DW_AT_prototyped : 1 > > <1b91e> DW_AT_type : <0xcc> > > <1b922> DW_AT_low_pc : 0x450 > > <1b92a> DW_AT_high_pc : 0x50 > > <1b932> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) > > <1b934> DW_AT_GNU_all_call_sites: 1 > > <1b934> DW_AT_sibling : <0x1b9d9> > > [...] > > > > To that end, we need to introduce libdw library for recordmcount. I will have a > > try this week. > > Right; but only when this config option is set. Sure, and we can have fgraph support of return values depend on that option ;-) > > > And probably, we can also record the parameters? > > The 'fun' part is where to store all this information in the kernel and > how fast you can find it while tracing. This has been on my TODO list for a long time (I'm really happy if someone else would do it!). My thought is that this information would need to be able to be a module and loaded (like config.gz can be). And then you can load the info, do the tracing, and then unload it. For the speed part, we can add a way to hook the function with the parameters, which shouldn't be an issue, as we already do that when filtering for function graph. There's a function hash table that fgraph users have that is tested to see if it should trace the function or not. And the functions themselves are recorded in a mostly binary array that can be looked up via a binary search from the ip address. -- Steve