From patchwork Mon Jul 22 10:11:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13738636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B97BAC3DA5D for ; Mon, 22 Jul 2024 10:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PBWFBM+gp3e/C9sPG7aaILEvO32vZCwGZx3iasW4K4Q=; b=1s83LTc4t3s8kLd19BQa8bESEW 2F3oUdf3AUleXehFOo1S/TzNxabc8I8hk8Dt+W/3lkJqeC6f9R0BWjaGll6RHjnUuavOtKmTTsqKY vyEydHZffyVIIapgwAjl9P9d7Wti1eURdh2s8S3s5rxadTFrFyH8X88gX4hB6f+f0qWVpeGWA1fz4 ExnyMDqHEUaAgb50uORVg4gx2GxpogK6M9pEtvqBHA3IR8IWwMj/Lw/ekROxAzuaPjdQYv5ODoyeC Vnkgbjs3BXT4FoQlmJIpGNxixJmjloIKT4oZ0ZWBtx+ft8E0tyRrGPZHOf+T1NhYYO1eggO4/891z RLgzJPsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVq4H-00000009D1A-3syv; Mon, 22 Jul 2024 10:14:57 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVq2J-00000009CFR-0zXW for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2024 10:12:56 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-427db004e36so15964485e9.3 for ; Mon, 22 Jul 2024 03:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721643173; x=1722247973; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PBWFBM+gp3e/C9sPG7aaILEvO32vZCwGZx3iasW4K4Q=; b=RF7MdGNSZET8ZdDSWIxs6kbM8Pq0qa6klJlVUwleDWbhBQmXt/n404vf6VeiZYEmep /x9FwCU/81pKq18M4dhaQQHJiGx1gDmrmWG0ogAv8Iqx8j23WPIM4PD9QBgOM/CvVMlu b/6Rbv1UKYU4pXR17k59zfE9LKkhD1V/UtdqWUiT7iuLvAaVmPb5DEi/ISW7UgYkYD30 2ximmbPgA01tIlkqHm4+INFsUgLOwm9oGWufl+QOeMadFEtIDLJIiDPuNEC7yQ6ja+hj nR1NfoPxf4uRWNE4YxA+5j/4ZCcoNf60/hif/T048jokYEWL5TJQHQRjNAtUTGSjpJFT oocA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721643173; x=1722247973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PBWFBM+gp3e/C9sPG7aaILEvO32vZCwGZx3iasW4K4Q=; b=Bt39ZXvx0mL0Qn34TgPtv9Bkk4U/krGfuepHZdmHXwYas+ABv97xQpjzprklra7EBO a8M2PrY7VUGzdrEYdPKlONUv3wjW/sgBodh11SzV7U6bMeUeumwDQlPIS1puFSYsBhvB w86B8RPHWnW1X9kmR4Jj0dpoFF8GJXiu0z4kHgfrPIsH+mb/BaSgwgB7O7lX6dBNfF2H mgjMebHoBxY0lzkJHOZ5EHKSfaZYGvJ8FsrUD6OEY3zopQQyMRqP5WJlc7CQ/IPdPSev 5WA6gxWhX8NGKcyECggV7dhNAU07g+iuZGrCKEPOVzk+doDJu6ZJ7gjXo97pNQiF61Wt E3Mg== X-Forwarded-Encrypted: i=1; AJvYcCWLldBCZdxXuqcRaKF6PVOMz4LcPWwTvjPuSG6pzLSbhZle00uqxgId49GRy1iB0RGBcCOHJPBGmGpyDQpvwDt9TU3qKEoP3gCx5e2lfd3rZ4lZCqo= X-Gm-Message-State: AOJu0YxWHYX9uwDR8LdZv1/PuaDEnnSs4BBbAfVcXPMB6JglrulGusX2 u/D/eUaaxnFJkQs1gXIUv9NIAWf2haYL1+jHzI/AiK43crXVRapMMeeqMFIpyBA= X-Google-Smtp-Source: AGHT+IGYIdyL3I1JnwUVfQo4oAyFcYwPdf4bNyN/KdL9IsI3rZiBMwNwH2ZruyyHUHfolR/1azJbfQ== X-Received: by 2002:a05:600c:4751:b0:426:62c6:4341 with SMTP id 5b1f17b1804b1-427dc52e886mr46427815e9.20.1721643173518; Mon, 22 Jul 2024 03:12:53 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e436sm147993865e9.33.2024.07.22.03.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 03:12:53 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, suzuki.poulose@arm.com, gankulkarni@os.amperecomputing.com, mike.leach@linaro.org, leo.yan@linux.dev, anshuman.khandual@arm.com Cc: James Clark , James Clark , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-perf-users@vger.kernel.org Subject: [PATCH v6 05/17] perf: cs-etm: Only save valid trace IDs into files Date: Mon, 22 Jul 2024 11:11:47 +0100 Message-Id: <20240722101202.26915-6-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722101202.26915-1-james.clark@linaro.org> References: <20240722101202.26915-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240722_031255_326038_F2CBE47D X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: James Clark This isn't a bug because Perf always masks with CORESIGHT_TRACE_ID_VAL_MASK before using these values, but to avoid it looking like it could be, make an effort to not save bad values. Signed-off-by: James Clark Reviewed-by: Mike Leach Signed-off-by: James Clark --- tools/perf/arch/arm/util/cs-etm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index b0118546cd4d..14b8afabce3a 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -643,7 +643,8 @@ static bool cs_etm_is_ete(struct perf_pmu *cs_etm_pmu, struct perf_cpu cpu) static __u64 cs_etm_get_legacy_trace_id(struct perf_cpu cpu) { - return CORESIGHT_LEGACY_CPU_TRACE_ID(cpu.cpu); + /* Wrap at 48 so that invalid trace IDs aren't saved into files. */ + return CORESIGHT_LEGACY_CPU_TRACE_ID(cpu.cpu % 48); } static void cs_etm_save_etmv4_header(__u64 data[], struct auxtrace_record *itr, struct perf_cpu cpu)