Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbbBKJdV (ORCPT ); Wed, 11 Feb 2015 04:33:21 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:39729 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbbBKJdS (ORCPT ); Wed, 11 Feb 2015 04:33:18 -0500 Date: Wed, 11 Feb 2015 10:33:08 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Steven Rostedt , Ingo Molnar , Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , Linux API , Network Development , LKML , Linus Torvalds , "Eric W. Biederman" Subject: Re: [PATCH v3 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls Message-ID: <20150211093308.GN23123@twins.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1485 Lines: 34 On Tue, Feb 10, 2015 at 04:22:50PM -0800, Alexei Starovoitov wrote: > >> not all tools use libtraceevent. > >> gdb calls perf_event_open directly: > >> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/nat/linux-btrace.c > >> and parses PERF_RECORD_SAMPLE as a binary. > >> In this case it's branch records, but I think we never said anywhere > >> that PERF_SAMPLE_IP | PERF_SAMPLE_ADDR should come > >> in this particular order. > > > > What particular order? Note, that's a hardware event, not a software > > one. > > yes, but gdb assumes that 'u64 ip' precedes, 'u64 addr' > when attr.sample_type = IP | ADDR whereas this is an > internal order of 'if' statements inside perf_output_sample()... This is indeed promised in the data layout description in include/uapi/linux/perf_event.h. There is no other way to find where fields are; perf relies on predetermined order of fields coupled with the requested field bitmask. So we promise the order: id, ip, pid, tid, time, addr,.. etc. So if you request IP and ADDR but none of the other fields, then you know your sample will start with IP and then contain ADDR. The traceevent thing has a debug/trace-fs format description of fields that is supposed to be used. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/