Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp214095rwd; Mon, 12 Jun 2023 12:21:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65zL6mTQO4cpiRsjY9N2W5JUOhQY1hucBNs0bnCDAFATPP0tQnr00bRTvq3EEwjTvDC6AK X-Received: by 2002:a05:6a00:2407:b0:638:edbc:74ca with SMTP id z7-20020a056a00240700b00638edbc74camr11622765pfh.0.1686597705607; Mon, 12 Jun 2023 12:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686597705; cv=none; d=google.com; s=arc-20160816; b=IsePht4/2K8nsDhYjiMgnjARHvBK9nszUTO4nyawkD3MFKMyEjcMKDnxUQ0r9WQw47 yU+nvCMbThjsJsPVdPjATmzEAgbZWq0ULN7vXwds7S4Ji8SAYTrPZwAK9PJTn5RLV0do tbNZmHGawYg2T3bEIo+Rfksl1UbtVgARBiGFS6Ve7RSMAYMjBvXB80q/m4RNqAsT0+k7 86W36YqGb/ltFs8QiomFcgoqiJ8Y94YFclfxOmBi0i55xxyqhrGhud+2E/Oi2T9xJa6y eF/en84ieUD5OUyltRVjX3XJNfot1ix3DlLoXYClH5b3ul5cakf40S9HNbYUlrF0J/Pr s0Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/ceIzicNFidNrcGsxVrRcPa5dKl7c79qDdX16uc5cpU=; b=wlPg0tJZvftEQTjvyPFw7rhRWvQYj86/wT3ooJ2pHtP//ImqMW8WQs90SjbClRIGhv e6j19EnwWuVbPTgMuAdDfowUPTBYCX5hyj3NXvkB7WHBDqvHRvHQHxdNPJ3e34gC2lUv 6EP6udMrH0T8U40rXSbN5IXa70NDuoCPgMBHTA8b8e0uFXj7KJibFEojaC/ohlUMRYfu /YirAnshAvNLWmJuzRt8Amh1Aog9J94XT0plWM0sRCc5XncuOoLbWz1HU5T+WiUoqyGT myFsYnpiF5Znw1PGd78vQfOsCvSuaGlUdnDYWDEJT/74bIj7CtIYzLdzz3vllgN/7pa9 8QZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y8rtO46J; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 64-20020a630043000000b0053416d0b548si7682563pga.543.2023.06.12.12.21.33; Mon, 12 Jun 2023 12:21:45 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y8rtO46J; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235962AbjFLSd2 (ORCPT + 99 others); Mon, 12 Jun 2023 14:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232495AbjFLSd1 (ORCPT ); Mon, 12 Jun 2023 14:33:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62BD10CC; Mon, 12 Jun 2023 11:32:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1A0C62CF7; Mon, 12 Jun 2023 18:32:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E12CCC4339C; Mon, 12 Jun 2023 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686594775; bh=WD6yfMd1Lig9EzPwhFo3GU2PEduL3upHoyMgQX0HNp0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y8rtO46J/yKiguHzzFrMJZbDczxiP6tNBlVVErJCCLqrefl7oHYqv0gvIi+XUTZ6d egc04G7adjaGRDbFCet0xVxBXk7KRDjkP+LH4qHJeOvWBRbGkRCZGB10udcFWNf0ii m3FVHNlJl1gNPlLs98KLuG97UtYg2R07tiC9CyhGbRvXJv65hgl8p92+waVzprV/qk UxHm0UnbIvGA/UuqJpsiOnJmvO/udnUwZ1zijwAItWJsVi3PIkvJj1Si7g3ix/7t6G T/D11UfKTAvesFpSKMIvqypkgOx0QS53KHpTjmOdI/wu3oQdJk/kVYsvFnZtok/8eg uxGyh4xlVp8nA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 6D6E040692; Mon, 12 Jun 2023 15:32:52 -0300 (-03) Date: Mon, 12 Jun 2023 15:32:52 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: coresight@lists.linaro.org, Suzuki K Poulose , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , 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: Re: [PATCH v3 0/5] perf cs-etm: Track exception level Message-ID: References: <20230612111403.100613-1-james.clark@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230612111403.100613-1-james.clark@arm.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 Em Mon, Jun 12, 2023 at 12:13:57PM +0100, James Clark escreveu: > Changes since v2: > > * Rename prev_thread -> prev_packet_thread and prev_el -> > prev_packet_el > * Add a comment about tracking the previous packet's thread > > 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 Please take a look in my tmp.perf-tools-next branch, there were some conflicts I had to fix as those files were touched by refactorings for addr_location and thread reference counting. ⬢[acme@toolbox perf-tools-next]$ git log --oneline -10 aa53fb2c482e70c2 (HEAD -> perf-tools-next) perf cs-etm: Add exception level consistency check 2918e9895224541f perf cs-etm: Track exception level f492a33909829a75 perf cs-etm: Make PID format accessible from struct cs_etm_auxtrace e29ec19b0751c6b2 perf cs-etm: Use previous thread for branch sample source IP e9e03e9c3ca7088c perf cs-etm: Only track threads instead of PID and TIDs 6fd34445b8c94aa7 perf map: Fix double 'struct map' reference free found with -DREFCNT_CHECKING=1 e9c0a7f63e45e76f perf srcline: Optimize comparision against SRCLINE_UNKNOWN fd87a79c7ed62804 perf hist: Fix srcline memory leak 933f9651d47cdda2 perf srcline: Change free_srcline to zfree_srcline d22cfb063bcc674e perf callchain: Use pthread keys for tls callchain_cursor ⬢[acme@toolbox perf-tools-next]$ - Arnaldo > ====== > > 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-next (42713dafc) > > 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 | 282 ++++++++++-------- > tools/perf/util/cs-etm.h | 13 +- > 4 files changed, 184 insertions(+), 148 deletions(-) > > -- > 2.34.1 > -- - Arnaldo