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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 A2048C433DB for ; Thu, 4 Feb 2021 11:25:23 +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 0C64E64F46 for ; Thu, 4 Feb 2021 11:25:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C64E64F46 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=iouDtUqfl7syri8mUEnO2cYRKRvIWInLnLDuap0b3iQ=; b=s+b41+xXohFL5wIKrwynNBcSa Jcg/020+6LPds82lURAQi+DAww2OLTSgq4sMEr68oJjszsvKqMedhMG6Ksx+KIKKlarn/fOeOt3wY BjQvhaKuahWI72ZLSaDKZNSRN1sBIQNDXpWFfRIWgNcnfRSvaNL/hUz43lHUo0re4Pw7DsbtrpL/k IyggvyJVPnLxlbglTEjI9A1T0ygOmOUr0RrZK+Kanh4zaPuMwehUV0c66zavpmuGC7CnQFL4qfmwX lMKetZhrAFWCaHElulWlEw7c4dLgDDFN09TP9ObIARFrVblAarClrH5CEYe4Tk5GzCGdCYp7gBtAO 0f0h6cPBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7cjw-0002lN-T2; Thu, 04 Feb 2021 11:24:00 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7cjv-0002kg-1S for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2021 11:24:00 +0000 Received: by mail-pg1-x534.google.com with SMTP id s23so1849716pgh.11 for ; Thu, 04 Feb 2021 03:23:58 -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=V7rULbaG104yDDjFdCtwJRa6RUjo/05yFDNeO4JtaHA=; b=C7ZiWmSrGeODfkXEGEpjdykW+98WjIcptGxEOqlC3RJeYOqpzVBGXv7BdvYrm0gCEB M1M93TlBRl3d4CucYu48KGzZU/+L3AgjynwBUzefZ54YLFAfhGMw8Y1gA/OeuoMymZ7S wTazGC5lQA/cfRHLqXUUEVMlBtgjKkKWdQCunPdVKG3YMWMTtdXyIx8mPsfd25Xp3pjN +taCuLag0SA9HIY+HKl94eIe6eYlG0rwQgKQDeGdocvYL4d/RTtlrr6H4NiC0eGbMtJF xLxIFD50DdIbMpy7/ognjZ31wkVi+iAbroH07xKWrG8RWGdA9L4Z3SHOkELRY5f5S4rC tLTA== 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=V7rULbaG104yDDjFdCtwJRa6RUjo/05yFDNeO4JtaHA=; b=Md0xUZM+wsqrs0KKLgYWj/pNPBufGGDy+wnVwMLbrMTrFJNoUcu+BIJTfXRN6ozRL+ fba4uSmXLHZPU1NjjLOzN5Du5S4CT4Upww7UJS4PxD933+aQLcPUdbhNlQ1SrPqI++eV 3M2ykHZA/CReSumRqBy1KLeUp0U/gzU1KbIMjtHROzKWsC+oYYherJIeA2CSKvElCEfu PeS7I7C2Td8S8FvQjIIRaDYW8iixC1rGXD5C4Ss33F0ny7loIcXFXtB/xc24yVRYP+8d v6L0G9PSTYQcY67t1VcCQvdJpoZGBNyyNQDU/LWM9fZ60KClJI0S0DHGvmfA/tO1MouD 1Z8g== X-Gm-Message-State: AOAM530/K4aLAhtNd+WyE34n3cJnjU1PkX8IKZnDo5Kh2nb9CIW5T+U6 EqOyON1xorBo3WZnOGV6nUoT0g== X-Google-Smtp-Source: ABdhPJxP8Tg5PNgxlzWSgKs1us0dllC703LhNsBDnEfjrpix9Ew9+wtzTM2p8dAxirTYjD6HjMf8LQ== X-Received: by 2002:aa7:87d8:0:b029:1bd:d756:bdc9 with SMTP id i24-20020aa787d80000b02901bdd756bdc9mr7815954pfo.68.1612437836456; Thu, 04 Feb 2021 03:23:56 -0800 (PST) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id i7sm5012158pjx.13.2021.02.04.03.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 03:23:55 -0800 (PST) Date: Thu, 4 Feb 2021 19:23:49 +0800 From: Leo Yan To: Suzuki K Poulose Subject: Re: [PATCH v2 5/7] perf cs-etm: Add helper cs_etm__get_pid_fmt() Message-ID: <20210204112349.GB4737@leoy-ThinkPad-X240s> References: <20210202163842.134734-1-leo.yan@linaro.org> <20210202163842.134734-6-leo.yan@linaro.org> <51a1e845-f9a4-3c6e-88a2-c105f5b5adfe@arm.com> <20210204034743.GE11059@leoy-ThinkPad-X240s> 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-20210204_062359_129231_7685BCCE X-CRM114-Status: GOOD ( 20.92 ) 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 , 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 Thu, Feb 04, 2021 at 10:54:24AM +0000, Suzuki Kuruppassery Poulose wrote: [...] > > > > +int cs_etm__get_pid_fmt(u8 trace_chan_id, u64 *pid_fmt) > > > > +{ > > > > + struct int_node *inode; > > > > + u64 *metadata, val; > > > > + > > > > + inode = intlist__find(traceid_list, trace_chan_id); > > > > + if (!inode) > > > > + return -EINVAL; > > > > + > > > > + metadata = inode->priv; > > > > + > > > > + if (metadata[CS_ETM_MAGIC] == __perf_cs_etmv3_magic) { > > > > + val = metadata[CS_ETM_ETMCR]; > > > > + /* CONTEXTIDR is traced */ > > > > + if (val & BIT(ETM_OPT_CTXTID)) > > > > + *pid_fmt = BIT(ETM_OPT_CTXTID); > > > > + } else { > > > > + val = metadata[CS_ETMV4_TRCCONFIGR]; > > > > + > > > > + *pid_fmt = 0; > > > > + > > > > + /* CONTEXTIDR_EL2 is traced */ > > > > + if (val & (BIT(ETM4_CFG_BIT_VMID) | BIT(ETM4_CFG_BIT_VMID_OPT))) > > > > + *pid_fmt = BIT(ETM_OPT_CTXTID2); > > > > + > > > > + /* CONTEXTIDR_EL1 is traced */ > > > > + if (val & BIT(ETM4_CFG_BIT_CTXTID)) > > > > > > I haven't looked at how this gets used. But, Shouldn't this be : > > > > > > else if (val & BIT(ETM4_CFG_BIT_CTXTID)) ? > > > > Actually it's deliberately to set both bits ETM_OPT_CTXTID2 and > > ETM_OPT_CTXTID if user has enable configs "contextid1" and > > "contextid2". So this is exactly the reversed flow in the > > function cs_etmv4_get_config(). > > The point is, we don't care if the user selected both options. What we > care is, where can we find the PID. CONTEXTIDR_EL1 or CONTEXTIDR_EL2. > As such, get_pid_fmt simply should make that decision and pass it on. > So, if the CONTEXTIDR_EL2 is selected (which can only be done successfully > on an EL2 kernel), thats our pid. > > So we should return the format for the PID here. i.e > ETM_OPT_CTXTID2 OR ETM_OPT_CTXTID. But not both. Okay, if so I will follow your suggestion. Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel