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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 E5D90C433E0 for ; Sat, 9 Jan 2021 07:46:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9BD423A79 for ; Sat, 9 Jan 2021 07:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbhAIHqP (ORCPT ); Sat, 9 Jan 2021 02:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbhAIHqO (ORCPT ); Sat, 9 Jan 2021 02:46:14 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EF1C0613D3 for ; Fri, 8 Jan 2021 23:45:10 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id n25so9166310pgb.0 for ; Fri, 08 Jan 2021 23:45:10 -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 :mime-version:content-transfer-encoding; bh=dF/EKdBMWNZukrtDgFeRBaQSiWHOXzvDtMysige8IMM=; b=diKFo4VOSz5+2ldh4AfV1QZNz/cCXen4m7HA5tvmSsq+HrOil8gfH0w8gHxF1twJfe IEOxH4puKJ1c6kSiYkGWx+ra4zzfWZL54en3bx4p6md+/8Y8kiJ7QoIljUr3oX1Rtx7O VN3WF1B4dDobQbkF5VndZgrDzY1fmvghrPP6kYXem/5i+YAms7GKVMGpgfUy12ZMlVIS mj+86A1oFjvDzvvEI3uVsoo3asL0cqOFzbSMibpcXxfC2Mm5qCZ3mNt5nYtLOkFWCnkx PCzpHesTIcCIFOtKJHEXOWf/Lt7Itjdip+3AydoGHH0jC1fvXzAQ6dj+vjdMl+Po0LRR Pbbg== 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:mime-version:content-transfer-encoding; bh=dF/EKdBMWNZukrtDgFeRBaQSiWHOXzvDtMysige8IMM=; b=ImBJRQw9j7gy9MGL/Mm1pBLJjVUViFzx9LJ8g/TLpfZc0ODeGQ0gL52s1KIbR83cyz vXKLywG8eXRtCLLrvdp2zP/c9j06j3QO5dOhwCdVS1w75HhaxHWpdU0nsUPW8R3njp/u 7HwqPaXrNFh3TW/w8HJj2iwF3dDElCQy4LxJulqRCKL3iiJXX0DUCQRM2dNWb452PvS7 niOyLKzd2MsYry8lUSOqcTV4lAUSzIYFFnFj/pgO++vZXE2d/4J+qVSDvpK3P4zBXFnE DosSkX6woq6tQQXbNqVg/emLDEEfGOZZiCaZvyPe6qmWieK4b2F2Bo9Ny9JneVKBwAMH E4xA== X-Gm-Message-State: AOAM533g8FHHpvntHGAIwe2HQDYMXZF9FAGOTblxMmtIMBSl+YcnO9P5 Vkxhshbw+gYSO6RJE7teVemY9g== X-Google-Smtp-Source: ABdhPJwKygRbWFTzLd1YAagyLsompFy5xCkGW8uIHWnEVp+Hs8y/4Y5lV3jiD9y1P8B4j0p+C4TLaw== X-Received: by 2002:a65:648c:: with SMTP id e12mr10782768pgv.123.1610178310055; Fri, 08 Jan 2021 23:45:10 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id ay21sm7330832pjb.1.2021.01.08.23.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 23:45:09 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 5/7] perf cs-etm: Fixup PID_FMT when it is zero Date: Sat, 9 Jan 2021 15:44:33 +0800 Message-Id: <20210109074435.626855-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210109074435.626855-1-leo.yan@linaro.org> References: <20210109074435.626855-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the metadata item CS_ETM_PID_FMT/CS_ETMV4_PID_FMT is zero, this means the perf data file is recorded with old version tool and the tool has not extended to support the item. For this case, this patch fixes up PID_FMT entry to set the value as BIT(ETM_OPT_CTXTID), this info will be delivered to the decoder to extract PID from packet's field "context_id". Signed-off-by: Leo Yan --- tools/perf/util/cs-etm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 763085db29ae..8c125134a756 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -2577,6 +2578,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, for (k = 0; k < metadata_cpu_array_size; k++) metadata[j][k] = ptr[i + k]; + /* + * If the data in CS_ETM_PID_FMT is zero, means the + * information isn't stored in the data file, this is + * because the old perf tool hasn't yet supported + * CS_ETM_PID_FMT. Fixup the item to option "CTXTID". + */ + if (!metadata[j][CS_ETM_PID_FMT]) + metadata[j][CS_ETM_PID_FMT] = BIT(ETM_OPT_CTXTID); + /* The traceID is our handle */ idx = metadata[j][CS_ETM_ETMTRACEIDR]; i += metadata_cpu_array_size; @@ -2590,6 +2600,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, for (k = 0; k < metadata_cpu_array_size; k++) metadata[j][k] = ptr[i + k]; + /* + * If the data in CS_ETMV4_PID_FMT is zero, means the + * information isn't stored in the data file, this is + * because the old perf tool hasn't yet supported + * CS_ETMV4_PID_FMT. Fixup the item to option "CTXTID". + */ + if (!metadata[j][CS_ETMV4_PID_FMT]) + metadata[j][CS_ETMV4_PID_FMT] = BIT(ETM_OPT_CTXTID); + /* The traceID is our handle */ idx = metadata[j][CS_ETMV4_TRCTRACEIDR]; i += metadata_cpu_array_size; -- 2.25.1 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 E2407C433E0 for ; Sat, 9 Jan 2021 07:47:03 +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 9D54723A5B for ; Sat, 9 Jan 2021 07:47:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D54723A5B 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2VIYCf+eVvty4xQlzm8X9UZl4I6+ThZfuTp6dZc9N6o=; b=GoNXeI1Sdwrlxagxhc9X0Allb J4yliu6dmTzYrvcNRdccsAdKywcYvzyVnh1xiDTfoi65tnLMrmuMc9/R9tXqXFNh6H2HTexro9vVz HGX3QI23eHmXe0fBqAjG1xshoci70ToEKTGwOy7ZZT0wBuMWMe6aBwb17NWrn1X73V8UTtz4/pvoM fZjIwESJWnmypDUiHCTj2dNNKVzHXYN7pLxEihyjBHBdFFcQGUpPVH7GIt//9zN6v1DeHZh+pRgia cZDKjXTg5xtGU7dtKZQmKDzPrbwa3B1Mfnf5mpLQ6RD3T/5+vubTSntI7YbBqrgPiO5Nub8z2ZmKK RHOxLvdXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ky8wA-0000Ag-Ar; Sat, 09 Jan 2021 07:45:26 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ky8vw-00005R-5A for linux-arm-kernel@lists.infradead.org; Sat, 09 Jan 2021 07:45:13 +0000 Received: by mail-pf1-x433.google.com with SMTP id m6so2171620pfk.1 for ; Fri, 08 Jan 2021 23:45:11 -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 :mime-version:content-transfer-encoding; bh=dF/EKdBMWNZukrtDgFeRBaQSiWHOXzvDtMysige8IMM=; b=diKFo4VOSz5+2ldh4AfV1QZNz/cCXen4m7HA5tvmSsq+HrOil8gfH0w8gHxF1twJfe IEOxH4puKJ1c6kSiYkGWx+ra4zzfWZL54en3bx4p6md+/8Y8kiJ7QoIljUr3oX1Rtx7O VN3WF1B4dDobQbkF5VndZgrDzY1fmvghrPP6kYXem/5i+YAms7GKVMGpgfUy12ZMlVIS mj+86A1oFjvDzvvEI3uVsoo3asL0cqOFzbSMibpcXxfC2Mm5qCZ3mNt5nYtLOkFWCnkx PCzpHesTIcCIFOtKJHEXOWf/Lt7Itjdip+3AydoGHH0jC1fvXzAQ6dj+vjdMl+Po0LRR Pbbg== 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:mime-version:content-transfer-encoding; bh=dF/EKdBMWNZukrtDgFeRBaQSiWHOXzvDtMysige8IMM=; b=dDouSroLzaNdZN/i7v6KE1tgTfYcWlgUuzMcrvbpyZZvj4Wg/eesAkOxL2QxuSZzlD GeMF0Ll7ZKGhwGc/TuOvYeVTrO40Iia0hCJ7LdUwS6mfigPL0+l0JmF8IdQkZLh5Zaj2 VJuUPMiAeKVjSrxoyzB3e9DTU1Wsp52WcRbfBpS+5hdfmeWR2ByVCaQc0iHci0ZpRRMJ AilgUo+fd1OJduUxY4tXsNYApTTAWNKyMbzl3COhONFjUFDsBlwsx1cBgLdSV3AA2syq 9aK5z6NDook/TyYUVqpuS/33cZn0PWsVOkXrtZNellz1Q5hCCaGzqM+lYDoEJDCslz3Q SZcg== X-Gm-Message-State: AOAM532iMNGBfjdLxyj8wqjh97x5tST6AeHAqIWXI8TIqqNo49Z8OXbW 1KbX/M2//vZ8C1DYTBMug2lzLA== X-Google-Smtp-Source: ABdhPJwKygRbWFTzLd1YAagyLsompFy5xCkGW8uIHWnEVp+Hs8y/4Y5lV3jiD9y1P8B4j0p+C4TLaw== X-Received: by 2002:a65:648c:: with SMTP id e12mr10782768pgv.123.1610178310055; Fri, 08 Jan 2021 23:45:10 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id ay21sm7330832pjb.1.2021.01.08.23.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 23:45:09 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 5/7] perf cs-etm: Fixup PID_FMT when it is zero Date: Sat, 9 Jan 2021 15:44:33 +0800 Message-Id: <20210109074435.626855-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210109074435.626855-1-leo.yan@linaro.org> References: <20210109074435.626855-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210109_024512_229737_42A9FAC1 X-CRM114-Status: GOOD ( 15.30 ) 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: Leo Yan 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 If the metadata item CS_ETM_PID_FMT/CS_ETMV4_PID_FMT is zero, this means the perf data file is recorded with old version tool and the tool has not extended to support the item. For this case, this patch fixes up PID_FMT entry to set the value as BIT(ETM_OPT_CTXTID), this info will be delivered to the decoder to extract PID from packet's field "context_id". Signed-off-by: Leo Yan --- tools/perf/util/cs-etm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 763085db29ae..8c125134a756 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -2577,6 +2578,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, for (k = 0; k < metadata_cpu_array_size; k++) metadata[j][k] = ptr[i + k]; + /* + * If the data in CS_ETM_PID_FMT is zero, means the + * information isn't stored in the data file, this is + * because the old perf tool hasn't yet supported + * CS_ETM_PID_FMT. Fixup the item to option "CTXTID". + */ + if (!metadata[j][CS_ETM_PID_FMT]) + metadata[j][CS_ETM_PID_FMT] = BIT(ETM_OPT_CTXTID); + /* The traceID is our handle */ idx = metadata[j][CS_ETM_ETMTRACEIDR]; i += metadata_cpu_array_size; @@ -2590,6 +2600,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, for (k = 0; k < metadata_cpu_array_size; k++) metadata[j][k] = ptr[i + k]; + /* + * If the data in CS_ETMV4_PID_FMT is zero, means the + * information isn't stored in the data file, this is + * because the old perf tool hasn't yet supported + * CS_ETMV4_PID_FMT. Fixup the item to option "CTXTID". + */ + if (!metadata[j][CS_ETMV4_PID_FMT]) + metadata[j][CS_ETMV4_PID_FMT] = BIT(ETM_OPT_CTXTID); + /* The traceID is our handle */ idx = metadata[j][CS_ETMV4_TRCTRACEIDR]; i += metadata_cpu_array_size; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel