From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21D3CC433EB for ; Tue, 28 Jul 2020 12:40:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E783820714 for ; Tue, 28 Jul 2020 12:40:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uVlueaS6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VcNG+Fd3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E783820714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ih8GT40DBMjT9laXgq03EKpAQVUAoQf+Rjv/k27uIT0=; b=uVlueaS63PleNOIqRkGeLw2pm AT/gCw3nauEf4QQ6ubjCB2Aof9FiE38OlV6VKwSomQmN9h8WNh8KTA/mD6fhfNmiKjE+6o7QipLnh Kt5ra2YHlYBgwW8SN84yP2GwcgNwf3ppICfPMbv3yicDseI1Olaf8JoXaJEVFatHlKced1M+OQKLC NpswsbFmmEfE55XzyhL0A5iuTEd7CY5gFxYKl2tsAFG7iy0tSCMoagLddRlsTlScehmxYAQeXOW6K XksmRs6MoxdhUTsYxGDeGab9PUGuQzmaW5yrprVvEgtiaeY6dg6t0TDJbL0JoqXIdv527PqrKzujD 63b+obeyQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0Osl-0005HS-Um; Tue, 28 Jul 2020 12:38:59 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0Osh-0005DQ-Jw for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2020 12:38:57 +0000 Received: by mail-pl1-x641.google.com with SMTP id m16so9831149pls.5 for ; Tue, 28 Jul 2020 05:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4g7iTxi0pQvK+1PDjldeUqyZ+gKf3NktQDHtumchvKQ=; b=VcNG+Fd3VoebKC5oQn3y3iz+BcvT+E2SZOs/g9qfOdqjCaGQTu0lvXrlDi9ibw9rck iKh5+3D05iRYoKukzR7O8KaNFC49Ms+ZEgqfDgBF1KYwvdcK+fZ+m6bnPz9rYtOBECS1 XHIwR0omC8k7yjGSKLwn1MjA65gsFM0EAAs2xEyTFLx9Uo2YpyuFowC8QePmvHgqV7Bx 5wdFKqJauWyyisfnJdwUBv8GnCBT+spyj3IF0EflkTGBz/2AK+fpxVnuktuZfDpmCEkk +szzDbsb/qgd/y/W0JliNNbOAmnjjD5LLRjXLXmhBtrOp6piLkrpzDwMHxjEfY0OFvDW LTbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4g7iTxi0pQvK+1PDjldeUqyZ+gKf3NktQDHtumchvKQ=; b=TwEMyurXWEORsEqnnig4HNz2rICrrDUZux0nWsAkskdl96L0tTjeChPk8Dz4MkWtfS 8FQXoHSifNXsc+xKOEXFloXjqBamtK/OlGCG3dhCVgzjfnu//cdbjtB438nR0nFUzc/z yBPjWlR8Hfx7LCbn2R1c4s/JKufOQ6QQ+PWi1JkjA540Z4BWcf7Dh10zswWZGPMA9VkI mhWk8qN7FXDqtHHDD0HuUDPqDm2++s7I9yBrIgCyMpQR60lljcwOrovi9CiVz04Qrfgr efaEnv4Se1coYyQKXxVkr0YUDuirqof0JWM0a+/PWqJxlmWE1RZkNsmsPSITxNKBirdH A74w== X-Gm-Message-State: AOAM533Lre1qJiu9b85CwNWSP/YtToxeRui4U3pI2I8R/AxK+Ahf0N1k FLgxKHSQ7g24BQi6s0+uWFldag== X-Google-Smtp-Source: ABdhPJxBZLWz+mrfdp81OQw/iibH/lD1K3X9d0oGtG1OIvJ9Veil+ItGUILGfvZeKbL2PBdWjw3sgg== X-Received: by 2002:a17:902:6b45:: with SMTP id g5mr23335947plt.42.1595939933649; Tue, 28 Jul 2020 05:38:53 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id x9sm20731774pfq.216.2020.07.28.05.38.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Jul 2020 05:38:52 -0700 (PDT) Date: Tue, 28 Jul 2020 20:38:46 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Subject: Re: [PATCH v2 2/2] perf tools: ARM SPE code cleanup Message-ID: <20200728123846.GC4343@leoy-ThinkPad-X240s> References: <20200724071111.35593-1-liwei391@huawei.com> <20200724071111.35593-3-liwei391@huawei.com> <20200727203436.GC2381376@xps15> <20200728120220.GA40195@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200728120220.GA40195@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200728_083856_016152_279B77B8 X-CRM114-Status: GOOD ( 39.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kim Phillips , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Jiri Olsa , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , guohanjun@huawei.com, Namhyung Kim , Wei Li , linux-arm-kernel@lists.infradead.org, Mike Leach Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Arnaldo, On Tue, Jul 28, 2020 at 09:02:20AM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Jul 27, 2020 at 02:34:36PM -0600, Mathieu Poirier escreveu: > > On Fri, Jul 24, 2020 at 03:11:11PM +0800, Wei Li wrote: > > > - Firstly, the function auxtrace_record__init() will be invoked only > > > once, the variable "arm_spe_pmus" will not be used afterwards, thus > > > we don't need to check "arm_spe_pmus" is NULL or not; > > > - Another reason is, even though SPE is micro-architecture dependent, > > > but so far it only supports "statistical-profiling-extension-v1" and > > > we have no chance to use multiple SPE's PMU events in Perf command. > > > > I find the above changelog somewhat out of touch with the patch itself. The > > only thing that is happening here is the removal of a useless check and a fix > > for a memory leak. > > Humm, I think the original intent of that code was to cache the results > of find_all_arm_spe_pmus(), as the variable it is assigned to is static. > > So not a leak, as there was that static reference to it to reuse it > later, but that is strange in a function named "__init()" which usually > is called only once, anyway, so I think that the paragraph with > "Firstly" is kinda ok, but confusing, I think it should read: > > - auxtrace_record__init() is called only once, so there is no point in > using a static variable to cache the results of > find_all_arm_spe_pmus(), make it local and free the results after use. > > The second paragraph is SPE specific, so I'm not qualified to judge on > it. > > I'm replacing the first paragraph with the version I wrote and keep it > in my local branch, please holler if you think I misunderstood. Thanks a lot for this. These two paragraphs were coming from reviewing and comments, but I think your rephrasing is very sufficient to describe what this patch is doing :) Thanks, Leo > > Once again whether Arnaldo wants to make the changes by hand or not you may have > > to resubmit. > > > > Reviewed-by: Mathieu Poirier > > > > > > > > So remove the useless check code to make it clear. > > > > > > Signed-off-by: Wei Li > > > --- > > > tools/perf/arch/arm/util/auxtrace.c | 9 ++++----- > > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > > > diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c > > > index 28a5d0c18b1d..b187bddbd01a 100644 > > > --- a/tools/perf/arch/arm/util/auxtrace.c > > > +++ b/tools/perf/arch/arm/util/auxtrace.c > > > @@ -57,17 +57,15 @@ struct auxtrace_record > > > struct evsel *evsel; > > > bool found_etm = false; > > > struct perf_pmu *found_spe = NULL; > > > - static struct perf_pmu **arm_spe_pmus = NULL; > > > - static int nr_spes = 0; > > > + struct perf_pmu **arm_spe_pmus = NULL; > > > + int nr_spes = 0; > > > int i = 0; > > > > > > if (!evlist) > > > return NULL; > > > > > > cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME); > > > - > > > - if (!arm_spe_pmus) > > > - arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err); > > > + arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err); > > > > > > evlist__for_each_entry(evlist, evsel) { > > > if (cs_etm_pmu && > > > @@ -84,6 +82,7 @@ struct auxtrace_record > > > } > > > } > > > } > > > + free(arm_spe_pmus); > > > > > > if (found_etm && found_spe) { > > > pr_err("Concurrent ARM Coresight ETM and SPE operation not currently supported\n"); > > > -- > > > 2.17.1 > > > > > -- > > - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel