Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, suzuki.poulose@arm.com,
	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: Mon, 6 Jul 2026 18:21:59 +0100	[thread overview]
Message-ID: <20260706172159.GA1024232@e132581.arm.com> (raw)
In-Reply-To: <20260629090007.1718746-9-yeoreum.yun@arm.com>

On Mon, Jun 29, 2026 at 10:00:01AM +0100, Yeoreum Yun wrote:

[...]

> @@ -619,27 +622,52 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
>  static void etm4_enable_sysfs_smp_call(void *info)
>  {
>  	struct etm4_enable_arg *arg = info;
> +	struct etmv4_drvdata *drvdata;
>  	struct coresight_device *csdev;
> +	unsigned long cfg_hash;
> +	int preset;
>  
>  	if (WARN_ON(!arg))
>  		return;
>  
> -	csdev = arg->drvdata->csdev;
> +	drvdata = arg->drvdata;
> +	csdev = drvdata->csdev;
>  	if (!coresight_take_mode(csdev, CS_MODE_SYSFS)) {
>  		/* Someone is already using the tracer */
>  		arg->rc = -EBUSY;
>  		return;
>  	}
>  
> -	arg->rc = etm4_enable_hw(arg->drvdata);
> +	drvdata->active_config = arg->config;
>  
> -	/* The tracer didn't start */
> +	/* enable any config activated by configfs */
> +	cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset);
> +	if (cfg_hash) {
> +		arg->rc = cscfg_csdev_enable_active_config(csdev,
> +							   cfg_hash,
> +							   preset);
> +		if (arg->rc)
> +			goto err;
> +	}


I try best to not paste any non-sense AI reviews, record one from
Sashiko [1]:

 | If a user writes to a sysfs attribute like pe_sel_store(), it acquires
 | drvdata->spinlock without disabling interrupts. If an IPI is then handled
 | on the same CPU, etm4_enable_sysfs_smp_call() will call
 | cscfg_csdev_enable_active_config() which attempts to acquire the exact
 | same spinlock, hanging the CPU."

The flow for acquiring drvdata->spinlock in SMP call is:

  etm4_enable_sysfs_smp_call()
    `> cscfg_csdev_enable_active_config()
         `> cscfg_csdev_enable_config()
              `> cscfg_prog_config()
                   `> cscfg_set_on_enable()
                        `> raw_spin_lock_irqsave(feat_csdev->drv_spinlock, flags);

We might expect the complaint from LOCKDEP with this patch.

To be clear, I am not object to this patch, just record in case we will
handle it later.

[1] https://sashiko.dev/#/patchset/20260629090007.1718746-1-yeoreum.yun%40arm.com


  reply	other threads:[~2026-07-06 17:22 UTC|newest]

Thread overview: 20+ 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 [this message]
2026-07-06 18:16     ` Yeoreum Yun
2026-07-07  8:25       ` Leo Yan
2026-07-06 17:39   ` Leo Yan
2026-07-06 18:20     ` Yeoreum Yun
2026-07-07  8:07       ` Leo Yan
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

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=20260706172159.GA1024232@e132581.arm.com \
    --to=leo.yan@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=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@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