From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757859AbdJMNNQ (ORCPT ); Fri, 13 Oct 2017 09:13:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:36150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbdJMNNP (ORCPT ); Fri, 13 Oct 2017 09:13:15 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C99AD21874 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Date: Fri, 13 Oct 2017 10:13:12 -0300 From: Arnaldo Carvalho de Melo To: "Liang, Kan" Cc: "peterz@infradead.org" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "jolsa@kernel.org" , "wangnan0@huawei.com" , "hekuang@huawei.com" , "namhyung@kernel.org" , "alexander.shishkin@linux.intel.com" , "Hunter, Adrian" , "ak@linux.intel.com" Subject: Re: [PATCH 02/10] perf tool: fix: Don't discard prev in backward mode Message-ID: <20171013131312.GL3503@kernel.org> References: <1507656023-177125-1-git-send-email-kan.liang@intel.com> <1507656023-177125-3-git-send-email-kan.liang@intel.com> <20171010181405.GG28623@kernel.org> <37D7C6CF3E00A74B8858931C1DB2F077537D30D6@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F077537D30D6@SHSMSX103.ccr.corp.intel.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Oct 13, 2017 at 12:55:34PM +0000, Liang, Kan escreveu: > > Em Tue, Oct 10, 2017 at 10:20:15AM -0700, kan.liang@intel.com escreveu: > > > From: Kan Liang > > > > > > Perf record can switch output. The new output should only store the > > > data after switching. However, in overwrite backward mode, the new > > > output still have the data from old output. > > > > > > At the end of mmap_read, the position of processed ring buffer is > > > saved in md->prev. Next mmap_read should be end in md->prev. > > > However, the md->prev is discarded. So next mmap_read has to process > > > whole valid ring buffer, which definitely include the old processed > > > data. > > > > > > Set the prev as the end of the range in backward mode. > > > > Do you think this should go together with the rest of this patchkit? > > Probably it should be processed ASAP, i.e. perf/urgent, no? > > > > Hi Arnaldo, > > After some discussion, Wang Nan proposed a new patch to fix this issue. > https://lkml.org/lkml/2017/10/12/441 > I did some tests. It fixed the issue. Ok, I'll look at it and stick a "Tested-by: Kan", ok? - Arnaldo > Could you please take a look? > If it's OK for you, I think it could be merged separately. > > Thanks, > Kan > > > - Arnaldo > > > > > Signed-off-by: Kan Liang > > > --- > > > tools/perf/util/evlist.c | 14 +++++++++++++- > > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index > > > 33b8837..7d23cf5 100644 > > > --- a/tools/perf/util/evlist.c > > > +++ b/tools/perf/util/evlist.c > > > @@ -742,13 +742,25 @@ static int > > > rb_find_range(void *data, int mask, u64 head, u64 old, > > > u64 *start, u64 *end, bool backward) { > > > + int ret; > > > + > > > if (!backward) { > > > *start = old; > > > *end = head; > > > return 0; > > > } > > > > > > - return backward_rb_find_range(data, mask, head, start, end); > > > + ret = backward_rb_find_range(data, mask, head, start, end); > > > + > > > + /* > > > + * The start and end from backward_rb_find_range is the range for > > all > > > + * valid data in ring buffer. > > > + * However, part of the data is processed previously. > > > + * Reset the end to drop the processed data > > > + */ > > > + *end = old; > > > + > > > + return ret; > > > } > > > > > > /* > > > -- > > > 2.5.5