Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1724308rwd; Tue, 13 Jun 2023 13:13:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FvB/Ydsjf7ztIEWYmxwAs6aenhT1fMV9i1qc1/OJY8v4MJABi4aYkly+0d+uOuTi5Y8hf X-Received: by 2002:a05:6402:414:b0:514:9e8e:7ae5 with SMTP id q20-20020a056402041400b005149e8e7ae5mr8495297edv.9.1686687234996; Tue, 13 Jun 2023 13:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686687234; cv=none; d=google.com; s=arc-20160816; b=h2OuSgvPucp4aQ6MBGBDKvMJ8fN0rMgbhWJ8LPPS7J11a6n8a1+YvFH9D4CFyTTj8n yL4mNOY6+qH29rd6359GdFxCvFPoMlDSDRwejG86d7AlhoxN84ESk+nb/2R303AvBvKY jfJVUbOn+vettT1iw/YFVSxa1kh8mbgxF9mHrvshEB3146zURwU8scQnrShpIHnAYdxH 29uflT127LSjzewd/ZberDh5kOrizIMJB5Co1gj9pebtrmanQ8dS6JNn38Nty2RTt1Z5 CelURhP3ACrv65MwfE5oBbKg+iq5kernsneEF0UwGu0RBRtHFOFK0xc4Wg5NLFXWP2R1 dVsg== 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=Rxse5VrL8tGWEULC6IVuLfQjn7GelQLsuBF1TkZKsxY=; b=FHQKq/WnmWhxUS1wQTrUN2pPHVvF1etcm3JLhZBOZ4ya6fJTfXqPdj7b8y+WLzS7As ymUQctxE0RR4BUgY+cwH1Igi3HfE6LgX0Cm3d5vPI7KOha3/EM8BaA+GO9wTWZsauZse dpW5sR0BIBO3SZTeYY179rNKgUQ/BUtRO6H7j8EDXMOdD1zgmRK4Mw4pok6+Nh534CLl HyWSYFuRs7e+cMSmPZjCZMQsgiW2V31nOdjNOH3TaBigmEQvdA2z1xJq2/u9MQO7R91X IeS5s668tSaLmdkObHWrdGJukgeUnAD+tPaGHn5n391rUyg1EXFMZpTnD58D+ZLhb4V3 Jp4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UdWdIZQ4; 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 v17-20020aa7d651000000b00514a4bf2b90si8196710edr.322.2023.06.13.13.13.30; Tue, 13 Jun 2023 13:13:54 -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=UdWdIZQ4; 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 S232410AbjFMTnB (ORCPT + 99 others); Tue, 13 Jun 2023 15:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239430AbjFMTmz (ORCPT ); Tue, 13 Jun 2023 15:42:55 -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 C1C8F1BC3; Tue, 13 Jun 2023 12:42:53 -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 568C9635DC; Tue, 13 Jun 2023 19:42:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85A7AC433F0; Tue, 13 Jun 2023 19:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686685372; bh=c6ZzikBxtlmLZ/0hwSSKRejwnFaHjBC1cBfQC+bGTAo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UdWdIZQ4bJ4A2YGAFBv2Wd3RGgeQhYPOV2r7AIRCo0aCH8aSM8A7J/5ojsBB6PzNn 2mwAI5UT38Aq/Mn4Tym0NzSOxetG19LbSHH/Z4HK1Irn+XvDJL3u4oeEMmeWn7lD45 ahCsLFdzuHoZ3/AeYGyPowkMyNPfBj6x8H3lQjyxd/KkHDAzEJYYzNJkXOLEHvtTlG Xc17OFDbaM3ncJp5iXtdhUyduzrT09oyctZ3wX9NEIicN9mwxucNzw0qSi2FhnqD7Y 2C/IRt99JQh9xCzpeB58V6Qa9PYBwtxAcx+qVWvzRkgUILbEMy4eZCGeZw/U0N2e3d TWWu7+WB0SGXw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id EBCE140692; Tue, 13 Jun 2023 16:42:49 -0300 (-03) Date: Tue, 13 Jun 2023 16:42:49 -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> <94e91db2-182e-836f-2edc-f804c4bb7290@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <94e91db2-182e-836f-2edc-f804c4bb7290@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,URIBL_BLOCKED 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 Tue, Jun 13, 2023 at 09:56:29AM +0100, James Clark escreveu: > > > On 12/06/2023 19:32, Arnaldo Carvalho de Melo wrote: > > 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. > > > > Yeah I got the same result and the tests are still passing. Thanks for > fixing those. Thanks for double checking that! - Arnaldo > > ⬢[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