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=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 7DC26C433E0 for ; Sun, 5 Jul 2020 05:07:51 +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 42327207CD for ; Sun, 5 Jul 2020 05:07:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RQ7HBkEZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tX4VUWRY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42327207CD 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=N3nJWeC2TckvIZ2Bk+7cyJliaZZXc6JWf9qJMqcAGtg=; b=RQ7HBkEZGBRg6yv0j4QePGP4j GNRNDR5cbxMfWhlsCNanrxi+Ai3c9panBhq7UwuwnjC0mj8by001+hoaUvFfR56CXilf74v3H1Guy O4KWwc7IeP5rHtme4WVlmyZa1zyR6232me6kaACWxJHqwSL+/GurDJcxvw5BaLHdmgUceqaoieZ1l Kz2yVIQW2q8dCTqEPePKMh8MoMTmsPu/npCOe7Fx5bvaG9HVeo/KY1YHrZNyBR+Tm6h7x6I0AoldH TwCxppzL7+D4knb17iUzaEmxmZoQAeGjts1DFt88Gtv9b2ku0n6E661IWv4qjZfuhnV8P5RlPkLnL tgIckyKSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrwqV-0002Aw-JU; Sun, 05 Jul 2020 05:05:43 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrwqS-0002A1-Ae for linux-arm-kernel@lists.infradead.org; Sun, 05 Jul 2020 05:05:41 +0000 Received: by mail-pl1-x644.google.com with SMTP id d10so14073631pls.5 for ; Sat, 04 Jul 2020 22:05:37 -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=xgO5po79eWxovFEEuw7kMLwjskBHCz/x+ddLprK8PdM=; b=tX4VUWRYvoHdrCVERbPNHdPtP+VsHJGj8hyfoSXniwb2cgVmcWux/0VAeBFvPvnDlC b+dsGXhmSg/KLkbU95L8fHN88HqT28KNPz633bxJfrWRPI55+rDjTlFYyoeod7v8rAup iMPwDxXgdI+fHhLBHufi/DsNk6rrOz6CQf3i5BCIxetHed9MX1MJJwGeEEJbVuoW+Tai 5f7/oc/n/D/48uOd08Ov0ZN2gNdWlmkxOamo7I0Fycd07ZWxWjp7knw+52CSo3zKwQmC GJBrciJOuzIyafBCVQbOOlEeJ6mS4eBewIJF59TodNm5cGgLYBqjx0uN9eKKuVDQEJSp Ax9Q== 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=xgO5po79eWxovFEEuw7kMLwjskBHCz/x+ddLprK8PdM=; b=q/mx87U9uq+ZFdyl+p73o7uL0kW/9Ih/ffpXQB1G28vFeMIcgGQffrlXsaT4fB4Ka0 WfO5wE942l9AGODrbiStJNzgY24gTCo1cqYQoAZnd13roFs9Ob1pDI1Yr90LArky7TXy reSvX9PoyAmRKQehWfduT0iEuUJFTodytapC3TMGFF5rslJfAU+tzqLITdkeGFk/nYt3 8d7g868dV39874iPw1WTC/UtL5me0cTYR/b3wXQL+SHjGaJdEKySXsOiW/CdU7LqyylR I1YdIK7i6Brw4NJjO5eY7px/q7JRY4VLZxBijnA9q2+1orjFxw5ri4Y9MAA/X/b/ugL7 uZ3Q== X-Gm-Message-State: AOAM533RS5Ce61jg0ValuGdLsPNGw2yC+evErSR3TNekLVhlAIXSxa/H D1bD3atiAohns68KejOxGx0Rpw== X-Google-Smtp-Source: ABdhPJwiAXDyeCtORifUigLyfsFxra2XSOawq6pEQMfSZebGAuT/NyTKhNFeJ6zm6pBTtXhlmy57nQ== X-Received: by 2002:a17:90a:ff03:: with SMTP id ce3mr48875619pjb.174.1593925535924; Sat, 04 Jul 2020 22:05:35 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id h6sm15868276pfg.25.2020.07.04.22.05.29 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Jul 2020 22:05:35 -0700 (PDT) Date: Sun, 5 Jul 2020 13:05:27 +0800 From: Leo Yan To: Wei Li Subject: Re: [PATCH 1/2] perf tools: ARM SPE code cleanup Message-ID: <20200705050527.GA14142@leoy-ThinkPad-X240s> References: <20200623123141.27747-1-liwei391@huawei.com> <20200623123141.27747-2-liwei391@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200623123141.27747-2-liwei391@huawei.com> 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-20200705_010540_638900_22F0BCE5 X-CRM114-Status: GOOD ( 21.61 ) 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 , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , James Clark , Namhyung Kim , Jiri Olsa , 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 Wei, On Tue, Jun 23, 2020 at 08:31:40PM +0800, Wei Li wrote: > Remove the useless check code to make it clear. > > Signed-off-by: Wei Li > --- > tools/perf/arch/arm/util/auxtrace.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c > index 0a6e75b8777a..62b7b03d691a 100644 > --- a/tools/perf/arch/arm/util/auxtrace.c > +++ b/tools/perf/arch/arm/util/auxtrace.c > @@ -57,7 +57,7 @@ struct auxtrace_record > struct evsel *evsel; > bool found_etm = false; > bool found_spe = false; > - static struct perf_pmu **arm_spe_pmus = NULL; > + static struct perf_pmu **arm_spe_pmus; Here the 'static' should be removed as well. Just for more complete background info, IIUC, at the beginning to enable SPE's PMU event, since SPE is micro-architecture dependent (though it's defined in ARMv8-ARM, but it might be different for different ARM micro-architectures). So this is why here it uses 'static' for varaible "arm_spe_pmus", it wants to initialize the variable with finding all SPE PMU structure at the first time when invoke the function auxtrace_record__init(), and afterwards we can reuse the variable "arm_spe_pmus" and without calling find_all_arm_spe_pmus() anymore. So I struggled to figure out what's good thing to do with multiple SPE PMU events, and your change is good thing to me. The reason is: - 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 after removing 'static' for varaible "arm_spe_pmus": Reviewed-by: Leo Yan P.s. Sorry if it's my reason that James Clark's patch [1] has not been merged in the mainline kernel and introduced duplicate efforts at here. James's patch used similiar method to resolve this same issue. [1] https://lkml.org/lkml/2019/12/20/293 > static int nr_spes = 0; > int i = 0; > > @@ -65,9 +65,7 @@ struct auxtrace_record > 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 && > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel