From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37796C433E0 for ; Sat, 9 Jan 2021 07:47:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E65E523A5B for ; Sat, 9 Jan 2021 07:47:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E65E523A5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7ggmuqksOvrBze9zafobhoE8XqStg0wvs2E/qtEVa+o=; b=R8/Wiqz++wpFKeTkGu+GGnSAq WiCx1lASIQv18XIi8fbQAj6eSp1bvmxQ+Qv0iDCkgBnU1dAnBDOPxJM+gbNBsKPUgTCwHRqDAbFJT IaJYPHhGUKUwhup/cfSaWPxKw2FKagCKIcnwVkESWhUNoukscJJwa8Ex/sInk6hboxvZKhsap6sZI +DYIMYrrzT5JFN5v3lZtCVOk61aYLtJ4BKhpz+o/UUYFIWl5a/WsR7/bTXMvNuwniamu7JKKosaxF NMzWatdzZODpUY9gQdhi7PHjg5DooJW8uOqInq6Kh5f6R8quRyr7aoMVHrseo9hlsAyU2Hl1sCc8o OHmLITozA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ky8wL-0000Ev-GX; Sat, 09 Jan 2021 07:45:37 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ky8w2-00007l-RP for linux-arm-kernel@lists.infradead.org; Sat, 09 Jan 2021 07:45:21 +0000 Received: by mail-pg1-x529.google.com with SMTP id p18so9125512pgm.11 for ; Fri, 08 Jan 2021 23:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F4OzOyv70Lhfq12F8FRvsAetz6bosZ6Up6z1SXm5NbU=; b=MRKGhr7eJRhmN9fkZMr5AF257GyyH9ZLwPvc2vQugCAUazcmLqVQ3BNC0WfQYhVoxO MIboq621Ct6wqDKEwP7FcQ1yyhaiMucScDXrCrj5u/iqTjYavcolW9JmwyJpozWMcUI0 jF05XNu/Kn9sVBegFg8OwfpiqpD/0NM/Z+4NDkPY82IpHycPffb8SQmp8FUFc4Zzi/g3 rNUCqk+DhGVOgjdwDPAQmBc8eyXY4vyZ0DakLKlBpP6SmWns+dhHNIZLau2ZKGMfJGEa uyhNCuxvErESioUpTVp+N+62vEFBNIHdCRegnL9xVuE8A0mFR+SyoifduoZqiTSb7yDl 1KcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F4OzOyv70Lhfq12F8FRvsAetz6bosZ6Up6z1SXm5NbU=; b=a+dWxmY8n5lwcJp3dLMReKKvFk8C5PszHqcSbkBhGv6dHwDYlaiIGScuvkgQY/bPmS /3pk2vzxP4CCzh+1n2u53f8zf7ij9gPwGCcipXJvd7NKV1hItjTCOB1XipGEnroLXCvb dOrPuQfVi2rBkRBt8w1R/qwyoGJu8ZmdkTllQsIz+g07yuEoZtNzp8v3yvr9xlKQC+eM YuF2JG/rHxlrx9EIe/nQjTxcexnTzeEK9f1+mIa3v0CUYEjypco8ReozR6e4og4pxbIS ZJdrkWgFseqEAYCW6knxkAm+z/3FSLfg5On1UtQnlr/UA4AXc2OXWngGq4qfMhnliiNR KeRQ== X-Gm-Message-State: AOAM533HMRNI0yBxz85/d2Lu9aTsSUdJgvhP0NmRyZxkcbM1tq2gsos6 2AcLxkWAuSBTEUoYwJNhIngxYw== X-Google-Smtp-Source: ABdhPJz059312bIOdjut/wKwfTvxECETX2CJluKIS2sy1Xom9WVZzFYE0xFijueYYkOXpr612t5kBg== X-Received: by 2002:a62:1b06:0:b029:19d:d05d:f67a with SMTP id b6-20020a621b060000b029019dd05df67amr10514616pfb.78.1610178316718; Fri, 08 Jan 2021 23:45:16 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id o190sm11602324pga.2.2021.01.08.23.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 23:45:16 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 7/7] perf cs-etm: Detect pid in VMID for kernel running at EL2 Date: Sat, 9 Jan 2021 15:44:35 +0800 Message-Id: <20210109074435.626855-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210109074435.626855-1-leo.yan@linaro.org> References: <20210109074435.626855-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210109_024519_517532_C9D78CC7 X-CRM114-Status: GOOD ( 17.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Al Grant , Leo Yan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Suzuki K Poulose The pid of the task could be traced as VMID when the kernel is running at EL2. Teach the decoder to look for vmid when the context_id is invalid but we have a valid VMID. Cc: Mike Leach Cc: Mathieu Poirier Cc: Al Grant Co-developed-by: Leo Yan Signed-off-by: Suzuki K Poulose Signed-off-by: Leo Yan --- .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index cd007cc9c283..9e81169dfa76 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -6,6 +6,7 @@ * Author: Mathieu Poirier */ +#include #include #include #include @@ -500,13 +501,36 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, const ocsd_generic_trace_elem *elem, const uint8_t trace_chan_id) { - pid_t tid; + pid_t tid = -1; + u64 pid_fmt; + int ret; - /* Ignore PE_CONTEXT packets that don't have a valid contextID */ - if (!elem->context.ctxt_id_valid) + ret = cs_etm__get_pid_fmt(trace_chan_id, &pid_fmt); + if (ret) + return OCSD_RESP_FATAL_SYS_ERR; + + /* + * Process the PE_CONTEXT packets if we have a valid + * contextID or VMID. + * If the kernel is running at EL2, the PID is traced + * in contextidr_el2 as VMID. + */ + switch (pid_fmt) { + case BIT(ETM_OPT_CTXTID): + if (elem->context.ctxt_id_valid) + tid = elem->context.context_id; + break; + case BIT(ETM_OPT_CTXTID_IN_VMID): + if (elem->context.vmid_valid) + tid = elem->context.vmid; + break; + default: + break; + } + + if (tid == -1) return OCSD_RESP_CONT; - tid = elem->context.context_id; if (cs_etm__etmq_set_tid(etmq, tid, trace_chan_id)) return OCSD_RESP_FATAL_SYS_ERR; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel