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=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_MUTT 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 06D06C282DD for ; Wed, 22 May 2019 14:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D124C20675 for ; Wed, 22 May 2019 14:02:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jSylTx+d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729359AbfEVOCr (ORCPT ); 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?