Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754747AbZINDIF (ORCPT ); Sun, 13 Sep 2009 23:08:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752798AbZINDIE (ORCPT ); Sun, 13 Sep 2009 23:08:04 -0400 Received: from fg-out-1718.google.com ([72.14.220.158]:21900 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752443AbZINDIC (ORCPT ); Sun, 13 Sep 2009 23:08:02 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=MiLM5+sbIHYTsaZtbuR8Lqpz3i0DIXjE+l3T90shlEtI++YLl246aM+8BaRY5CgDNE rkrck/8OvDtVN75yyRGXmYLCIHomeajWPgTkKN/RMwaMviMHKgotTVUO6MW57G6LrC/K 7lFCFWHnXZoPz69Jx8nbuxf67V7WOXdr6Gf90= Date: Mon, 14 Sep 2009 05:08:02 +0200 From: Frederic Weisbecker To: Masami Hiramatsu Cc: Steven Rostedt , Ingo Molnar , lkml , systemtap , DLE , Jim Keniston , Ananth N Mavinakayanahalli , Andi Kleen , Christoph Hellwig , "Frank Ch. Eigler" , "H. Peter Anvin" , Jason Baron , "K.Prasad" , Lai Jiangshan , Li Zefan , Peter Zijlstra , Srikar Dronamraju , Tom Zanussi Subject: Re: [PATCH tracing/kprobes 4/7] tracing/kprobes: Add event profiling support Message-ID: <20090914030802.GD14306@nowhere> References: <20090910235258.22412.29317.stgit@dhcp-100-2-132.bos.redhat.com> <20090910235329.22412.94731.stgit@dhcp-100-2-132.bos.redhat.com> <20090911031253.GD16396@nowhere> <4AAAA550.9010203@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AAAA550.9010203@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1900 Lines: 67 On Fri, Sep 11, 2009 at 03:30:24PM -0400, Masami Hiramatsu wrote: >> Note that the end-result must be u64 aligned for perf ring buffer. >> And this is a bit tricky. >> What is inserted in the perf ring buffer is: >> >> raw_trace + (u32)raw_trace_size >> >> So we must ensure that sizeof(raw_trace) + sizeof(u32) >> is well u64 aligned. >> >> We don't insert the trace_size ourself though, this is done >> from kernel/perf_counter.c >> >> But we need to handle the size of the size (sorry) in the final >> alignment. >> To sum-up: sizeof(raw_trace) doesn't need (shouldn't) to be u64 >> aligned but sizeof(raw_trace) + sizeof(u32) must be. >> >> Given this aligned size, we then substract it by sizeof(u32) >> to have the needed size of the raw entry. >> >> This result gives you the size of char raw_data[], which >> is also the same size passed in perf_tpcounter_event(). >> >> See? > > Ah, I see. So the size to write to perf_tpcounter_event must be > '(a multiple number of sizeof(u64)) - sizeof(u32)', right? Exactly. To simplify I guess the raw events just needs to be u32 aligned :) > (Hmm, why would not perf_counter align data by itself? :) Because that would require it to copy the data into a seperate u64 aligned buffer. >> >> That's why we have this in trace/ftrace.h: >> >> __data_size = "the real entry data size" >> __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32), sizeof(u64)); >> __entry_size -= sizeof(u32); >> >> do { >> char raw_data[__entry_size]; >> ... >> perf_tpcounter_event(event_call->id, __addr, __count, entry, >> __entry_size); >> ... >> } while (0); > > Ok, I'll do that. Thanks! -- 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/