Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750932AbbGBJbl (ORCPT ); Thu, 2 Jul 2015 05:31:41 -0400 Received: from casper.infradead.org ([85.118.1.10]:44838 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751675AbbGBJbb (ORCPT ); Thu, 2 Jul 2015 05:31:31 -0400 Date: Thu, 2 Jul 2015 11:31:20 +0200 From: Peter Zijlstra To: Alexei Starovoitov Cc: "Wangnan (F)" , He Kuang , rostedt@goodmis.org, masami.hiramatsu.pt@hitachi.com, mingo@redhat.com, acme@redhat.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, pi3orama Subject: Re: [RFC PATCH 0/5] Make eBPF programs output data to perf event Message-ID: <20150702093120.GK25159@twins.programming.kicks-ass.net> References: <1435719455-91155-1-git-send-email-hekuang@huawei.com> <20150701054458.GN19282@twins.programming.kicks-ass.net> <559386D7.1020208@huawei.com> <20150701115825.GV19282@twins.programming.kicks-ass.net> <5594A679.7010108@plumgrid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5594A679.7010108@plumgrid.com> 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: 1208 Lines: 30 On Wed, Jul 01, 2015 at 07:48:25PM -0700, Alexei Starovoitov wrote: > On 7/1/15 4:58 AM, Peter Zijlstra wrote: > > > >But why create a separate trace buffer, it should go into the regular > >perf buffer. > > +1 > > I think > +static char __percpu *perf_extra_trace_buf[PERF_NR_CONTEXTS]; > is redundant. > It adds quite a bit of unnecessary complexity to the whole patch set. Ah, that is what he does. I through he was creating a trace buffer, as in the stuff ftrace uses, to output stuff concurrently to the regular perf buffer, which would be insane ;-) So you need these temporary buffers if you cannot tell a-priory how much data is going to get written. The perf buffer can only deal with fixed size events, you request a buffer of @size, you write into it, you commit. So if there's variable sized data, you first need to generate it in order to tell how long it is, so that you can reserve your record and copy it in. Sucks, but that's the way it is. -- 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/