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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 F0F75C4332D for ; Mon, 11 Jan 2021 13:39:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B901C225AB for ; Mon, 11 Jan 2021 13:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731662AbhAKNjM (ORCPT ); Mon, 11 Jan 2021 08:39:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731026AbhAKNMx (ORCPT ); Mon, 11 Jan 2021 08:12:53 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B41C061786 for ; Mon, 11 Jan 2021 05:12:12 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id be12so9498657plb.4 for ; Mon, 11 Jan 2021 05:12:12 -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=1vxLxmNp00/ADs1BfRL7o4NMbtUvoFLTlYBIY2H+Ps4=; b=zKB1IKhP7jxgQzFwIq4aDk8gaG/nxwrlnS4JSbAlUGvU6IezYhc7Suz4fS3aklhmoF rhdN0vSLwQjB8DFbMAzZz3Ilt9wVw7FpvDdicjrNp148Nr26YeTAg2OiFqlKjyB8rVcY bjccuChI3cxJf62jFBbtfy6uhIGkPajHXo8kmuLXe+FcHUTtQ6pqzFfQsNp/AUv9neIO LEqvLumJ475zC/iQiXTBtqQy+svxsewEkLIbsI2PReWOfxF/Xsi/8KpIQ8i1g71moUjB rOend+njerAn9v3fHa3fajiN21Yl6DGqbhwxGZEGWmz9TP+Hu+r1KwcmkHUncCDQtGeJ CPYA== 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=1vxLxmNp00/ADs1BfRL7o4NMbtUvoFLTlYBIY2H+Ps4=; b=POd5wZhyzT++hR1udmhAYcOm124Vkk2IG7ZLbBjge/YA09t/nPRBBRuadOjqHXrz6e js8QJz7xosVEs2hXtvIgnARk+tQfEZ6sQcGOyE9C51HJ9kwinQtn4vJJtExs8xa74YEn 5W+V0haidhCkNpEWhpPEKjDLb6Hr4g6Pr5Ags5XlN3P/761wty8I3GGGpiQGysJhH6OC RGzuYiMiOdsnibq1KqE19TSH0Md7QeSDiWJOcfcr0TRqkDhcpLpF1dY5IrXM53icfAar 0sNd/29jbscXhIQjli1sYTKDoO6zXkzgPMlxRB8NwBA6widNkv96xPtT9JG08k1Kt8O8 K+IQ== X-Gm-Message-State: AOAM533bH1QklIXTH5G5XGctYf8jPm32nbT26CNFPluDeea/ietKfMf1 KEpJn7YiwnKjf7Ch8Kb3G+RU8g== X-Google-Smtp-Source: ABdhPJzTYTldT9Zoofpj4KAlRo4sADwH6EDwRRQZu1318y0tBL6omOHEY+QqkArlA0iDE3jytgSsIQ== X-Received: by 2002:a17:90b:1901:: with SMTP id mp1mr18201678pjb.233.1610370731452; Mon, 11 Jan 2021 05:12:11 -0800 (PST) Received: from leoy-ThinkPad-X240s ([64.120.119.108]) by smtp.gmail.com with ESMTPSA id b129sm20124237pgc.52.2021.01.11.05.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 05:12:10 -0800 (PST) Date: Mon, 11 Jan 2021 21:12:05 +0800 From: Leo Yan To: Suzuki K Poulose Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , 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: Re: [PATCH v1 4/7] perf cs-etm: Add PID format into metadata Message-ID: <20210111131205.GB222747@leoy-ThinkPad-X240s> References: <20210109074435.626855-1-leo.yan@linaro.org> <20210109074435.626855-5-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 09:45:12AM +0000, Suzuki Kuruppassery Poulose wrote: > Hi Leo, > > On 1/9/21 7:44 AM, Leo Yan wrote: > > It's possible for CoreSight to trace PID in either CONTEXTIDR_EL1 or > > CONTEXTIDR_EL2, the PID format info is used to distinguish the PID > > is traced in which register. > > > > This patch saves PID format into the metadata when record. > > The patch looks good to me. One minor suggestion below > > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/arch/arm/util/cs-etm.c | 21 +++++++++++++++++++++ > > tools/perf/util/cs-etm.c | 2 ++ > > tools/perf/util/cs-etm.h | 2 ++ > > 3 files changed, 25 insertions(+) > > > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > > index fad7b6e13ccc..ee78df3b1b07 100644 > > --- a/tools/perf/arch/arm/util/cs-etm.c > > +++ b/tools/perf/arch/arm/util/cs-etm.c > > @@ -613,6 +613,7 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > > struct cs_etm_recording *ptr = > > container_of(itr, struct cs_etm_recording, itr); > > struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; > > + u64 pid_fmt; > > /* first see what kind of tracer this cpu is affined to */ > > if (cs_etm_is_etmv4(itr, cpu)) { > > @@ -641,6 +642,16 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > > metadata_etmv4_ro > > [CS_ETMV4_TRCAUTHSTATUS]); > > + /* > > + * The PID format will be used when decode the trace data; > > + * based on it the decoder will make decision for setting > > + * sample's PID as context_id or VMID. > > + */ > > + pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); > > + if (!pid_fmt) > > + pid_fmt = 1ULL << ETM_OPT_CTXTID; > > + info->priv[*offset + CS_ETMV4_PID_FMT] = pid_fmt; > > + > > Given we do this same step twice here in this function and also in patch 2. > I am wondering if this could be made into a small helper function ? > > static u64 cs_etm_pmu_format_pid(cs_etm_pm) > { > pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); > /* > * An older kernel doesn't expose this, so fall back to using > * CTXTID. > */ > if (!pid_fmt) > pid_fmt = 1ULL << ETM_OPT_CTXTID; > return pid_fmt; > } Agreed; will follow up this suggestion. Thanks, Leo 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.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 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 91204C433DB for ; Mon, 11 Jan 2021 13:14:01 +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 4911D22B30 for ; Mon, 11 Jan 2021 13:14:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4911D22B30 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=YjvD27dqnlTtNvPVxkT5bxwNgk32dKaGfPvNT4Wj2bs=; b=y/WSDlHGgRnKlGR65eYo0yuaX 5Hl9p82wrlGss+wirVOs79g0XvUgg48icH54rQp6psp/UROnROdX/L03Mjb8Uo2iV5G1tTQv+BoAV BpJWCPxJgRIH1s0NefaGhxopb2+JRgRHUE6qwoecNPpwe6fHllxEO8UMDNQuXboc1h6y9ABouoWK5 hzBnTtXiogP+O8FS4tf2eEJ7JZCjgqoVQnlZPDn5h3R8mctnTkWXz3nyXA/dxbdnXR1na/k5cnV7t UCVN0l1QmKjc+bTby59XBa3AXPr0SGgdS2bPMX5D2bneo+7y3Dm9VCLKmjK13I53MHBILgHYrw87W 0NDbfG64g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kywza-0000ia-Pl; Mon, 11 Jan 2021 13:12:18 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kywzX-0000gP-3o for linux-arm-kernel@lists.infradead.org; Mon, 11 Jan 2021 13:12:16 +0000 Received: by mail-pl1-x62c.google.com with SMTP id 4so9489217plk.5 for ; Mon, 11 Jan 2021 05:12:14 -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=1vxLxmNp00/ADs1BfRL7o4NMbtUvoFLTlYBIY2H+Ps4=; b=zKB1IKhP7jxgQzFwIq4aDk8gaG/nxwrlnS4JSbAlUGvU6IezYhc7Suz4fS3aklhmoF rhdN0vSLwQjB8DFbMAzZz3Ilt9wVw7FpvDdicjrNp148Nr26YeTAg2OiFqlKjyB8rVcY bjccuChI3cxJf62jFBbtfy6uhIGkPajHXo8kmuLXe+FcHUTtQ6pqzFfQsNp/AUv9neIO LEqvLumJ475zC/iQiXTBtqQy+svxsewEkLIbsI2PReWOfxF/Xsi/8KpIQ8i1g71moUjB rOend+njerAn9v3fHa3fajiN21Yl6DGqbhwxGZEGWmz9TP+Hu+r1KwcmkHUncCDQtGeJ CPYA== 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=1vxLxmNp00/ADs1BfRL7o4NMbtUvoFLTlYBIY2H+Ps4=; b=NNbCd2gkd6DP6DV/gpL8EvFAm5TSeh34+puOuBR10Y4u+pPkKb/lX704ET3LSWlSWq 47f95zz2CiBmpNzKRLWhY50XryKebpMctC1OqdZ6A6Se8HM/kj4ulB48G0FGDaT0yFIb 8Lg/dx7XPxsbliGpv4pqJBLRjr/U6USG1UgQs128Vt43Q0N3l1jZiJ/KloZ0RICKOXf+ 1VyAD/MRMbvIPWdNnPX4MHEivVGvSkUwFkYD3/dWy08jeCfXBsrKurNTtuG9qeimWVM2 +e7PASUxlMnfpICwN2cgX7YV9NVQnVmEPbMyMpPMG5D5El2gNCYfp3BfSw12Qy3zK1EU 37Bg== X-Gm-Message-State: AOAM532tWhCcNlOIw0KdIssZAQd6Sel09rRVfJgyv04wE3Yttb03sHEV U3f7ZdTl24mUTqa4/DKUHHS5IQ== X-Google-Smtp-Source: ABdhPJzTYTldT9Zoofpj4KAlRo4sADwH6EDwRRQZu1318y0tBL6omOHEY+QqkArlA0iDE3jytgSsIQ== X-Received: by 2002:a17:90b:1901:: with SMTP id mp1mr18201678pjb.233.1610370731452; Mon, 11 Jan 2021 05:12:11 -0800 (PST) Received: from leoy-ThinkPad-X240s ([64.120.119.108]) by smtp.gmail.com with ESMTPSA id b129sm20124237pgc.52.2021.01.11.05.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 05:12:10 -0800 (PST) Date: Mon, 11 Jan 2021 21:12:05 +0800 From: Leo Yan To: Suzuki K Poulose Subject: Re: [PATCH v1 4/7] perf cs-etm: Add PID format into metadata Message-ID: <20210111131205.GB222747@leoy-ThinkPad-X240s> References: <20210109074435.626855-1-leo.yan@linaro.org> <20210109074435.626855-5-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-20210111_081215_293597_0311993F X-CRM114-Status: GOOD ( 26.73 ) 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 , Denis Nikitin , Mathieu Poirier , Alexander Shishkin , Jiri Olsa , coresight@lists.linaro.org, John Garry , 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 Mon, Jan 11, 2021 at 09:45:12AM +0000, Suzuki Kuruppassery Poulose wrote: > Hi Leo, > > On 1/9/21 7:44 AM, Leo Yan wrote: > > It's possible for CoreSight to trace PID in either CONTEXTIDR_EL1 or > > CONTEXTIDR_EL2, the PID format info is used to distinguish the PID > > is traced in which register. > > > > This patch saves PID format into the metadata when record. > > The patch looks good to me. One minor suggestion below > > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/arch/arm/util/cs-etm.c | 21 +++++++++++++++++++++ > > tools/perf/util/cs-etm.c | 2 ++ > > tools/perf/util/cs-etm.h | 2 ++ > > 3 files changed, 25 insertions(+) > > > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > > index fad7b6e13ccc..ee78df3b1b07 100644 > > --- a/tools/perf/arch/arm/util/cs-etm.c > > +++ b/tools/perf/arch/arm/util/cs-etm.c > > @@ -613,6 +613,7 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > > struct cs_etm_recording *ptr = > > container_of(itr, struct cs_etm_recording, itr); > > struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; > > + u64 pid_fmt; > > /* first see what kind of tracer this cpu is affined to */ > > if (cs_etm_is_etmv4(itr, cpu)) { > > @@ -641,6 +642,16 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > > metadata_etmv4_ro > > [CS_ETMV4_TRCAUTHSTATUS]); > > + /* > > + * The PID format will be used when decode the trace data; > > + * based on it the decoder will make decision for setting > > + * sample's PID as context_id or VMID. > > + */ > > + pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); > > + if (!pid_fmt) > > + pid_fmt = 1ULL << ETM_OPT_CTXTID; > > + info->priv[*offset + CS_ETMV4_PID_FMT] = pid_fmt; > > + > > Given we do this same step twice here in this function and also in patch 2. > I am wondering if this could be made into a small helper function ? > > static u64 cs_etm_pmu_format_pid(cs_etm_pm) > { > pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); > /* > * An older kernel doesn't expose this, so fall back to using > * CTXTID. > */ > if (!pid_fmt) > pid_fmt = 1ULL << ETM_OPT_CTXTID; > return pid_fmt; > } Agreed; will follow up this suggestion. Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel