mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Leo Yan <leo.yan@arm.com>, Yeoreum Yun <yeoreum.yun@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, mike.leach@arm.com,
	james.clark@linaro.org, alexander.shishkin@linux.intel.com,
	jie.gan@oss.qualcomm.com
Subject: Re: [PATCH v8 08/13] coresight: etm4x: fix inconsistencies with sysfs configuration
Date: Thu, 16 Jul 2026 13:41:19 +0100	[thread overview]
Message-ID: <2005044a-ff4d-4585-963b-1c346d661a35@arm.com> (raw)
In-Reply-To: <20260706173940.GB1024232@e132581.arm.com>

On 06/07/2026 18:39, Leo Yan wrote:
> On Mon, Jun 29, 2026 at 10:00:01AM +0100, Yeoreum Yun wrote:
> 
> [...]
> 
>> @@ -922,25 +950,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa
>>   {
>>   	struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
>>   	struct etm4_enable_arg arg = { };
>> -	unsigned long cfg_hash;
>> -	int ret, preset;
>> -
>> -	/* enable any config activated by configfs */
>> -	cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset);
>> -	if (cfg_hash) {
>> -		ret = cscfg_csdev_enable_active_config(csdev, cfg_hash, preset);
>> -		if (ret) {
>> -			etm4_release_trace_id(drvdata);
>> -			return ret;
>> -		}
>> -	}
>> -
>> -	raw_spin_lock(&drvdata->spinlock);
>> -
>> -	drvdata->trcid = path->trace_id;
>> -
>> -	/* Tracer will never be paused in sysfs mode */
>> -	drvdata->paused = false;
>> +	int ret;
>>   
>>   	/*
>>   	 * Executing etm4_enable_hw on the cpu whose ETM is being enabled
>> @@ -948,20 +958,20 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa
>>   	 */
>>   	arg.drvdata = drvdata;
>>   	arg.path = path;
>> +
>> +	raw_spin_lock(&drvdata->spinlock);
>> +	arg.config = drvdata->config;
>> +	raw_spin_unlock(&drvdata->spinlock);
>> +
>>   	ret = smp_call_function_single(drvdata->cpu,
>>   				       etm4_enable_sysfs_smp_call, &arg, 1);
>>   	if (!ret)
>>   		ret = arg.rc;
>>   	if (!ret)
>> -		drvdata->sticky_enable = true;
>> -
>> -	if (ret)
>> +		dev_dbg(&csdev->dev, "ETM tracing enabled\n");
>> +	else
>>   		etm4_release_trace_id(drvdata);
>>   
>> -	raw_spin_unlock(&drvdata->spinlock);
>> -
>> -	if (!ret)
>> -		dev_dbg(&csdev->dev, "ETM tracing enabled\n");
>>   	return ret;
>>   }
> 
> This is most valuable change for me, as now we will have much clear
> scope for what is protected ("drvdata->config").
> 
> However, a corner case was mentioned by Sashiko:
> 
>   | It appears etm4_enable_hw() modifies drvdata->ss_status while executing
>   | via IPI, but sshot_ctrl_store() can modify the same array concurrently

Could we stop modifying the drvdata->ss_status in enable_hw() ? We moved
it outside the config claiming that the status is not used(or useful). #
Then why not remove the updating from enable_hw()

Suzuki


>   | from process context since the lock is no longer held across the
>   | smp_call_function_single() call.
> 
> "drvdata->ss_status" is a race condition between SMP call and sysfs
> knobs. Should we change to spinlock_irqsave/irqrestore when access
> drvdata->ss_status?
> 
> Thanks,
> Leo


  parent reply	other threads:[~2026-07-16 12:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  8:59 [PATCH v8 00/13] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 01/13] coresight: etm4x: fix wrong check of etm4x_sspcicrn_present() Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 02/13] coresight: etm4x: fix underflow for usage of (nrseqstate - 1) Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 03/13] coresight: etm4x: introduce struct etm4_caps Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 04/13] coresight: etm4x: exclude ss_status from drvdata->config Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 05/13] coresight: etm4x: remove s_ex_level from config Yeoreum Yun
2026-06-29  8:59 ` [PATCH v8 06/13] coresight: etm4x: remove redundant fields in etmv4_save_state Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 07/13] coresight: etm4x: fix leaked trace id Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 08/13] coresight: etm4x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-07-06 17:21   ` Leo Yan
2026-07-06 18:16     ` Yeoreum Yun
2026-07-07  8:25       ` Leo Yan
2026-07-07  8:59         ` Yeoreum Yun
2026-07-07  9:54           ` Yeoreum Yun
2026-07-16 12:42             ` Suzuki K Poulose
2026-07-06 17:39   ` Leo Yan
2026-07-06 18:20     ` Yeoreum Yun
2026-07-07  8:07       ` Leo Yan
2026-07-16 12:41     ` Suzuki K Poulose [this message]
2026-07-16 20:09       ` Yeoreum Yun
2026-07-22 20:04         ` Yeoreum Yun
2026-07-16 12:46   ` Suzuki K Poulose
2026-07-16 19:57     ` Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 09/13] coresight: etm4x: missing cscfg_csdev_disable_active_config() in perf enable Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 10/13] coresight: etm3x: change drvdata->spinlock type to raw_spin_lock_t Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 11/13] coresight: etm3x: introduce struct etm_caps Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 12/13] coresight: etm3x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-06-29  9:00 ` [PATCH v8 13/13] coresight: etm3x: remove redundant cpu online check on etm_enable_sysfs() Yeoreum Yun
2026-07-16 12:48 ` [PATCH v8 00/13] fix several inconsistencies with sysfs configuration in etmX Suzuki K Poulose
2026-07-16 19:24   ` Yeoreum Yun
2026-07-16 20:11     ` 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=2005044a-ff4d-4585-963b-1c346d661a35@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=jie.gan@oss.qualcomm.com \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=yeoreum.yun@arm.com \
    /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®