Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5427437ybi; Wed, 12 Jun 2019 02:16:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWxk+ThoyMyzOVHETZLdj3dwCHBfgdITdZT45saNxbQKtxU1zyFppDuqwSV+alIZt/ua+6 X-Received: by 2002:a17:902:110b:: with SMTP id d11mr8384351pla.213.1560331006459; Wed, 12 Jun 2019 02:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560331006; cv=none; d=google.com; s=arc-20160816; b=QYVGPVg8Q8sOLdycv6Si0WeNPMo9MMKiaP125j8aITKpz+8GmXIdGY//gU1dN1jpPc ArZpI7qOgC6/dReuI4gt8FkRQMSfqHeMbX384DPFp059Bo2Jmahf/Ez/YjRU4bi2eGqW +S6z+1Ql7XF7+ZXd17PEgdXx09Y3zeIwmPjNp8pr1gji4+U2w51I2EouBSQKEjkF9gke ua1c4IGYu2shquWpQrIh/zxUMncei8mkIrbq79l3KUFguUOBmM/43AcR6K724NDG4Uc+ Jb4Ntms0yTflvaqr7+fC9VEM3w4Q4NSN0zg8xOTeeHrj/Yh+Oc5CDQ7irAsqlI4YzFo6 o4Pg== 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=DX/8C5iPqro7r1mMnPX+ipmA3A/CBB6VQR50M3FGzco=; b=eIRbBBqaYPB6vhbLMZLas0yqbJ9gScXv23KRS943QK8EIci9h/OBLHYhy8OVRASvie u1zWVisb9VMBv/O9NJn68nTYU4CRVI/lgQYCqkWlHLmjasihE3U4tM5utF61vd2Qb6Su t6B8MrvOyVeZBHrlORRCM73xHAWrOB3HB76tR6DX7i3mCDWhRbAjgbuseDYUYCNh14BO XZiKLGRPkaG8sJtDnEfxKGFuoS2xWIs/GrPlYzyYuq8MdzNVXcIzBTttHbtgJzZ1/yO4 jMFWoKfZwohP3qRSColPKOb21zivVNKXP53Ya5LGBQ/dIMINEcFh5NhCabHcxvphzkUa H0lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=F95PB4+p; 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 k1si4782303pjl.15.2019.06.12.02.16.29; Wed, 12 Jun 2019 02:16:46 -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=F95PB4+p; 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 S2437402AbfFLIyv (ORCPT + 99 others); Wed, 12 Jun 2019 04:54:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38322 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731714AbfFLIyu (ORCPT ); Wed, 12 Jun 2019 04:54:50 -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=DX/8C5iPqro7r1mMnPX+ipmA3A/CBB6VQR50M3FGzco=; b=F95PB4+p5JUAzXjmnWgrl96Me kJ0qo/iMAQOz9m7GDAkW9INg3OhbW6riHwB6NXrVEY+0CpDYvrBOfga0YqJtk5NnTNxAQ5mzvHFbi X2AphJOsAhvHzNhoApoUTd21k8GVgUJmpgXmg50ZjMC769dCOs939h5yZ/6KSF15rRSBtXG6ggyT1 pGETfaDcWYoprry8vXfMsr+e1pNLgsawCNQZvKY2r1F2Vpmtge8zAqaJjROFwyA+mX4Cakl7kVJ+F hsylT918Fk6WqLxEPbMVDxLl6VYmXDq0cUAEB1RyZwwC3Ss9OcP/+CgrtSwpTmrXU+2XqVOGKzYYD M+nQJGUhA==; 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 1haz1V-0005Zz-Re; Wed, 12 Jun 2019 08:54:26 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4A6EB20564E2A; Wed, 12 Jun 2019 10:54:23 +0200 (CEST) Date: Wed, 12 Jun 2019 10:54:23 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: Kairui Song , Alexei Starovoitov , Song Liu , lkml , Kernel Team , Alexei Starovoitov , Daniel Borkmann , "bpf@vger.kernel.org" , Steven Rostedt Subject: Re: Getting empty callchain from perf_callchain_kernel() Message-ID: <20190612085423.GE3436@hirez.programming.kicks-ass.net> References: <20190522140233.GC16275@worktop.programming.kicks-ass.net> <20190522174517.pbdopvookggen3d7@treble> <20190522234635.a47bettklcf5gt7c@treble> <20190523133253.tad6ywzzexks6hrp@treble> <20190523152413.m2pbnamihu3s2c5s@treble> <20190524085319.GE2589@hirez.programming.kicks-ass.net> <20190612030501.7tbsjy353g7l74ej@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190612030501.7tbsjy353g7l74ej@treble> 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 Tue, Jun 11, 2019 at 10:05:01PM -0500, Josh Poimboeuf wrote: > On Fri, May 24, 2019 at 10:53:19AM +0200, Peter Zijlstra wrote: > > > For ORC, I'm thinking we may be able to just require that all generated > > > code (BPF and others) always use frame pointers. Then when ORC doesn't > > > recognize a code address, it could try using the frame pointer as a > > > fallback. > > > > Yes, this seems like a sensible approach. We'd also have to audit the > > ftrace and kprobe trampolines, IIRC they only do framepointer setup for > > CONFIG_FRAME_POINTER currently, which should be easy to fix (after the > > patches I have to fix the FP generation in the first place: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/log/?h=x86/wip > > Right now, ftrace has a special hook in the ORC unwinder > (orc_ftrace_find). It would be great if we could get rid of that in > favor of the "always use frame pointers" approach. I'll hold off on > doing the kpatch/kprobe trampoline conversions in my patches since it > would conflict with yours. > > Though, hm, because of pt_regs I guess ORC would need to be able to > decode an encoded frame pointer? I was hoping we could leave those > encoded frame pointers behind in CONFIG_FRAME_POINTER-land forever... Ah, I see.. could a similar approach work for the kprobe trampolines perhaps? > Here are my latest BPF unwinder patches in case anybody wants a sneak > peek: > > https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=bpf-orc-fix On a quick read-through, that looks good to me. A minor nit: /* mov dst_reg, %r11 */ EMIT_mov(dst_reg, AUX_REG); The disparity between %r11 and AUX_REG is jarring. I understand the whole bpf register mapping thing, but it is just weird when reading this. Other than that, the same note as before, the 32bit JIT still seems buggered, but I'm not sure you (or anybody else) cares enough about that to fix it though. It seems to use ebp as its own frame pointer, which completely defeats an unwinder.