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=-14.3 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 autolearn=ham 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 B81E7C433DB for ; Thu, 4 Feb 2021 04:02:03 +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 5BD1064DEE for ; Thu, 4 Feb 2021 04:02:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BD1064DEE 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EUQV2PlWMSomAsuacSquBIDx2lcE18OKNCmTD7z6as8=; b=M7CCuKxEiQy2ufVNVZlawKaDR tigiMM8JTjQr7TulsfMFiA/oXGVSDyNegJicJt52DWVbYgTMQqAzxL6opiacsUkhibGgPjwgzhKPA WuNu6qXqYTykKdr2VYm+EPEVOwNesudEWmWo6IVmcvoM56+qVPe0qqeBno0+1Ka7x3BYlTJQh00Yn UYKMQkb6+Lqt62ET/scgdfukJr9e+axwOoGvhTGSyr0z9VpUlVd9sPD/+rUm/BZ0cKhLHy7WjCAvQ tC1Tg/woBLjTMCBAw4w5yxvIjJ/gYjshth8tKzdE42SdQDPICUfdOMlQ2x2W+X8kHuuPId4PQ0dkY 1hE6Apuhg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7Voz-0001DC-6i; Thu, 04 Feb 2021 04:00:45 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7Vov-0001CN-0p for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2021 04:00:42 +0000 Received: by mail-pg1-x532.google.com with SMTP id o63so1212929pgo.6 for ; Wed, 03 Feb 2021 20:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ekev10vmev54YC6YS3oAAP96uS/rpxiv7X/ntZD7Dbw=; b=mGAZTDHihq/drbQSw1FvQ3M47w93qk6ssTjsPvKjn/8OypobWipJHgGbENvZxoXk7E VoQ9Yxi8h8KPwXTc0xJO5qlhUe07suXBeeqja5pC/p+M1YxItxxTkNnkt+Gev9wz5mz7 yfA3MX3TZPg5cUv7fZxHMcl58+oPZjWdWka9tZohkswIxTaVTPGZtEZrRQS8pxL9mume tHt2PcrEt1MjpOMWttkQ2aYUjEFv9muE/mO5fWssXE4E36FYO5SDRIoMENzBVL6Hx0f5 b6c2N8allH6eGElknLNli2mJlB2KE7CTL4QS7rotnjB3MkBNWHjpOgsuj/zQmPn81iUf +Wvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ekev10vmev54YC6YS3oAAP96uS/rpxiv7X/ntZD7Dbw=; b=MoHBipiHbvhjMYNVgq4NfzGVyRK7uMlkeKv00+SSpKN01wsz2am0I+O3/d/2BRoi94 3E3zAI160LFaICxfhU0OcwvuBEp3K2mhZdcc7ieNA2qxg4+HV0DulaEta6aWWb4wwqED sALw6R7MErfx52KccEeh7TX7CBNtkc12tFdsX8vYOwlZY9w/kHIOBjTY+pDRSK4vg2oi EHti5YAIIJkfsDv/Er8cGAuzoqL0jq2YCjCBZAaFpDBYw6HtBi8lc86s07YqkcsXi72e mRu73rzPc6fQ7uS71h6kRSJW5xK9MFeNPvmi1FHUVxfubQF+jQjDa2l7iYjmxCwixaJc 1eJQ== X-Gm-Message-State: AOAM531IvA33KpLCnvHwiKuDMSIVNRfUf4O2DS1QuxpJPXZ8T83WhOMT Cln+lQvD2YiuiArAEbwizn7IQg== X-Google-Smtp-Source: ABdhPJxm7gZSrWcznAoy/XnaxZqv9Jlv4v0jt9MlTHa9aQZbfi7VCAe+wh3ZDfVyF6iZDhLn0MQIYQ== X-Received: by 2002:a63:f703:: with SMTP id x3mr6871446pgh.66.1612411238656; Wed, 03 Feb 2021 20:00:38 -0800 (PST) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id 124sm3769128pfd.59.2021.02.03.20.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 20:00:38 -0800 (PST) Date: Thu, 4 Feb 2021 12:00:28 +0800 From: Leo Yan To: Suzuki K Poulose Subject: Re: [PATCH v2 6/7] perf cs-etm: Detect pid in VMID for kernel running at EL2 Message-ID: <20210204040021.GF11059@leoy-ThinkPad-X240s> References: <20210202163842.134734-1-leo.yan@linaro.org> <20210202163842.134734-7-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210203_230041_116261_D8A3DDCB X-CRM114-Status: GOOD ( 33.01 ) 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: Mark Rutland , Al Grant , Denis Nikitin , Mathieu Poirier , Jonathan Corbet , Alexander Shishkin , Jiri Olsa , coresight@lists.linaro.org, John Garry , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Daniel Kiss , Will Deacon , linux-arm-kernel@lists.infradead.org, Mike Leach 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 On Tue, Feb 02, 2021 at 11:29:47PM +0000, Suzuki Kuruppassery Poulose wrote: > On 2/2/21 4:38 PM, Leo Yan wrote: > > 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 CONTEXTIDR (Arm32) > > or CONTEXTIDR_EL1 (Arm64) 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 3f4bc4050477..fb2a163ff74e 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 > > @@ -491,13 +492,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) > > Is this something we can cache in this function ? e.g, > static u64 pid_fmt; > > if (!pid_pfmt) > ret = cs_etm__get_pid_fmt(trace_chan_id, &pid_fmt); > > As all the ETMs will be running at the same exception level. Sorry that I let you repeated your comments again. To be honest, I considered this after read your comment in the previous series, but I thought it's possible that multiple CPUs have different PID format, especially for big.LITTLE arch. After read your suggestion again, I think my concern is not valid, even for big.LITTLE, all CPUs should run on the same kernel exception level. So will follow up your suggestion to cache "pid_fmt". > > > + 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, Bit ETM_OPT_CTXTID2 is set in this case. > > + */ > > + switch (pid_fmt) { > > + case BIT(ETM_OPT_CTXTID): > > + if (elem->context.ctxt_id_valid) > > + tid = elem->context.context_id; > > + break; > > + case BIT(ETM_OPT_CTXTID2) | BIT(ETM_OPT_CTXTID): > > I would rather fix the cs_etm__get_pid_fmt() to return either of these > as commented. i.e, ETM_OPT_CTXTID or ETM_OPT_CTXTID2. Thus we don't > need the this case. I explained why I set both bits for ETM_OPT_CTXTID and ETM_OPT_CTXTID2 in the patch 05/07. Could you take a look for it? > With the above two addressed: > > Reviewed-by: Suzuki K Poulose Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel