Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4061203ybi; Mon, 15 Jul 2019 03:15:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqytxNvIWLdDe5HFG5yrM6QI+KdgHCvVzvJ7LfaluhHJSJI+14pS40XuiIel2vfI1gf3U9jY X-Received: by 2002:a17:90a:d593:: with SMTP id v19mr28429712pju.1.1563185712378; Mon, 15 Jul 2019 03:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563185712; cv=none; d=google.com; s=arc-20160816; b=YOadcOeLV4avgG9cnYRMbhQZWfLmZ4VHYZbjSNS4Z7x2IAoG3eiDaB16qMjXOH7k54 l9FTtziOvt80u8QVNeQXtXlEhiJ494FOdHhGYrAraD4Wi6+Kg4+rzzI0ahecPUn5gRpQ apHKzrVrqwlj28Xly1+i24igbA7k6LCwvuFLrWoawqOfQnHP2IoEPAWR8sgPSuHR9xhq nN2Pr/LSgJVCYEptD01zBnuCr5Me4iYLdcST9Mdn44LSWS2WkE6xvYyhBEQER+jj6/j6 rKEWTOLdQuEND56+LvTt+HjsMwIhd+AMFfqE/ab7PpR1wdJK8p3PHTJnRqSdE3kkcFUX D48w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kAcyOVm59qdRJtG2/iEIXHURMzlURvoUqEQmVMxznZ4=; b=LBhuRztBWB8V+4oXdY7R28JxqLYJnkY50WBy2fW1JOa1W9bVCPHdwUKcMCCA9POgQW 4d/evTkWcg4qzGPZyhzPOwc5BspAmXtrX3e8FRnZLZjnDJhpGA1nSjLU0N5lRL+iu72U 8l1eDQxyPPPQq7ViekHX+Xcp4PhZKeuke6hYU6/q+TB+WS3Q4JDdYl1pDFmzhvQvZzRc 4SmXl7kG6rftoqy2zrwS4no5pYUdNaJE5dLhjaqJ4Eu1E50H+P2cmFF7kWgciaXOTXso iHxaipJk9+pLJUG7MBDSCQPedOC+XBeEYwS3TyWMuT81GDcSaGOvhzWIOZOQZD1y8R90 qpfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ap2JCWPd; 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 g12si15521083pla.363.2019.07.15.03.14.56; Mon, 15 Jul 2019 03:15:12 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ap2JCWPd; 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 S1729674AbfGOKMy (ORCPT + 99 others); Mon, 15 Jul 2019 06:12:54 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46292 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729428AbfGOKMx (ORCPT ); Mon, 15 Jul 2019 06:12:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kAcyOVm59qdRJtG2/iEIXHURMzlURvoUqEQmVMxznZ4=; b=Ap2JCWPd1ucMlufGhT5Kn+WD8 NGEchrdhHoT0rv3FQgahdfCU5u+mlZdnhiecpT2DXUVgHD026Zt0fFL/7HJxeMDq3DgEAF2IqU6Vi M9eIcXeZZ44lBx+CP+WLs38XqzebI837RgLv8b/xUUAh4y1HjtSNJJBK9EgJ0YGdIpyGcYrFkLkeU Nl8QbpfpLa9VtGMi38NFbTCv+lAN6gQOELjRljRtwokUIkJdA1WscK529Gx3PrSykBkdvdR4id8Pw XmQ2z03V43Y0y8LrZEB4bKS3qXinAUKsvQg2/F/NUt0qN/VTAeoU74QfKQo50doaXXrDat7w8iYz3 FlWaJQA+A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hmxyD-0006Hm-PE; Mon, 15 Jul 2019 10:12:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B542520B29100; Mon, 15 Jul 2019 12:12:31 +0200 (CEST) Date: Mon, 15 Jul 2019 12:12:31 +0200 From: Peter Zijlstra To: Will Deacon Cc: Changbin Du , rostedt@goodmis.org, 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: <20190715101231.GB3419@hirez.programming.kicks-ass.net> References: <20190713121026.11030-1-changbin.du@gmail.com> <20190715082930.uyxn2kklgw4yri5l@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190715082930.uyxn2kklgw4yri5l@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 15, 2019 at 09:29:30AM +0100, Will Deacon wrote: > On Sat, Jul 13, 2019 at 08:10:26PM +0800, Changbin Du wrote: > > This patch adds a new trace option 'funcgraph-retval' and is disabled by > > default. When this option is enabled, fgraph tracer will show the return > > value of each function. This is useful to find/analyze a original error > > source in a call graph. > > > > One limitation is that the kernel doesn't know the prototype of functions. > > So fgraph assumes all functions have a retvalue of type int. You must ignore > > the value of *void* function. And if the retvalue looks like an error code > > then both hexadecimal and decimal number are displayed. > > This seems like quite a significant drawback and I think it could be pretty > confusing if you have to filter out bogus return values from the trace. > > For example, in your snippet: > > > 3) | kvm_vm_ioctl() { > > 3) | mutex_lock() { > > 3) | _cond_resched() { > > 3) 0.234 us | rcu_all_qs(); /* ret=0x80000000 */ > > 3) 0.704 us | } /* ret=0x0 */ > > 3) 1.226 us | } /* ret=0x0 */ > > 3) 0.247 us | mutex_unlock(); /* ret=0xffff8880738ed040 */ > > mutex_unlock() is wrongly listed as returning something. > > How much of this could be achieved from userspace by placing kretprobes on > non-void functions instead? 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.