All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yeoreum Yun <yeoreum.yun@arm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Yeoreum Yun <yeoreum.yun@arm.com>,
	linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 2/8] coresight: etm3x: fix inconsistencies with sysfs configuration
Date: Fri, 11 Sep 2026 12:28:35 +0100	[thread overview]
Message-ID: <aqPl47W4bk4lsXMw@e129823.arm.com> (raw)
In-Reply-To: <20260911110729.EBCCD1F000FF@smtp.kernel.org>

On Fri, Sep 11, 2026 at 11:07:29AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Sysfs interface for post-trace hardware state returns stale data due to active_config separation (ABI Breakage).
> --
> 
> commit 729c4f4f776d1cbadf2571ee6a6363ece19f7a91
> Author: Yeoreum Yun <yeoreum.yun@arm.com>
> 
> coresight: etm3x: fix inconsistencies with sysfs configuration
> 
> This commit resolves sysfs configuration inconsistencies by separating the
> configuration state into an active_config (for the current session) and config
> (the configuration set via sysfs).
> 
> > diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> > --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
> > +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> 
> [ ... ]
> 
> > @@ -565,7 +569,7 @@ static int etm_enable(struct coresight_device *csdev, struct perf_event *event,
> >  static void etm_disable_hw(struct etm_drvdata *drvdata)
> >  {
> >  	int i;
> > -	struct etm_config *config = &drvdata->config;
> > +	struct etm_config *config = &drvdata->active_config;
> >  	struct coresight_device *csdev = drvdata->csdev;
> >  
> >  	CS_UNLOCK(drvdata->csa.base);
> 
> [Severity: High]
> Does this introduce a regression in the sysfs interface for post-trace
> hardware state analysis?
> 
> By switching to active_config here, the post-trace sequencer and counter
> states are saved into drvdata->active_config during etm_disable_hw():
> 
> drivers/hwtracing/coresight/coresight-etm3x-core.c:etm_disable_hw() {
> 	...
> 	/* Read back sequencer and counters for post trace analysis */
> 	config->seq_curr_state = (etm_readl(drvdata, ETMSQR) & ETM_SQR_MASK);
> 
> 	for (i = 0; i < caps->nr_cntr; i++)
> 		config->cntr_val[i] = etm_readl(drvdata, ETMCNTVRn(i));
> 	...
> }
> 
> However, when tracing is disabled, userspace reads from the sysfs interface
> which still returns data from the stale drvdata->config:
> 
> drivers/hwtracing/coresight/coresight-etm3x-sysfs.c:seq_curr_state_show() {
> 	...
> 	val = config->seq_curr_state;
> 	...
> }
> 
> Will this cause sysfs reads for seq_curr_state and cntr_val to return
> stale or zeroed data instead of the actual hardware state?
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260911-separate_etm_cfg_v2-v10-0-1b715d95927a@arm.com?part=2

This seems valid review and I think the cntr_val and seq_current_state
shouldn't be modified via sysfs while the mode is taken by sysfs.

I'll fix this in later version for etm4 and etm3.

-- 
Sincerely,
Yeoreum Yun

  reply	other threads:[~2026-09-11 11:28 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
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 [this message]
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=aqPl47W4bk4lsXMw@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.