From patchwork Wed Mar 21 02:37:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: William Cohen X-Patchwork-Id: 10298417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA8DC602B3 for ; Wed, 21 Mar 2018 02:39:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9958528B94 for ; Wed, 21 Mar 2018 02:39:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DF8128BC9; Wed, 21 Mar 2018 02:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0ADED28B94 for ; Wed, 21 Mar 2018 02:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cYU4SOuaRT0opq7UOytwHvJ00L06bZylYt7i6YqsGbY=; b=s0r2fUa4p1ELfuciX/r+G+4VW Fl3cqGJWaHnXvN9IjzffoM9vojktpSlhZB/Sr0AyIZkCSpdtA/H2oDp7yuE3hIaH6QhiEBARev626 m0B7Qf8pYy+S7izQ5OvB7NCU28a5+tHxD2Ig2oY2pG9KRABU5dJmPi+KxxvHLI5Rh5DdXkkjmm7Bm mVyz9i3+YN+cfRFeot+O7SgEzaKWHe8DeQ/fzht0NXFkdx1SN845fQbjGCsAecIpXRThaQ0E+4UCZ fYBpvTYCb1zFEsE8THp9wT4Yee3GF5doM+lJFsCW+kHGSVZ4bsTUvQE1A8PUr0hDJpcNWjkgvburX 5NRdXoGrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyTeR-0004Xm-2P; Wed, 21 Mar 2018 02:38:55 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyTds-0004FF-Mf for linux-arm-kernel@bombadil.infradead.org; Wed, 21 Mar 2018 02:38:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:In-Reply-To:MIME-Version: Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1oeOFDZMJEfWZR2kx9h1tpK8Eb2x646JVx2vMgbzzpk=; b=lxoxWnYxiQT4v+TR57voP8VDu 6MEpVYc3q8iIuR41Far2ReINjbQCPqPzDjqz9OPNAnbVUt8+4p30g+gqPt6lepGF0RMTKi5NXmauk 0XGkCCUhFa3clLhr+FRSsUT88rbkGRRIJOP5XLQqlSvtqAto8dujRRZ0ZK7tQUSD/ZN7rRmJbZgpI W0+HUQ15Rnt6XSAyrIYjaMrjtgASJCZaY4jkNun83Fdfm46TY2HX2kV1uAFtm/EfsDapM7Ky2DU3D q+z0cjyKQR6H8GX8+IEdQ6RFNttUPbx3HjhlRXfxVI1bqrb7vECsyNGdJYUrxoxDD7vrUf/uO0vvJ dqm5ZF/iw==; Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyTdp-0001jI-GF for linux-arm-kernel@lists.infradead.org; Wed, 21 Mar 2018 02:38:19 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35C1FEBFE9; Wed, 21 Mar 2018 02:37:52 +0000 (UTC) Received: from [10.10.120.234] (ovpn-120-234.rdu2.redhat.com [10.10.120.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E2902166BDA; Wed, 21 Mar 2018 02:37:51 +0000 (UTC) Subject: Re: [PATCH] perf vendor events arm64: Enable JSON events for ThunderX2 B0 To: John Garry , Ganapatrao Kulkarni References: <20180307110803.32418-1-ganapatrao.kulkarni@cavium.com> <3384d33f-c927-740a-97f1-b20775ef2c7b@redhat.com> <20180307143832.GJ3701@kernel.org> <52328144-3a2a-af03-273b-3a2f3bdadda6@redhat.com> <2a84ec0e-dc8c-7e2e-64e5-4ea48ba6da49@redhat.com> <5b918449-b7b1-dbe1-e6e2-46486116dc65@huawei.com> From: William Cohen Message-ID: <6bfce413-0fb8-e89c-7400-0704f29f236e@redhat.com> Date: Tue, 20 Mar 2018 22:37:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <5b918449-b7b1-dbe1-e6e2-46486116dc65@huawei.com> Content-Language: en-MW X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 02:37:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 02:37:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'wcohen@redhat.com' RCPT:'' X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180321_023817_707496_8FC69E54 X-CRM114-Status: GOOD ( 38.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Alexander Shishkin , Will Deacon , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Peter Zijlstra , Robert Richter , Ingo Molnar , jnair@caviumnetworks.com, Ganapatrao Kulkarni , Jiri Olsa , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 03/15/2018 12:47 PM, John Garry wrote: > On 15/03/2018 15:53, William Cohen wrote: >> On 03/07/2018 11:14 PM, Ganapatrao Kulkarni wrote: >>> On Thu, Mar 8, 2018 at 12:01 AM, William Cohen wrote: >>>> On 03/07/2018 12:35 PM, Ganapatrao Kulkarni wrote: >>>>> Hi Will Cohen, >>>>> >>>>> On Wed, Mar 7, 2018 at 8:08 PM, Arnaldo Carvalho de Melo >>>>> wrote: >>>>>> Em Wed, Mar 07, 2018 at 09:32:05AM -0500, William Cohen escreveu: >>>>>>> On 03/07/2018 06:08 AM, Ganapatrao Kulkarni wrote: >>>>>>>> There is MIDR change on ThunderX2 B0, adding an entry to mapfile >>>>>>>> to enable JSON events for B0. >>>>>>>> >>>>>>>> Signed-off-by: Ganapatrao Kulkarni >>>>>> >>>>>> Ganapatrao, can you please take this in consideration and if agreeing >>>>>> send a v2 patch? >>>>>> >>>>>> With that I can add an Acked-by: wcohen, Right? >>>>>> >>>>>> - Arnaldo >>>>>>>> --- >>>>>>>>  tools/perf/pmu-events/arch/arm64/mapfile.csv | 1 + >>>>>>>>  1 file changed, 1 insertion(+) >>>>>>>> >>>>>>>> diff --git a/tools/perf/pmu-events/arch/arm64/mapfile.csv b/tools/perf/pmu-events/arch/arm64/mapfile.csv >>>>>>>> index e61c9ca..93c5d14 100644 >>>>>>>> --- a/tools/perf/pmu-events/arch/arm64/mapfile.csv >>>>>>>> +++ b/tools/perf/pmu-events/arch/arm64/mapfile.csv >>>>>>>> @@ -13,4 +13,5 @@ >>>>>>>>  # >>>>>>>>  #Family-model,Version,Filename,EventType >>>>>>>>  0x00000000420f5160,v1,cavium,core >>>>>>>> +0x00000000430f0af0,v1,cavium,core >>>>>>>>  0x00000000410fd03[[:xdigit:]],v1,cortex-a53,core >>>>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> Like the cortex-a53 the last digit '0' of the match for the MIDR should be replaced with [[:xdigit:]] to allow for possible future revisions of chip: >>>>> >>>>> for arm64 implementation,  bits 3:0(Revision) and bits 23:20(Variant) >>>>> are ignored/dont-care. >>>> >>>> Thanks for pointing that out.  See the code masking out those bits in linux/toos/perf/arch/util/header.c. For the ppc64 it just copies the equivalent of the MIDR including the revision bits. Thus, the need for regular expression matching to avoid having to create a new entry for each revision. >>> >>> It is same for arm64 too, there is no need to add an entry for every >>> revision change,  need to add when part number changes. >>> This patch is not intended to add entry for revision change, the fact >>> of the matter is that, there  is complete MIDR change (vulcan to >>> thunderx2) in B0. >>> as per current arm64 >>> implementation(.tools/perf/arch/arm64/util/header.c), it is not >>> required to have any dontcare marking in mapfile for revision/variant >>> bits. >>> >>> thanks >>> Ganapat >> >> Hi Ganapat, >> >> Would it make more sense to pass the MIDR value unmodified and then use regular expressions in mapfile.csv to match the values?  If an event on a particular processor revision is broken or unusable it can be excluded from the list of events with a corrected list of events.  There certainly have been errata listing events that do not work on specific revisions of armv8 processor implementations. >> > > Then there are vendors who do not always properly implemenent MIDR or IIDRs (people who live in glass houses...). > > Btw, topic originally discussed here: > https://lkml.org/lkml/2017/5/2/113 > > Thanks, > John > >> -Will Hi John, Attached is a patch that leaves the MIDR value unmodified and uses regular expressions in the mapfile.csv instead to ignore those bits. I have verified that the changes work on ARM Cortex a53 processor. Does it look reasonable? -Will Cohen From b407d0bb7077b23675185a3e9a78f24e775f4e50 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 20 Mar 2018 22:20:24 -0400 Subject: [PATCH] perf vendor events arm64: Use regular expressions for matching MIDR The arm64 MIDR includes bits that identifying the silicon revision and patch version of the processor. Previously the identification code would mask out those bits making it impossible to have the map file address any errata related to particular pmu events being unavailable for a specific patch level of the silicon. Using the available regular expression matching allows handling of these special cases. Signed-off-by: William Cohen --- tools/perf/arch/arm64/util/header.c | 7 ------- tools/perf/pmu-events/arch/arm64/mapfile.csv | 9 ++++----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tools/perf/arch/arm64/util/header.c b/tools/perf/arch/arm64/util/header.c index 534cd2507d83..05d1439c2cff 100644 --- a/tools/perf/arch/arm64/util/header.c +++ b/tools/perf/arch/arm64/util/header.c @@ -5,9 +5,6 @@ #define MIDR "/regs/identification/midr_el1" #define MIDR_SIZE 19 -#define MIDR_REVISION_MASK 0xf -#define MIDR_VARIANT_SHIFT 20 -#define MIDR_VARIANT_MASK (0xf << MIDR_VARIANT_SHIFT) char *get_cpuid_str(struct perf_pmu *pmu) { @@ -44,11 +41,7 @@ char *get_cpuid_str(struct perf_pmu *pmu) } fclose(file); - /* Ignore/clear Variant[23:20] and - * Revision[3:0] of MIDR - */ midr = strtoul(buf, NULL, 16); - midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK)); scnprintf(buf, MIDR_SIZE, "0x%016lx", midr); /* got midr break loop */ break; diff --git a/tools/perf/pmu-events/arch/arm64/mapfile.csv b/tools/perf/pmu-events/arch/arm64/mapfile.csv index f03e26ecb658..4b3403147819 100644 --- a/tools/perf/pmu-events/arch/arm64/mapfile.csv +++ b/tools/perf/pmu-events/arch/arm64/mapfile.csv @@ -3,7 +3,6 @@ # # where # MIDR Processor version -# Variant[23:20] and Revision [3:0] should be zero. # Version could be used to track version of of JSON file # but currently unused. # JSON/file/pathname is the path to JSON file, relative @@ -12,7 +11,7 @@ # # #Family-model,Version,Filename,EventType -0x00000000410fd03[[:xdigit:]],v1,arm/cortex-a53,core -0x00000000420f5160,v1,cavium/thunderx2,core -0x00000000430f0af0,v1,cavium/thunderx2,core -0x00000000480fd010,v1,hisilicon/hip08,core +0x0000000041[[:xdigit:]]fd03[[:xdigit:]],v1,arm/cortex-a53,core +0x0000000042[[:xdigit:]]f516[[:xdigit:]],v1,cavium/thunderx2,core +0x0000000043[[:xdigit:]]f0af[[:xdigit:]],v1,cavium/thunderx2,core +0x0000000048[[:xdigit:]]fd01[[:xdigit:]],v1,hisilicon/hip08,core -- 2.14.3