From patchwork Fri Jul 12 10:20:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13731582 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 3076EC2BD09 for ; Fri, 12 Jul 2024 10:24:16 +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=qAEjb2rsZzI9cp0F4WnNKSmv65r49XxBwIOcuWflPXM=; b=PiulRtPXCnKtwvxzpgWDTUmsw8 4htEvPfXPam2cYRQv/pMHZRJJfaE4OKohVckirkrnfdQ1JYhTAEAp/ebdhSqjTI/xNBuV/C4/cUqy F8Xa1Tu5RumzvMdWfqB6wyzZu5CxIKm94+9kA3/ADWRvquOtQNx6XMcOBC/3u9inf9WD7+UtPr69j n+D33Lrn4ExaWHyI8rIWX9BrQUmr4arW2kv25gf6MqHb0aJLWFED0AQo9vruBnRnhTglmCuD2ABXe eNfLQ5d4Pb0eUZxyttr0QX6j5rv6qekv4y+5AVruKmliOlrtOnirB9xCXAJqC7olxipoC2iNJ56uE cvwuUWnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSDRb-0000000HHoz-0kgQ; Fri, 12 Jul 2024 10:24:03 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSDQA-0000000HH4e-105O for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 10:22:35 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-367a464e200so1034386f8f.2 for ; Fri, 12 Jul 2024 03:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720779753; x=1721384553; 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=qAEjb2rsZzI9cp0F4WnNKSmv65r49XxBwIOcuWflPXM=; b=sQsQw2B4UxJyMVzwJOv0MmoNqkMNWuyiBmrzYs7nebkfDrTegcMXtm2x84n451ciZ3 DZ4/XjwoZkyiuMfyuZ7pollhtF8S0LVlOE6dIGpGBnJzEUhLgacEzZmiytYXj6eAp88a 14vHOS37THXtY/5RnVhJdhkxKtotdysJijBTTwMzaIQct/Yi/wJYIo8j2l7T5n5mICtQ 2XFIpkzn0Ebapim5pOATQBfLsN64wzVhH0kJT7+3AE2KmoHUVEX7RORrnMqOyNm7lwHU JHaQQNpPaoNHXRIcvWKNPvjaGsuhOECRTEJeBCgbbvMVJJmsdcGmIoFLzAbkL2WcuHZk lpkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720779753; x=1721384553; 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=qAEjb2rsZzI9cp0F4WnNKSmv65r49XxBwIOcuWflPXM=; b=NxCLZLz+2kzga0hzIYcCqtSYVonR0Rc4s0oWd9YOoYmlA4c8BB/T8+eGFEcPgTV5XP Gx7vLWE4UNMUvCvoauJ3mWEXMDgipaa31g8QsA5KdT5DsHyP0GIXrARsFk/B2r3ITOkL P4gS6S1hRVqSXHE0eaX2NeVvAgTPueRfO3PfUZ0a+plvQiwx8hyaw8BpBEsAnQND247p Bd+AwaoTMXmiOEJnqMa7GR7JJwrHKuwI4uJBJaN2hTM90Qb87q4HPP6FL9jDo3ZHpcEM 2b4Lc1aktOMhjjXD2Q1Gwpi7NcVpWFVHuF0XRZXQd5PkFvH6AIpR+OsKYb1rJAZK0rJ6 OGNw== X-Forwarded-Encrypted: i=1; AJvYcCXaJblt92AJZOHaVO/id5H0tZ5Jgdq0EFE+jWdTGRuXE+7QaTC7KwWY85cQ3OYPh4PAbMo1OJ1Pm42Wv5I9O2cU46n9pO/fpza1kBBHCgAKy3yeI/c= X-Gm-Message-State: AOJu0YxJYMvQfjESbvkJoY20aLzS3hGw9am7AGustJO/41ma1zo896kb egZVWFLb50So8ti/Rk7caLRoho7ARIhd0KkSkAR4PTOjWmKX93Hf5gSwsNNuvd0= X-Google-Smtp-Source: AGHT+IGPjnTLfBpPGirazj3MagWZ4dzGzTQ2NX7i1Hi2QXi7FbivacQqalO2G5Sx2vx8cy0+g+npzA== X-Received: by 2002:adf:fcce:0:b0:367:909b:8281 with SMTP id ffacd0b85a97d-367cead9313mr6585747f8f.59.1720779752806; Fri, 12 Jul 2024 03:22:32 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367cde89164sm9911058f8f.63.2024.07.12.03.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 03:22:32 -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 v5 05/17] perf: cs-etm: Only save valid trace IDs into files Date: Fri, 12 Jul 2024 11:20:14 +0100 Message-Id: <20240712102029.3697965-6-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240712102029.3697965-1-james.clark@linaro.org> References: <20240712102029.3697965-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-20240712_032234_300367_2CD36A0B X-CRM114-Status: GOOD ( 13.51 ) 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 Signed-off-by: James Clark Reviewed-by: Mike Leach --- 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)