Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2271109pxb; Mon, 11 Jan 2021 05:41:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvgOVcjWRNAZYze7TU9wRBrte+edCfL7SCGFXJ6zF5NZod2QAGOX+QIZp/tkJ7/YksCCb2 X-Received: by 2002:a17:906:1741:: with SMTP id d1mr11218382eje.182.1610372515424; Mon, 11 Jan 2021 05:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372515; cv=none; d=google.com; s=arc-20160816; b=gdVBd+TCOv6i5eXl2lbYU+lXXef8VoVRwU6EmD9EnxgDZ/0BHzr0YYxBacnq3FXY5r ERG6wu3ItacIogDo5OS0PJPt5KCeui7IaqtIjB0Fl09yZ3hN3yqvBYjQrWMeJuZ5wtnU +oAWv1qBQvkX5E8MjmDmfD3AlT5OXJ3LwNHAO6xx9lsytX2aSyFYnMxeVQ3p1Cr0Fu6I OdQJXBG4nxjawDESZ9wmuYR2pTQAuf4je2BDdUNq6xdlmuLa80L2e0lNDCD4EqOr4spm QhkduA5cXymxrjE6Cyt2+0courZZdtb2YI/YFE6fl6pDy1LNH2bOFwuqqEa6VwhTxXY6 VNDg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1vxLxmNp00/ADs1BfRL7o4NMbtUvoFLTlYBIY2H+Ps4=; b=LVtVOkPxZXoxq9Ztpp9agZ9IUjKW+9RTVIMkdP/kLaekKMAWfy0H1M1NZ00h5gDrt6 EOhDVhLoKVYQOUHpfgOTU76UgGhe5sgPz1P6IUCmM/+vCLO9ThNGuHSlmHLtNXZdM09N PQdsfa7SslgK/u5oX0f8T6E3VPVY9KMoVRkahhHoGBD2cPO2dCkRo4IxnpMP45+iqZz7 2xvd8n0nP4ABHhiLwIGSjey0jc7upkiownKxIxjayeN8kVO3SG1jYt3chOPctQYGuBf0 94p+6hdsgcSDLco4l09F1De+lmHXCH/TxrjWPfpGS84J2EZtsCkRG2RGCuS1Fo0+mEZE soMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zKB1IKhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs12si6464909ejb.127.2021.01.11.05.41.31; Mon, 11 Jan 2021 05:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zKB1IKhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731647AbhAKNjL (ORCPT + 99 others); Mon, 11 Jan 2021 08:39:11 -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-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