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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1200CCCA470 for ; Wed, 1 Oct 2025 13:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4wCVnk2y4shS4l6zykuxmG8m7wF2PLaPUYHyqMnKqgQ=; b=I0kBT3SocxZZbOq/WKLZISGDKU 2FQGMYt/dg4iDl7Z0p+g0q+DYhF5+F+PfuniMf4dfVqXCwkk0O5cj1XB1fNKPj1Xy+vxUbBmf7Cn1 bWJDBxbwOuuELJJiui+GZCc8YVnC3hG4bivQXhsaVoSXFoBzLpYenXzxf3SmWihKM4P72NbzqQNUy bGhuxMMgG1WmRA1HqDuwCVv+jzXfn8/Wvv+aeycLNQQnnH9+iqLWZ8SRhQuNV3lhmmlI5AO4DDubP aiZY1ano2NduNCmw4Iljox2FL6WNW9ZdmOcN4qguXB05XHsEwf+6boieQAFty4GEnU/4l5g4n82YZ mrtowabA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3xJA-000000085uo-2Ig3; Wed, 01 Oct 2025 13:55:52 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3xJ8-000000085uQ-0162 for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2025 13:55:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A795A16F2; Wed, 1 Oct 2025 06:55:40 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 52C6A3F66E; Wed, 1 Oct 2025 06:55:48 -0700 (PDT) Date: Wed, 1 Oct 2025 14:55:46 +0100 From: Leo Yan To: James Clark Cc: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v2 5/6] coresight: Add format attribute for setting the timestamp interval Message-ID: <20251001135546.GP7985@e132581.arm.com> References: <20250814-james-cs-syncfreq-v2-0-c76fcb87696d@linaro.org> <20250814-james-cs-syncfreq-v2-5-c76fcb87696d@linaro.org> <20250930151414.GK7985@e132581.arm.com> <3a731a9e-0621-42b6-b7fc-4b0fd9b7da6e@linaro.org> <20251001132815.GN7985@e132581.arm.com> <708a5bbd-2bad-4f94-8fd1-6bd10825ba71@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <708a5bbd-2bad-4f94-8fd1-6bd10825ba71@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_065550_087112_43C3CDA8 X-CRM114-Status: GOOD ( 23.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 01, 2025 at 02:44:06PM +0100, James Clark wrote: [...] > > ATTR_CFG_FLD_ts_level_* is only used in coresight-etm4x-core.c, it is not > > used in coresight-etm-perf.c. Thus, we don't need to include > > coresight-etm4x.h in coresight-etm-perf.c. Do I miss anything? > > Yes, GEN_PMU_FORMAT_ATTR() uses them but it makes it hard to see. I did a quick test, it is feasible to move ATTR_CFG_* macros in coresight-etm-perf.h. This is a more suitable ? diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index 5febbcdb8696..2679d5b2dd9a 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -8,6 +8,7 @@ #define _CORESIGHT_ETM_PERF_H #include +#include #include "coresight-priv.h" struct coresight_device; @@ -20,6 +21,12 @@ struct cscfg_config_desc; */ #define ETM_ADDR_CMP_MAX 8 +#define ATTR_CFG_FLD_ts_level_CFG config3 +#define ATTR_CFG_FLD_ts_level_LO 12 +#define ATTR_CFG_FLD_ts_level_HI 15 +#define ATTR_CFG_FLD_ts_level_MASK GENMASK(ATTR_CFG_FLD_ts_level_HI, \ + ATTR_CFG_FLD_ts_level_LO) + > > A similiar case is the attr 'cc_threshold' is only used by ETMv4, it is > > exported always. It is not bad for me to always expose these attrs but > > in the are ignored in the ETMv3 driver - so we even don't need to > > bother adding .visible() callback. > > > > I disagree with always showing them. I think they should be hidden if > they're not used, or at least return an error to avoid confusing users. It > also wastes config bits if they're allocated but never used. It is fine for not exposing ETMv4 only attrs for ETMv3. > Either way, this was done because of the header mechanics which can only be > avoided by adding more changes than just the #ifdefs. There are also already > ETM4 #ifdefs in the file. Yeah, actually we can remove ETM4 #ifdefs, something like: /* * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 @@ -90,9 +83,9 @@ static ssize_t format_attr_contextid_show(struct device *dev, { int pid_fmt = ETM_OPT_CTXTID; -#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) - pid_fmt = is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; -#endif + if (IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)) + pid_fmt = is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ; + return sprintf(page, "config:%d\n", pid_fmt); } Thanks, Leo