Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759724AbbLCKdi (ORCPT ); Thu, 3 Dec 2015 05:33:38 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:46079 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759708AbbLCKdf (ORCPT ); Thu, 3 Dec 2015 05:33:35 -0500 Message-ID: <56601A15.506@huawei.com> Date: Thu, 3 Dec 2015 18:31:49 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Peter Zijlstra CC: , , , , , , Adrian Hunter , David Ahern , Ingo Molnar , Yunlong Song Subject: Re: [RFC PATCH] perf/core: Put size of a sample at the end of it References: <565EAAFD.3000103@huawei.com> <1449063499-236703-1-git-send-email-wangnan0@huawei.com> <20151203100801.GV3816@twins.programming.kicks-ass.net> In-Reply-To: <20151203100801.GV3816@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.56601A29.01AA,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7f723273302fc5abc39d7851f5fc6254 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2194 Lines: 59 On 2015/12/3 18:08, Peter Zijlstra wrote: > On Wed, Dec 02, 2015 at 01:38:19PM +0000, Wang Nan wrote: >> This sloution requires user program (perf) do more things. At least >> following things and limitations should be considered: >> >> 1. Before reading such ring buffer, perf must ensure all events which >> may output to it is already stopped, so the 'head' pointer it get >> is the end of the last record. > Right, this is tricky, this would not allow two snapshots to happen back > to back since that would then result in a bunch of missed events. > > Aside from this issue its a rather nice idea. Thank you for your attitude. We can start consider it seriously. Now I'm working on perf side code to make a workable prototype. >> 2. We must ensure all events attached this ring buffer has >> 'PERF_SAMPLE_SIZE' selected. > That can be easily enforced. Yes. >> 3. There must no tracking events output to this ring buffer. > That is rather unfortunate, we'd best fix that up. > >> 4. 2 bytes extra space is required for each record. > 8, perf records must be 8 byte aligned and sized. So does it means we need to pad before outputing size? >> Further improvement can be taken: >> >> 1. If PERF_SAMPLE_SIZE is selected, we can avoid outputting the event >> size in header. Which eliminate extra space cose; > That would mandate you always parse the stream backwards. Which seems > rather unfortunate. Also, no you cannot recoup the extra space, see the > alignment and size requirement. That's good. We don't need to consider this :) Before receiving your comment I'm thinking about modifying DEFINE_OUTPUT_COPY() to write first sizeof(header) bytes at the end of reserved area, so it would work automatically for every possible events. >> 2. We can find a way to append size information for tracking events >> also. > The !sample records you mean? Yes those had better have them too. Thank you. -- 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/