Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16385977rwd; Mon, 26 Jun 2023 09:16:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HXLwLe+c+y8q6eVN0998AXwqGzRsywuuLp1BcOGvLLWu+oa7ZEzL2ZxYBs7GI01Dw2yz1 X-Received: by 2002:a17:907:3f87:b0:977:d660:c5aa with SMTP id hr7-20020a1709073f8700b00977d660c5aamr27710736ejc.31.1687796214516; Mon, 26 Jun 2023 09:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687796214; cv=none; d=google.com; s=arc-20160816; b=wNJ9k/trrBn6pC+HnlsY20Hxae/taWiIhXIzdpZ/X0Dm1+YdMT952yT25/94wU4czd eUE60uLzLa+a/rT1cKCqGB+SlcToH4+cZYTekZNp2oQG4FlhH5EY3DWJyO2e4PHbS55v Vfed/QtnlCEXLiutJAmTh8jbjCczTq8ahX24BE07/3Flg/Junj45J7BTSYjEiM9D6t3B hqAl2ysu23AeYiqGUyh3y2Cn0043V1YoDogVow1k3Bh1ctkI2M/Mfw2LqCvrnKrjnbzh O8ZJoitXR2pSQ1sJJMoZTN8N1JxpLIVzKMDX0hyCJxXCl9U9+xiBL2UCpZIDzgpYgKTa rxKg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6YG+SauR9qU/aAWaDmo+UhzeUWM8k3CnmEI4YHBytOM=; fh=BH2wu2WC/D8Gb1TvhiNtspnHR3N8TPMNXgmd0sXnIOI=; b=GSgaoynzcjOJ5BmAiHjbVy02RPuE/8y0wDJfy5f+XcGCK3aZFToRoSpGLw/ZM1GMRO 2dH7cNfJO7aogRaE5vHKqjJpTFax8lyi6RAOl2gl8A0o6agDtOdVWRxD/I2feTEATrcL SfqFfdXkCTAMYrxZuDRUebtE2xSOOHvBK6gqN4H+KlsUM33mt6HyNSUobOWxDv7e6RZR rO+7FU0Ja2XHYrbAG9TDEEjeOApY2vngxBXudyJ6r7vCumx/ozxTzBn0CUNbz/SEUwxU t5EVxgx23t4S09OsbpS1zUbc/t4VywMphLvcm6ceOy/t5IfQUcGesgzBkuO1T7g1KRFF qFiA== 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 pg11-20020a170907204b00b00988c1deea4csi2984907ejb.231.2023.06.26.09.16.26; Mon, 26 Jun 2023 09:16: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; 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 S231739AbjFZQLR (ORCPT + 99 others); Mon, 26 Jun 2023 12:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbjFZQLN (ORCPT ); Mon, 26 Jun 2023 12:11:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A235E58; Mon, 26 Jun 2023 09:11:11 -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 6774A13D5; Mon, 26 Jun 2023 09:11:55 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DF9653F663; Mon, 26 Jun 2023 09:11:08 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] perf cs-etm: Handle per-thread mode on EL1 host kernel case Date: Mon, 26 Jun 2023 17:10:57 +0100 Message-Id: <20230626161059.324046-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626161059.324046-1-james.clark@arm.com> References: <20230626161059.324046-1-james.clark@arm.com> 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 In per-thread mode there are no context packets so no way to determine which type of context packets exist. But because it's only possible to trace host processes in per-thread mode without context packets then assume host in this case. This fixes the per-thread test case failures when running on nVHE: 98: Check Arm CoreSight trace data recording and synthesized samples: --- start --- ... Recording trace with '-e cs_etm/timestamp=0/ --per-thread' Looking at perf.data file for dumping branch samples: CoreSight basic testing with '-e cs_etm/timestamp=0/ --per-thread': FAIL Recording trace with '-e cs_etm/timestamp=1/ --per-thread' Looking at perf.data file for dumping branch samples: CoreSight basic testing with '-e cs_etm/timestamp=1/ --per-thread': FAIL ... Fixes: 8d3031d39fe8 ("perf cs-etm: Track exception level") Signed-off-by: James Clark --- tools/perf/util/cs-etm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 1419b40dfbe8..85821cc5650e 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -900,10 +900,17 @@ static struct machine *cs_etm__get_machine(struct cs_etm_queue *etmq, /* * For any virtualisation based on nVHE (e.g. pKVM), or host kernels - * running at EL1 assume everything is the host. + * running at EL1, or no context IDs (per-thread mode) assume everything + * is the host. */ - if (pid_fmt == CS_ETM_PIDFMT_CTXTID) + switch (pid_fmt) { + case CS_ETM_PIDFMT_CTXTID: + case CS_ETM_PIDFMT_NONE: return &etmq->etm->session->machines.host; + case CS_ETM_PIDFMT_CTXTID2: + default: + break; + } /* * Not perfect, but otherwise assume anything in EL1 is the default -- 2.34.1