Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yeoreum Yun <yeoreum.yun@arm.com>
To: Leo Yan <leo.yan@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>,
	James Clark <james.clark@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>, Yabin Cui <yabinc@google.com>,
	Keita Morisaki <keyz@google.com>,
	Jie Gan <jie.gan@oss.qualcomm.com>,
	Yuanfang Zhang <quic_yuanfang@quicinc.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Tamas Petz <tamas.petz@arm.com>,
	Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v14 01/28] coresight: Fix source not disabled on idr_alloc_u32 failure
Date: Sat, 16 May 2026 09:57:07 +0100	[thread overview]
Message-ID: <aggxY66eLG//jVH7@e129823.arm.com> (raw)
In-Reply-To: <20260515-arm_coresight_path_power_management_improvement-v14-1-f88c4a3ecfe9@arm.com>

LGTM.

Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>

On Fri, May 15, 2026 at 09:08:08PM +0100, Leo Yan wrote:
> From: Jie Gan <jie.gan@oss.qualcomm.com>
> 
> In coresight_enable_sysfs(), for non-CPU sources (SOFTWARE, TPDM,
> OTHERS), the source device is enabled via coresight_enable_source_sysfs()
> before idr_alloc_u32() maps the path. If idr_alloc_u32() fails, the
> original code jumped directly to err_source, which only calls
> coresight_disable_path() and coresight_release_path(). The source device
> was left enabled with an incremented refcnt but no path tracked for it,
> leaving the device in an inconsistent state.
> 
> Disable the source before jumping to err_source so the enable and path
> operations are fully unwound.
> 
> Fixes: 5c0016d7b343 ("coresight: core: Use IDR for non-cpu bound sources' paths.")
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
> ---
>  drivers/hwtracing/coresight/coresight-sysfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
> index b6a870399e83419dce0552099562fa3ae7b2bd69..da6f22b512c92ab0cff5bb239495a1ab6d2a0dbe 100644
> --- a/drivers/hwtracing/coresight/coresight-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-sysfs.c
> @@ -244,8 +244,10 @@ int coresight_enable_sysfs(struct coresight_device *csdev)
>  		 */
>  		hash = hashlen_hash(hashlen_string(NULL, dev_name(&csdev->dev)));
>  		ret = idr_alloc_u32(&path_idr, path, &hash, hash, GFP_KERNEL);
> -		if (ret)
> +		if (ret) {
> +			coresight_disable_source_sysfs(csdev, NULL);
>  			goto err_source;
> +		}
>  		break;
>  	default:
>  		/* We can't be here */
> 
> -- 
> 2.34.1
> 

-- 
Sincerely,
Yeoreum Yun


  reply	other threads:[~2026-05-16  8:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 20:08 [PATCH v14 00/28] CoreSight: Refactor power management for CoreSight path Leo Yan
2026-05-15 20:08 ` [PATCH v14 01/28] coresight: Fix source not disabled on idr_alloc_u32 failure Leo Yan
2026-05-16  8:57   ` Yeoreum Yun [this message]
2026-05-15 20:08 ` [PATCH v14 02/28] coresight: Handle helper enable failure properly Leo Yan
2026-05-15 20:08 ` [PATCH v14 03/28] coresight: Extract device init into coresight_init_device() Leo Yan
2026-05-15 20:08 ` [PATCH v14 04/28] coresight: Populate CPU ID into coresight_device Leo Yan
2026-05-15 20:08 ` [PATCH v14 05/28] coresight: Remove .cpu_id() callback from source ops Leo Yan
2026-05-15 20:08 ` [PATCH v14 06/28] coresight: Take hotplug lock in enable_source_store() for Sysfs mode Leo Yan
2026-05-15 20:08 ` [PATCH v14 07/28] coresight: perf: Retrieve path and source from event data Leo Yan
2026-05-15 20:08 ` [PATCH v14 08/28] coresight: Take a reference on csdev Leo Yan
2026-05-15 20:08 ` [PATCH v14 09/28] coresight: Move per-CPU source pointer to core layer Leo Yan
2026-05-15 20:08 ` [PATCH v14 10/28] coresight: Take per-CPU source reference during AUX setup Leo Yan
2026-05-15 20:08 ` [PATCH v14 11/28] coresight: Register CPU PM notifier in core layer Leo Yan
2026-05-15 20:08 ` [PATCH v14 12/28] coresight: etm4x: Hook CPU PM callbacks Leo Yan
2026-05-15 20:08 ` [PATCH v14 13/28] coresight: etm4x: Remove redundant checks in PM save and restore Leo Yan
2026-05-15 20:08 ` [PATCH v14 14/28] coresight: syscfg: Use IRQ-safe spinlock to protect active variables Leo Yan
2026-05-15 20:08 ` [PATCH v14 15/28] coresight: Disable source helpers in coresight_disable_path() Leo Yan
2026-05-15 20:08 ` [PATCH v14 16/28] coresight: Control path with range Leo Yan
2026-05-15 20:08 ` [PATCH v14 17/28] coresight: Use helpers to fetch first and last nodes Leo Yan
2026-05-15 20:08 ` [PATCH v14 18/28] coresight: Introduce coresight_enable_source() helper Leo Yan
2026-05-15 20:08 ` [PATCH v14 19/28] coresight: Save active path for system tracers Leo Yan
2026-05-15 20:08 ` [PATCH v14 20/28] coresight: etm4x: Set active path on target CPU Leo Yan
2026-05-15 20:08 ` [PATCH v14 21/28] coresight: etm3x: " Leo Yan
2026-05-15 20:08 ` [PATCH v14 22/28] coresight: sysfs: Use source's path pointer for path control Leo Yan
2026-05-15 20:08 ` [PATCH v14 23/28] coresight: Control path during CPU idle Leo Yan
2026-05-15 20:08 ` [PATCH v14 24/28] coresight: Add PM callbacks for sink device Leo Yan
2026-05-15 20:08 ` [PATCH v14 25/28] coresight: trbe: Save and restore state across CPU low power state Leo Yan
2026-05-15 20:08 ` [PATCH v14 26/28] coresight: sysfs: Increment refcount only for software source Leo Yan
2026-05-15 20:08 ` [PATCH v14 27/28] coresight: Move CPU hotplug callbacks to core layer Leo Yan
2026-05-15 20:08 ` [PATCH v14 28/28] coresight: sysfs: Validate CPU online status for per-CPU sources Leo Yan

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=aggxY66eLG//jVH7@e129823.arm.com \
    --to=yeoreum.yun@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.clark@linaro.org \
    --cc=jie.gan@oss.qualcomm.com \
    --cc=keyz@google.com \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@arm.com \
    --cc=peterz@infradead.org \
    --cc=quic_yuanfang@quicinc.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tamas.petz@arm.com \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=yabinc@google.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