Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp510915ybm; Wed, 22 May 2019 07:06:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyK+627swVqWaL5wx66w4OlcLrDn8rGiPHO6mSyh5BGiQemju1iiAnDtCiG0pDT/49Gq7zb X-Received: by 2002:aa7:8a53:: with SMTP id n19mr95762951pfa.11.1558534005188; Wed, 22 May 2019 07:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558534005; cv=none; d=google.com; s=arc-20160816; b=IyJR85f94YkzCY6Ye0+4yVToUtbJohEqWez7i66jy9iGBUhSxRraRmLjD1b6/7ALgr dG2hXLn7sQfvmP1vV7ag9GbMPIOhxBjWR8P4QxarRfq3YMykUT8teXSxxeSlf7EL/kIJ S2tGub6X7ESOxtQH7fDVtjdYpW42Fyky5gfgey8zYTxWwF9GsntWxHJIu8wBbs/b1KoZ sGB2LUYtYJAiyC/d9kG34dn0bwSuKKhao0y3MNpIwNMSOkoWin3KRRFbmBigDQC+pzi+ omkxxwN0FHIFTP+oGn39ilnMw3f3g4iWWZCoQXiCI/4ao1AjWcS4uPbNFcqmfFi5rS82 vyxg== 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=pjByW6gfyq8J56QOG3nVPteOmnGd+8AJq7yqIOVeIW8=; b=I4ffHKQ7/bxfefBcNRlG6Nspxkshk7EXLsoMJ6aWKuJWlv74VCU9D7CUME4zwWtiHS OPJjUT1i0bUqkuPwppXBYFv9+ArOaGtNKcQIAiEiTAnVaRHzdo7ecPoOTIQSoQvQ8/pd 81SFxeZU/4fF6Xzc1dWXrEBfYweypK36EpFsUFNwMNYt65VCerGLHICor6l9Ex4hKUI6 +Qoz/MS+YBpUgJ9tTliUwh+pYjqwIK/bYmXjs6eXYaORPD0KE7ji7XCbJaIAdCmihDBA t3mu9xeAjDVE41Qc+DV+EhBqKwjOxIVd8gpD+syf+0Kn5ZIIObL0HwyqChBWYKporPgb 9IFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jSylTx+d; 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 p91si24921230plb.165.2019.05.22.07.06.23; Wed, 22 May 2019 07:06:45 -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=jSylTx+d; 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 S1729172AbfEVOCr (ORCPT + 99 others); Wed, 22 May 2019 10:02:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48980 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbfEVOCq (ORCPT ); Wed, 22 May 2019 10:02:46 -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=pjByW6gfyq8J56QOG3nVPteOmnGd+8AJq7yqIOVeIW8=; b=jSylTx+dtDY27R/9zyAtnQuGd 2rpFdeiKeEUBOzSWnEjTXU0kWkDxxNhIio5aLeWAuTfZKggElDBRI1vEdPT6/ulUMBMWhoTvQY21G qTESaXQyXEz9+onCPfz5Z9FYfK1MK5Y4SFc80kIeNP7YZC8moG9tw52NJJjl1jrvdX2i7RCV9OxQc 5ORLh13jaUCyCY5jdNCafQsoliiz7+zQT4yTExBCf0F+mLlKvQNwHI9jjOK4bz1M/Ph1zgJkNG6zU kcCifdfk7O91hPfKIvTmS+QQzwhjXgkaNqFXpyHPa4DiY2/v7RwlA4JW72IkJCwAnVYc2FLx7vp1z PGdr2DTig==; Received: from [31.161.185.207] (helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTRpA-0005gp-DD; Wed, 22 May 2019 14:02:32 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id B9462984E09; Wed, 22 May 2019 16:02:33 +0200 (CEST) Date: Wed, 22 May 2019 16:02:33 +0200 From: Peter Zijlstra To: Kairui Song Cc: Song Liu , lkml , Kernel Team , Josh Poimboeuf , Alexei Starovoitov , Daniel Borkmann , "bpf@vger.kernel.org" Subject: Re: Getting empty callchain from perf_callchain_kernel() Message-ID: <20190522140233.GC16275@worktop.programming.kicks-ass.net> References: <3CD3EE63-0CD2-404A-A403-E11DCF2DF8D9@fb.com> <20190517074600.GJ2623@hirez.programming.kicks-ass.net> <20190517081057.GQ2650@hirez.programming.kicks-ass.net> <20190517091044.GM2606@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, May 20, 2019 at 02:06:54AM +0800, Kairui Song wrote: > On Fri, May 17, 2019 at 5:10 PM Peter Zijlstra wrote: > > > > On Fri, May 17, 2019 at 04:15:39PM +0800, Kairui Song wrote: > > > Hi, I think the actual problem is that bpf_get_stackid_tp (and maybe > > > some other bfp functions) is now broken, or, strating an unwind > > > directly inside a bpf program will end up strangely. It have following > > > kernel message: > > > > Urgh, what is that bpf_get_stackid_tp() doing to get the regs? I can't > > follow. > > bpf_get_stackid_tp will just use the regs passed to it from the trace > point. And then it will eventually call perf_get_callchain to get the > call chain. > With a tracepoint we have the fake regs, so unwinder will start from > where it is called, and use the fake regs as the indicator of the > target frame it want, and keep unwinding until reached the actually > callsite. > > But if the stack trace is started withing a bpf func call then it's broken... I'm confused.. how is this broken? Surely we should eventually find the original stack frame and be good again, right? > If the unwinder could trace back through the bpf func call then there > will be no such problem. Why couldn't it trace back through the bpf stuff? And how can we fix that?