From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45BD233A9F0 for ; Mon, 26 Jan 2026 13:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769435563; cv=none; b=stZSwHkkSSKtmabrtiYtJz9k16J3brpADFq1cH2XgMihJWWNxpWlDZlUbYD3oHNtCHEVS8mxtSXZTcXF1t7nRvfwBFOC5u2mEDNIY2PTVDJ5fUTZ8prcztctx6MxRkgaqYzlFm0fu1MzSL9eR7ipGVHBLgoVHn3KFCq8ghN8Dys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769435563; c=relaxed/simple; bh=Y1NXaf32gHmr2kWu+/1/YxkPBRXru1mSnHmgY8ud1u8=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=OEMFv/26MnhkwuMgLFet0FO9JN/l707hgKsKQuKEpHFmLnEZNhyu2dyNdgHv2xBJTHh0iC4ZxpSO8SITMf/jx7WSi6HA73/aKQyYmDx4azWDmC9kRf3PHqKh/2aphhPjMdDbFix3jHTdki2bYuEplb+v/qHRm7f2LkkZs2MOwjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96E98339; Mon, 26 Jan 2026 05:52:32 -0800 (PST) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 600833F632; Mon, 26 Jan 2026 05:52:37 -0800 (PST) From: Leo Yan Subject: [PATCH v2 0/8] coresight: Fix device registration and unregistration Date: Mon, 26 Jan 2026 13:52:00 +0000 Message-Id: <20260126-arm_coresight_refactor_dev_register-v2-0-b5a3c0441c15@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAIFxd2kC/x3NQQqDMBCF4avIrA0kQQLtVYqEmIxxFjVlJogg3 t2hyw9+3rtAkAkF3sMFjAcJtV3hxwHylvaKhooavPXBOm9N4m/MjVGobj0yrin3xrHgoagkHdm sLmQbXmWZXAFd+mlG5//lM9/3A/WsWqZ1AAAA X-Change-ID: 20260120-arm_coresight_refactor_dev_register-f16c069db41d To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Greg Kroah-Hartman , Mathieu Poirier , Mao Jinlong Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769435557; l=2538; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=Y1NXaf32gHmr2kWu+/1/YxkPBRXru1mSnHmgY8ud1u8=; b=9jqClqgA0AiIgyFMF1igYh2DP+FazynwRdAM6nhY1hVk2NjECfw3mAUHmilV/Qrh85ptp539q BGGEetpeQNTBjCi/YaD6anoQG1q01an6o0gDNqM3qHGZ0c1kgj79ea0 X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= This series is to fix and refactor CoreSight device registration and unregistration, it can be divided into three small parts: Patches 01-03: Three fixes for memory leak, device reference and mutex protection. Patches 04-05: Move connection cleanup operations into coresight_remove_conns(). Patches 06-08: Refactor error handling in coresight_register(). This series is verified on Juno board with kmemleak detector. For kmemleak verifying: echo clear > /sys/kernel/debug/kmemleak insmod coresight modules rmmod coresight modules echo scan > /sys/kernel/debug/kmemleak The result shows no memory leak during a cycle of device registration and unregistration. --- Changes in v2: - Refined the commit log in patch 06 (Suzuki). - Unified to call coresight_unregister() for error handling (Suzuki). - Refactor connection and sysfs group release. - Link to v1: https://lore.kernel.org/linux-arm-kernel/20250512154108.23920-1-leo.yan@arm.com/ To: Suzuki K Poulose To: Mike Leach To: James Clark To: Alexander Shishkin To: Greg Kroah-Hartman To: Mathieu Poirier To: Mao Jinlong Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Leo Yan --- Leo Yan (8): coresight: Fix memory leak in coresight_alloc_device_name() coresight: Get parent device reference after sink ID map allocation coresight: Protect unregistration with mutex coresight: Refactor output connection sysfs link cleanup coresight: Refactor sysfs connection group cleanup coresight: Move sink validation into etm_perf_add_symlink_sink() coresight: Do not mix success path with failure handling coresight: Unify error handling in coresight_register() drivers/hwtracing/coresight/coresight-core.c | 105 +++++++++++------------ drivers/hwtracing/coresight/coresight-etm-perf.c | 5 +- drivers/hwtracing/coresight/coresight-platform.c | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 3 +- 4 files changed, 56 insertions(+), 59 deletions(-) --- base-commit: eebe8dbd8630f51cf70b1f68a440cd3d7f7a914d change-id: 20260120-arm_coresight_refactor_dev_register-f16c069db41d Best regards, -- Leo Yan