Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp523987rwd; Thu, 8 Jun 2023 04:21:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NfTv50Umqm4H9O5+N5DeD4FsDdBfhU6UlwJ/qv3ai8VIj98aSmG/PyL8f4DHTKnt2opFh X-Received: by 2002:a17:90a:ac16:b0:256:22e:b93f with SMTP id o22-20020a17090aac1600b00256022eb93fmr3298163pjq.18.1686223295755; Thu, 08 Jun 2023 04:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686223295; cv=none; d=google.com; s=arc-20160816; b=VbntmwkGYmRDitch4PdHH2SkPWjly1rizdDBAeTiI3pQDtL9a0JSCTJ1vGoF6r4rfZ atry/yc4O0FwhREc/DYZXmzSj584MsKKQlRy1iAZzMIETTT7m4H9IWy3JYHlJCMmjpIz CU0TbtK+sfzNynEPXh11oYCel6r5WqYO+Lqv8LWiWPTE9ThZHxAGMXTGFxuGycgO2SXA ExFzumtzoARpxm9wljpMnRO81z5TA5qqrSkkxWftVBoQyw29vtknnlM9gpigeAJVRb5g DVV5VaJRoKxdnRvDZ0QChhyU8xHCNufDq0UnwoDKG0R6FhDn5g4eiCHdJzMbTegGS7Un HTqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YgEB7ClSTHJzoj/RaUcNBjSnRKm8Yg8hlLlYk226Zkk=; b=Yaz57VUknmWSe3j8/8wHGk4bUR/6JW6ajTb+w1K+r3vkLeJq4GUF1KTvDMvhT5GTXm UiC4t1TEK8XbtZA6mkVybjiAL6EPItLDY/bpSw11w/BMaFzljWL+62rvpEau6CEYvqhn 9gRHLwDBtNEBerNx23XodPa6sm0UWAksb2OMO4BW4iyCgzBRsDxfPY9LIO/Tz/sdVDeO qZ1x/ztpiPMKg4LlX4pgl6+vDpmIl7PWh8GzzHqMA67cm+Jg7NLKp4+aDQRkCQsnUZHi qgXzqHmnjPjGv5gjFhGK0yxu+V0A7n/yvzlJBl2wf6UTzN5L5NY+Pt4jMd2C07dZhwDZ 1odQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr4-20020a17090b4b8400b0025066f45e40si948430pjb.22.2023.06.08.04.21.23; Thu, 08 Jun 2023 04:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235929AbjFHLAK (ORCPT + 99 others); Thu, 8 Jun 2023 07:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235242AbjFHK7w (ORCPT ); Thu, 8 Jun 2023 06:59:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A018BE57; Thu, 8 Jun 2023 03:59:50 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 89150AB6; Thu, 8 Jun 2023 04:00:35 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8DFB03F71E; Thu, 8 Jun 2023 03:59:47 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org Cc: James Clark , Suzuki K Poulose , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , John Garry , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/5] perf cs-etm: Track exception level Date: Thu, 8 Jun 2023 11:59:24 +0100 Message-Id: <20230608105930.1389276-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes since v1: * Always assume host kernel when the trace was captured at EL1 (nVHE) * Fix EL validation to work with ETMv3 * Add a commit to make PID format accessible from struct cs_etm_auxtrace ====== Some fixes to support an issue reported by Denis Nikitin where decoding trace that contains different EL1 and EL2 kernels can crash or go into an infinite loop because the wrong kernel maps are used for the decode. This still doesn't support distinguishing guest and host userspace, we'd still have to fix the timestamps and do a bit more work to correlate that. And I've removed PERF_RECORD_MISC_HYPERVISOR as a possible outcome of cs_etm__cpu_mode(). As far as I know this could never have been returned anyway because machine__is_host(machine) was always true due to session.machines.host being hard coded. And I'm not sure of the relevance of the difference between PERF_RECORD_MISC_KERNEL and PERF_RECORD_MISC_HYPERVISOR in this scenario. The first commit is a tidy up, second fixes a bug that I found when comparing the exception level and thread of branch records, the third is the main fix, and the last commit is some extra error checking. Applies to acme/perf-tools (48b1320a67) James Clark (5): perf cs-etm: Only track threads instead of PID and TIDs perf cs-etm: Use previous thread for branch sample source IP perf cs-etm: Make PID format accessible from struct cs_etm_auxtrace perf cs-etm: Track exception level perf cs-etm: Add exception level consistency check .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 33 +-- .../perf/util/cs-etm-decoder/cs-etm-decoder.h | 4 +- tools/perf/util/cs-etm.c | 273 ++++++++++-------- tools/perf/util/cs-etm.h | 13 +- 4 files changed, 175 insertions(+), 148 deletions(-) -- 2.34.1