From: Yeoreum Yun <yeoreum.yun@arm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Yeoreum Yun <yeoreum.yun@arm.com>,
linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v10 1/8] coresight: etm4x: fix inconsistencies with sysfs configuration
Date: Fri, 11 Sep 2026 12:29:20 +0100 [thread overview]
Message-ID: <aqPmEPRDUFE1hNXM@e129823.arm.com> (raw)
In-Reply-To: <20260911112144.8EC3F1F000FF@smtp.kernel.org>
On Fri, Sep 11, 2026 at 11:21:44AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Hardware counter values (`cntr_val`) read back during trace disable are saved to the temporary runtime `active_config` instead of the sysfs-visible `config` structure, permanently losing the post-session hardware state.
> --
>
> commit 293039b149bb540c924b83cd181604cbff99de4c
> Author: Yeoreum Yun <yeoreum.yun@arm.com>
>
> coresight: etm4x: fix inconsistencies with sysfs configuration
>
> This commit addresses inconsistencies in ETM4x sysfs configuration by
> separating the configuration into an active_config for the current session
> and a config for sysfs. It updates the enable/disable paths to use the
> active session configuration to prevent corruption from concurrent access.
>
> > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>
> [ ... ]
>
> > @@ -1044,7 +1054,7 @@ static void etm4_disable_trace_unit(struct etmv4_drvdata *drvdata)
> > static void etm4_disable_hw(struct etmv4_drvdata *drvdata)
> > {
> > u32 control;
> > - struct etmv4_config *config = &drvdata->config;
> > + struct etmv4_config *config = &drvdata->active_config;
> > struct coresight_device *csdev = drvdata->csdev;
> > struct csdev_access *csa = &csdev->access;
> > int i;
>
> [Severity: High]
> Does this change cause the post-session hardware counter values to be lost?
>
> Later in etm4_disable_hw(), the hardware counter values are read back from
> the device:
>
> /* read back the current counter values */
> for (i = 0; i < caps->nr_cntr; i++) {
> config->cntr_val[i] =
> etm4x_relaxed_read32(csa, TRCCNTVRn(i));
> }
>
> Because config now points to drvdata->active_config, the updated counter
> values are saved to the temporary active session configuration instead of
> the primary sysfs configuration.
>
> When a user subsequently reads the counter value via the sysfs interface
> in cntr_val_show():
>
> struct etmv4_config *config = &drvdata->config;
> ...
> val = config->cntr_val[idx];
>
> they will read from the static drvdata->config, which never receives these
> read-back values and will instead return the initial configuration value.
> Should the read-back hardware state be synchronized back to drvdata->config
> when the trace is disabled?
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260911-separate_etm_cfg_v2-v10-0-1b715d95927a@arm.com?part=1
The same for etm3. I'll fix it in next round.
--
Sincerely,
Yeoreum Yun
next prev parent reply other threads:[~2026-09-11 11:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 10:55 [PATCH v10 0/8] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 1/8] coresight: etm4x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-09-11 11:21 ` sashiko-bot
2026-09-11 11:29 ` Yeoreum Yun [this message]
2026-09-11 10:56 ` [PATCH v10 2/8] coresight: etm3x: " Yeoreum Yun
2026-09-11 11:07 ` sashiko-bot
2026-09-11 11:28 ` Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 3/8] coresight: etm3x: change drvdata->spinlock type to raw_spin_lock_t Yeoreum Yun
2026-09-11 11:17 ` sashiko-bot
2026-09-11 11:52 ` Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 4/8] coresight: etm3x: remove redundant cpu online check on etm_enable_sysfs() Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 5/8] coresight: etm4x: introduce struct etm4_caps Yeoreum Yun
2026-09-11 11:20 ` sashiko-bot
2026-09-11 11:31 ` Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 6/8] coresight: etm4x: exclude ss_status from drvdata->config Yeoreum Yun
2026-09-11 11:12 ` sashiko-bot
2026-09-11 10:56 ` [PATCH v10 7/8] coresight: etm4x: remove s_ex_level from config Yeoreum Yun
2026-09-11 10:56 ` [PATCH v10 8/8] coresight: etm3x: introduce struct etm_caps Yeoreum Yun
2026-09-11 11:20 ` sashiko-bot
2026-09-11 11:42 ` Yeoreum Yun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqPmEPRDUFE1hNXM@e129823.arm.com \
--to=yeoreum.yun@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®