From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754513AbdKAPEo (ORCPT ); Wed, 1 Nov 2017 11:04:44 -0400 Received: from mga05.intel.com ([192.55.52.43]:9689 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752395AbdKAPEn (ORCPT ); Wed, 1 Nov 2017 11:04:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,329,1505804400"; d="scan'208";a="1212865286" From: "Liang, Kan" To: "Wangnan (F)" , "linux-kernel@vger.kernel.org" , "acme@kernel.org" , "jolsa@redhat.com" , "namhyung@kernel.org" Subject: RE: [PATCH 2/2] perf record: Replace 'overwrite' by 'flightrecorder' for better naming Thread-Topic: [PATCH 2/2] perf record: Replace 'overwrite' by 'flightrecorder' for better naming Thread-Index: AQHTUtXjmvz/TzQAiEGw/aBsqZxELKL/ejLw//+O7QCAAIbtsP//g/YAgACIFlA= Date: Wed, 1 Nov 2017 15:04:40 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077537DC2F2@SHSMSX103.ccr.corp.intel.com> References: <20171101055327.141281-1-wangnan0@huawei.com> <20171101055327.141281-3-wangnan0@huawei.com> <37D7C6CF3E00A74B8858931C1DB2F077537DC1C0@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F077537DC27E@SHSMSX103.ccr.corp.intel.com> <24733178-7c63-2841-13e7-d4c68ae7efe2@huawei.com> In-Reply-To: <24733178-7c63-2841-13e7-d4c68ae7efe2@huawei.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODBmNmQzNGEtOGU4OC00ZWNkLWFjMDktYjBhM2I1ZTRhMGU0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InlROWJKM29XcjhmZ0lLMzM4TjVudG5XQm00TEV5UlwvZkx5Ym9rSGFJYitJPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vA1F53Nj007490 > On 2017/11/1 22:22, Liang, Kan wrote: > >> On 2017/11/1 21:26, Liang, Kan wrote: > >>>> The meaning of perf record's "overwrite" option and many "overwrite" > >>>> in source code are not clear. In perf's code, the 'overwrite' has 2 > meanings: > >>>> 1. Make ringbuffer readonly (perf_evlist__mmap_ex's argument). > >>>> 2. Set evsel's "backward" attribute (in apply_config_terms). > >>>> > >>>> perf record doesn't use meaning 1 at all, but have a overwrite > >>>> option, its real meaning is setting backward. > >>>> > >>> I don't understand here. > >>> 'overwrite' has 2 meanings. perf record only support 1. > >>> It should be a bug, and need to be fixed. > >> Not a bug, but ambiguous. > >> > >> Perf record doesn't need overwrite main channel (we have two channels: > >> evlist->mmap is main channel and evlist->backward_mmap is backward > >> evlist->channel), > >> but some testcases require it, and your new patchset may require it. > >> 'perf record --overwrite' doesn't set main channel overwrite. What it does > is > >> moving all evsels to backward channel, and we can move some evsels > back to > >> the main channel by /no-overwrite/ setting. This behavior is hard to > >> understand. > >> > > As my understanding, the 'main channel' should depends on what user sets. > > If --overwrite is applied, then evlist->backward_mmap should be the > > 'main channel'. evlist->overwrite should be set to true as well. > > Then it introduces a main channel switching mechanism, and we need > checking evlist->overwrite and another factor to determine which > one is the main channel. Make things more complex. We should check the evlist->overwrite. Now, all perf tools force evlist->overwrite = false. I think it doesn’t make sense. What is another factor? I don't think it will be too complex. In perf_evlist__mmap_ex, we just need to add a check. If (!overwrite) evlist->mmap = perf_evlist__alloc_mmap(evlist); else evlist->backward_mmap = perf_evlist__alloc_mmap(evlist); In perf_evlist__mmap_per_evsel, we already handle per-event overwrite. It just need to add some similar codes to handler per-event nonoverwrite. For other codes, they should already check evlist->mmap and evlist->backward_mmap. So they probably don't need to change. Thanks, Kan