Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp532703pxb; Thu, 19 Nov 2020 07:29:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJznrlzVMZWQy5ulcN5ZB+WOO54vNRUd0rL63gGsXmdLOA0nGqZiMZAcogEEZAmr7UkGHGUg X-Received: by 2002:a50:ab15:: with SMTP id s21mr30891726edc.88.1605799788504; Thu, 19 Nov 2020 07:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605799788; cv=none; d=google.com; s=arc-20160816; b=c5tvSHK2d5G81sLug07UHa7+2bw1r09hh/cXhC4pSflWqGnxkTv+cW/TCF7gFPFGCO JHooao+Hc1eqT1qWEQaB580VnZI2Etr2pgmaJJQ/T+f/9GHZRUAdfKIxJakV3MzWCmCu mEZkkpiY4LLBaKnDa1v9/rEjzDNtAJs86SsM8BykOJjc1wl0Nukbdzs9eW9+7LboA+9q SiCDRv2Ud0/jHr/IPgiBHSj9fOW5IDhagh5+HIOzoLygJVcz3wOVYcHtwyQJdKqrTrCt PPi/JIxy1M0pZrC9elCBfsdu2rosKLRG4wNOvDP58N+MG8uw6hsf15qEu3CEc4UY5t8T 5/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=RNtEb68izJVAcV9f+qMY6oQBAbB/qZEtMrJUW/skAUU=; b=m6b6GLf/f7J7al0wfuuHJSGiNla96PUfY2eiDwNMImgiye9BXNxse5DX2eZ4tENbWO LVfoLP0AF8EcqbTFf8gXHPmQL/7tn3w3MO9/Syh34/20//or0XEaI+efcNuUriRZ4TU0 Y2HRSZy2oyMo7h4azXjiPtXwut5Yv2Ezzx56MY8Y6pcMxyKcTVLGu2JpzucTf6sW/ZTs U7jY2KQCDHC19/PQ1ViHNf72Tu7LDsPW8ZdGqTNQRoWgdQe1bVdzlB6gMSpYU435Ej0O ZUTCVo86EhxGEO6hQhLD7eGqH2e2H+44/CfftZ8PNascuHvCTGTV43uYi/2xcYOyY0d0 urbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qBCDcY6u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id om24si32047ejb.235.2020.11.19.07.29.25; Thu, 19 Nov 2020 07:29:48 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=qBCDcY6u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728633AbgKSPZm (ORCPT + 99 others); Thu, 19 Nov 2020 10:25:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbgKSPZj (ORCPT ); Thu, 19 Nov 2020 10:25:39 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF41C0613CF for ; Thu, 19 Nov 2020 07:25:39 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id 10so4820746pfp.5 for ; Thu, 19 Nov 2020 07:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RNtEb68izJVAcV9f+qMY6oQBAbB/qZEtMrJUW/skAUU=; b=qBCDcY6uYTiPqr2967myhbeYRI1KluGpbxUHw07NadjjGGFQ8HybJK8/S2Z/cd/dwI 22Mfj9f9FMC2Jj9aJEDrYFNcj6SZSZGX4PBEWDxM7wcfzIua3NJxKGHlk4iNJLAHWz+7 harPa9AC2B50O/rlarAqy1sBpcGg4EK360LajqLYa030e9lQHmAJr4H+oKde0xVTO+1O QpJhwjKPbo2EvVOKbTEBQeRc5nUpJP6HMx6EhOPcZelDRqJ2dk2P2YwsrtzRk4Us8giI AtG13ylh70AnyBhUPlUsNny03zqheEeuJJo26k2r00jtayymq0JGJNH/8GHSLTRiETWF eSZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RNtEb68izJVAcV9f+qMY6oQBAbB/qZEtMrJUW/skAUU=; b=MkZr0YLBIqxd1Vb7kNsitfHDL8rEygfBXHCMiXRAxXQTXDdByj6hjmt7Ia5TXsnwxs fnJd/gjZQJ5Tq0V1qbn2SfwmfzyPSPprPlTy9sQ7NnDSzmdrzwQFJCydI2j7BGgQ5j++ jtja77/UQlSkeya4RiyDthIVk5iReYf93PVC/qc9+QDPe8c6wy6XMrNTGAsDjyw23DRT A5oG1zpZG0bBU11Tzl2TFZS9hSTY6GA7lMkl28+zpVFFAfR6GmZI6E2IKO/7YM7/sdNh gYdieJB88N0p7ZRn4i7i6bS4wb256rwYGaQoxyfRLavw7LuFnZs09SksZHwpBHL0m13b gqhw== X-Gm-Message-State: AOAM533ALOT1KawcOf8LJGrU92D/XX9dVPVRDrHuz5ORhnrY4uFoxChS uUtpwoP//cK8EAUQ1oj5y5nBSA== X-Received: by 2002:a17:90a:5c83:: with SMTP id r3mr4164808pji.134.1605799538813; Thu, 19 Nov 2020 07:25:38 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id 144sm130250pfb.71.2020.11.19.07.25.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Nov 2020 07:25:38 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Andre Przywara , Dave Martin , James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Al Grant , Wei Li , John Garry , Will Deacon , Mathieu Poirier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v9 11/16] perf arm-spe: Remove size condition checking for events Date: Thu, 19 Nov 2020 23:24:36 +0800 Message-Id: <20201119152441.6972-12-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119152441.6972-1-leo.yan@linaro.org> References: <20201119152441.6972-1-leo.yan@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the Armv8 ARM (ARM DDI 0487F.c), chapter "D10.2.6 Events packet", it describes the event bit is valid with specific payload requirement. For example, the Last Level cache access event, the bit is defined as: E[8], byte 1 bit [0], when SZ == 0b01 , when SZ == 0b10 , or when SZ == 0b11 It requires the payload size is at least 2 bytes, when byte 1 (start counting from 0) is valid, E[8] (bit 0 in byte 1) can be used for LLC access event type. For safety, the code checks the condition for payload size firstly, if meet the requirement for payload size, then continue to parse event type. If review function arm_spe_get_payload(), it has used cast, so any bytes beyond the valid size have been set to zeros. For this reason, we don't need to check payload size anymore afterwards when parse events, thus this patch removes payload size conditions. Suggested-by: Andre Przywara Signed-off-by: Leo Yan Reviewed-by: Andre Przywara --- tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 9 +++------ .../util/arm-spe-decoder/arm-spe-pkt-decoder.c | 14 ++++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c index cac2ef79c025..90d575cee1b9 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c @@ -192,16 +192,13 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder) if (payload & BIT(EV_TLB_ACCESS)) decoder->record.type |= ARM_SPE_TLB_ACCESS; - if ((idx == 2 || idx == 4 || idx == 8) && - (payload & BIT(EV_LLC_MISS))) + if (payload & BIT(EV_LLC_MISS)) decoder->record.type |= ARM_SPE_LLC_MISS; - if ((idx == 2 || idx == 4 || idx == 8) && - (payload & BIT(EV_LLC_ACCESS))) + if (payload & BIT(EV_LLC_ACCESS)) decoder->record.type |= ARM_SPE_LLC_ACCESS; - if ((idx == 2 || idx == 4 || idx == 8) && - (payload & BIT(EV_REMOTE_ACCESS))) + if (payload & BIT(EV_REMOTE_ACCESS)) decoder->record.type |= ARM_SPE_REMOTE_ACCESS; if (payload & BIT(EV_MISPRED)) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c index 3f30b2937715..88bcf7e5be76 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c @@ -311,14 +311,12 @@ static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet, arm_spe_pkt_out_string(&err, &buf, &buf_len, " NOT-TAKEN"); if (payload & BIT(EV_MISPRED)) arm_spe_pkt_out_string(&err, &buf, &buf_len, " MISPRED"); - if (packet->index > 1) { - if (payload & BIT(EV_LLC_ACCESS)) - arm_spe_pkt_out_string(&err, &buf, &buf_len, " LLC-ACCESS"); - if (payload & BIT(EV_LLC_MISS)) - arm_spe_pkt_out_string(&err, &buf, &buf_len, " LLC-REFILL"); - if (payload & BIT(EV_REMOTE_ACCESS)) - arm_spe_pkt_out_string(&err, &buf, &buf_len, " REMOTE-ACCESS"); - } + if (payload & BIT(EV_LLC_ACCESS)) + arm_spe_pkt_out_string(&err, &buf, &buf_len, " LLC-ACCESS"); + if (payload & BIT(EV_LLC_MISS)) + arm_spe_pkt_out_string(&err, &buf, &buf_len, " LLC-REFILL"); + if (payload & BIT(EV_REMOTE_ACCESS)) + arm_spe_pkt_out_string(&err, &buf, &buf_len, " REMOTE-ACCESS"); return err; } -- 2.17.1