Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1955091ybh; Fri, 24 Jul 2020 00:14:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFShgpgOeLzVs7BPkPFfDpJU5d98ebgZtEHLT0e21Nas6GUt7H1KEvQYcRk5WnD0J1yz9E X-Received: by 2002:a17:906:f88c:: with SMTP id lg12mr7098986ejb.179.1595574855860; Fri, 24 Jul 2020 00:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595574855; cv=none; d=google.com; s=arc-20160816; b=nyI48iAz54VMjrJeM5pbZu8rcYE1Egi0GrvvXmPjXHMIC/SIIifgVuV5ZtUK2l1Wtd ovU+d2q5+QT1rsoWEaECFO7XkXhh79DgAPr0D6+ukjP+q3aBTzfW3O09n0buHWzfNu9C xRcIPRU8WCVmzkdkcdzbV5llRyZ50hhXP759KaBTh8JkqzpPWZ5/xidLXFFM3jQP8sXk bCA/sUSkfAcx25hapbalz8ECedAK6hArGqKw3Ib+NMBLE7eZHEGwI8e70VVSEj3GuYGQ Ldvaq81Z+Str4GB2IeSdIwXU6jgCsS/Rx+zOi37FubhMfnIj0Pk/OECsE6BDL7D1rQu4 gVUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=kepaIhYnyfcBTU5sm8k78YUPYmEDcyYryQms0NLXuyE=; b=lnjKz4RIO1Uk9sNs30FWHZxCze4QEgybH/5xwFkZtI/DKYeJ5WvaYQX7ynlyTX+2od 9azcSxb+Bu6jODkwhoeaBR8oLxd6YSAl0mJtnqS8XxRwYXCII0wIghm65qFABbukoDDL jwWymSTlfHQqqu+KYzy9BnqKNem7JHH4VjV+nXJOhG+/sJahfewUZWC54bv6rpfo65wk xvokOTa+xourV3Z8sF91x0UAv7h1aFFEGsBAUy7g5KXrdMSS/Hk8g7p6XFYN7e7r224B UMxSQnNzH3kPndK/SWoAmXJeLCCvF/nBdMAoGmdJEKrRA0iuVnJmlcTtNMy910guUZiN CHHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg22si5596edb.25.2020.07.24.00.13.53; Fri, 24 Jul 2020 00:14:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbgGXHNX (ORCPT + 99 others); Fri, 24 Jul 2020 03:13:23 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:53960 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726554AbgGXHNW (ORCPT ); Fri, 24 Jul 2020 03:13:22 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3E2D676F3B3753092A76; Fri, 24 Jul 2020 15:13:19 +0800 (CST) Received: from euler.huawei.com (10.175.124.27) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Fri, 24 Jul 2020 15:13:12 +0800 From: Wei Li To: , Mathieu Poirier , "Suzuki K Poulose" , Mike Leach , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , "Namhyung Kim" , Kim Phillips CC: , , Peter Zijlstra , Ingo Molnar , Subject: [PATCH v2 2/2] perf tools: ARM SPE code cleanup Date: Fri, 24 Jul 2020 15:11:11 +0800 Message-ID: <20200724071111.35593-3-liwei391@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200724071111.35593-1-liwei391@huawei.com> References: <20200724071111.35593-1-liwei391@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - 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. 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