From nobody Mon Apr 6 23:09:54 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D2B237F8DC for ; Tue, 17 Mar 2026 18:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773771435; cv=none; b=lnsfLNfwCk9dJ2AiFidlMKGw+XsbIEhbXgtCZkO1U9iHUaidMZhtMTdyY3wr9VWT3MNru3aYbX7jP3p2qW+d1nSXVArrRNl2F0q5Jnv8Lj70U/anVnBcJUX4/c/R6gXG/agqzeUAbx1f+O25ulBpypOcZajxhATbeL1lnFCewrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773771435; c=relaxed/simple; bh=40EpJEs0WaVO6ZN7UUiqmQPXqww499Yu1LeOXgerpuw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TqghnnjMvQjiWkwDe+FPgQamya4QkPuniempL1DzEl67y8NiuDo34SE4q8hcgzbjmFWY5SJSc/vanOpPubCTtpQQIZHwEGK3GW216IoAYqwGjJW1S96HGmLA7HsmUeQex9emwkufoOkHbYDhlvM726taNEk1OB5Ab/SaFWDSIRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 EEE291A32; Tue, 17 Mar 2026 11:17:06 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E684B3F7BD; Tue, 17 Mar 2026 11:17:11 -0700 (PDT) From: Yeoreum Yun To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, mike.leach@linaro.org, james.clark@linaro.org, alexander.shishkin@linux.intel.com, leo.yan@arm.com, Yeoreum Yun Subject: [PATCH 2/2] coresight: etm3x: fix inconsistencies with sysfs configration Date: Tue, 17 Mar 2026 18:17:05 +0000 Message-Id: <20260317181705.2456271-3-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260317181705.2456271-1-yeoreum.yun@arm.com> References: <20260317181705.2456271-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current ETM3x configuration via sysfs can lead to the following inconsistencies: - If a configuration is modified via sysfs while a perf session is active, the running configuration may differ between before a sched-out and after a subsequent sched-in. To resolve these inconsistencies, the configuration should be separated int= o: - active_config, which represents the currently applied configuration - config, which stores the settings configured via sysfs. Signed-off-by: Yeoreum Yun --- drivers/hwtracing/coresight/coresight-etm.h | 2 ++ drivers/hwtracing/coresight/coresight-etm3x-core.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm.h b/drivers/hwtracin= g/coresight/coresight-etm.h index 1d753cca2943..d94adb08a235 100644 --- a/drivers/hwtracing/coresight/coresight-etm.h +++ b/drivers/hwtracing/coresight/coresight-etm.h @@ -226,6 +226,7 @@ struct etm_config { * @etmccr: value of register ETMCCR. * @etmccer: value of register ETMCCER. * @traceid: value of the current ID for this component. + * @active_config: structure holding current running configuration paramet= ers. * @config: structure holding configuration parameters. */ struct etm_drvdata { @@ -248,6 +249,7 @@ struct etm_drvdata { u32 etmccr; u32 etmccer; u32 traceid; + struct etm_config active_config; struct etm_config config; }; =20 diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/h= wtracing/coresight/coresight-etm3x-core.c index a547a6d2e0bd..30390ec38762 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -308,7 +308,7 @@ void etm_config_trace_mode(struct etm_config *config) static int etm_parse_event_config(struct etm_drvdata *drvdata, struct perf_event *event) { - struct etm_config *config =3D &drvdata->config; + struct etm_config *config =3D &drvdata->active_config; struct perf_event_attr *attr =3D &event->attr; u8 ts_level; =20 @@ -367,7 +367,7 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) { int i, rc; u32 etmcr; - struct etm_config *config =3D &drvdata->config; + struct etm_config *config =3D &drvdata->active_config; struct coresight_device *csdev =3D drvdata->csdev; =20 CS_UNLOCK(drvdata->csa.base); @@ -513,6 +513,8 @@ static int etm_enable_sysfs(struct coresight_device *cs= dev, struct coresight_pat =20 spin_lock(&drvdata->spinlock); =20 + drvdata->active_config =3D drvdata->config; + drvdata->traceid =3D path->trace_id; =20 /* @@ -563,7 +565,7 @@ static int etm_enable(struct coresight_device *csdev, s= truct perf_event *event, static void etm_disable_hw(struct etm_drvdata *drvdata) { int i; - struct etm_config *config =3D &drvdata->config; + struct etm_config *config =3D &drvdata->active_config; struct coresight_device *csdev =3D drvdata->csdev; =20 CS_UNLOCK(drvdata->csa.base); @@ -877,7 +879,8 @@ static int etm_probe(struct amba_device *adev, const st= ruct amba_id *id) if (etm_arch_supported(drvdata->arch) =3D=3D false) return -EINVAL; =20 - etm_set_default(&drvdata->config); + etm_set_default(&drvdata->active_config); + drvdata->config =3D drvdata->active_config; =20 pdata =3D coresight_get_platform_data(dev); if (IS_ERR(pdata)) --=20 LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}