Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5939779ybi; Wed, 12 Jun 2019 11:04:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwkgoFam4kPwlsnauiKNchfDCA7HlftyT6t7upw6hBQasVrAjpNmUBjondIptbP+KZHp7S X-Received: by 2002:a17:902:b115:: with SMTP id q21mr21452571plr.36.1560362646823; Wed, 12 Jun 2019 11:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362646; cv=none; d=google.com; s=arc-20160816; b=U1cg684vs/1llgMil3useLETbyCiEzKUvz9FxknKziygt6E5l4rEpBQhF3nYdTG9FJ KuI7oU5pv+wK41Ok/apWTWUAq5Z7fi2PXzcbAcjQ4cj/vjUrzsONb41UE5NbiWGWvtnT VvsFRl0YnSZ2tM8/CKUQCwl8R5rs6Gi3rnEcfldKng08iF5uFDjXRk/i96K76keAHTX3 QISeSg0cD78gS1sEiVqA9TzpgRhSrVJ9QDZeoOfAVgoepcOQAWcqM3VZlpv/1cC4CwZk gXlSgfYAib71OMILmHkjJQEUaUOL2mRNAgKnRnsNvh/rnhUrDjEwxqjWZ/LNyMCD4xvG lqDg== 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; bh=Y4509Dk9Z3A4SRZ9MzTZXGVcM6O23utVUfQevzFaUIc=; b=S/IsRcXDjAvmOsCSjrJBCTfgp0Ca1akim06yNZbhLjOjsOkdmAF2HKDqyrHV+EQHbB RSM4UFYne3arWQl2pj3ey3w1x89VvEjRotfEMiILQAGZ7oAhHvY3e5buTJ9Oj/mhr6vb lo4YN+jpJT0gbTaDqKbQcVQTCRnQUr1TprpgKj+rTf52itioCJaH/jS6bKIPC830PLnO oOQW3PU6DEm4dsfQJnd3EIcklfcYVUVmeeGzaNjn7jpL3Gja8qCPmMO1W4lomhVAebOR lnEPtquC0NB3/Z/4Ax7PdYu8C5M/AZmP8UIJ+QH3g3wd13IJ37HFIlUHRPNYO+C7feuC Pmvw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si404833pgi.341.2019.06.12.11.03.52; Wed, 12 Jun 2019 11:04:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408938AbfFLOuN (ORCPT + 99 others); Wed, 12 Jun 2019 10:50:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51864 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408884AbfFLOuN (ORCPT ); Wed, 12 Jun 2019 10:50:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABC6D3B714; Wed, 12 Jun 2019 14:50:12 +0000 (UTC) Received: from treble (ovpn-120-37.rdu2.redhat.com [10.10.120.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69C2B46E70; Wed, 12 Jun 2019 14:50:11 +0000 (UTC) Date: Wed, 12 Jun 2019 09:50:08 -0500 From: Josh Poimboeuf To: Peter Zijlstra 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: <20190612145008.3l5iguuwk2termi4@treble> References: <20190522174517.pbdopvookggen3d7@treble> <20190522234635.a47bettklcf5gt7c@treble> <20190523133253.tad6ywzzexks6hrp@treble> <20190523152413.m2pbnamihu3s2c5s@treble> <20190524085319.GE2589@hirez.programming.kicks-ass.net> <20190612030501.7tbsjy353g7l74ej@treble> <20190612085423.GE3436@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190612085423.GE3436@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 12 Jun 2019 14:50:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 10:54:23AM +0200, Peter Zijlstra wrote: > 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? If you mean requiring that kprobes trampolines always use frame pointers, I think it should work. > > 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. True, but there are several cases where the r11 is hard-coded in the instruction encoding itself, like: /* mov imm32, %r11 */ EMIT3_off32(0x49, 0xC7, 0xC3, imm32); If the code were more decoupled, like if it had helpers where you could always just pass AUX_REG, and the code never had to know what the value of AUX_REG is, then using "AUX_REG" in the comments would make sense. But since there are inconsistencies, with hard-coded register mapping knowledge in many places, I find it easier to follow what's going on when the specific register name is always shown in the comments. > 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. I'm still trying to decide if I care about 32-bit. It does indeed use ebp everywhere. But I'm not sure if I want to poke the beehive... Also factoring into the equation is the fact that I'll be on PTO next week :-) If I have time in the next couple days then I may take a look. -- Josh