From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A7C5450F2 for ; Fri, 17 Apr 2026 01:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776387686; cv=none; b=aowfIHBgkU9+W0oxXvCHjJVKozSrapzwQ119yMgW6pDILKqt/P9Tnxmk+hu4Uz0e3/PMjGFq6eyquEGUGl2ULiIhLBzID9LK+3LnzkLLN0lAp/T3UkPOCh/aUgcKSwrEvSdLytHK9Bbu/erGJo5Cii8wFSsIob/uc/nrZT+PdYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776387686; c=relaxed/simple; bh=I7Fw2Qb4RAQNFX8mlERn40HA8awKIaCZ8GeyZRhHPTY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=l4m0G3AuBaebcJ3NvvKAVb03cwF37OdExMlVFdAZU6Ji1aC7hfTqSMwfpp8k+9ffQzBeIC5GVxS1NzDHukEJopbTt19jfUB4jDRloInNsPu4tddZR/VzbZ0joDcyzEFljfM9xZTN0MzWvZb0tm+TD0YXVQ/o30l2ybTia2VgNYk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=YkdTYqXZ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Zr9HOfmE; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="YkdTYqXZ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Zr9HOfmE" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63H0h43A614575 for ; Fri, 17 Apr 2026 01:01:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= d/u9RhBo3JBBNTyMzBllN+ZTtf/E9vfpiyWfUGP0fBo=; b=YkdTYqXZoMXU3R/h dEbZ8WUDAWXiOYmRoeiismBDOWfoWvlEVi8g1LC+mGRMbhkmG57zV3mNR4MLobCF o4hdaTy2S0XIu6pyjYKajLIxALQ0ZkVGqEpr77jGEL87vTVZJM/uBzB55zMlS3+n TN0lDoQGhkqU+fouSwQsu4Xzd+tjRMBRt6tCdD1LkgprZMY6FPtOJ18ZzDr0uSwh SG/lxRTv549ImYyE51S9N8Ad14TNd08bhFSK7t7d3Ni5h9g6ofa6hyBZJ7PF1kB8 mM+XUYihLGcjb3Yps3Ec1UbOkPnZVrlUfa/6dRH8TD8vMTitGifezXYh+iyAarQd bONhPQ== Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djv27kcjt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 17 Apr 2026 01:01:23 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-c76c6280732so243961a12.0 for ; Thu, 16 Apr 2026 18:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776387683; x=1776992483; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=d/u9RhBo3JBBNTyMzBllN+ZTtf/E9vfpiyWfUGP0fBo=; b=Zr9HOfmEREpUs9367D6EgOYpH58huMVrJNcz8znmcJUuahU3dwQHzGefo4/NYG3Dv0 mbsMJebk09xYVMdVrmdvLEEJx1VKnAbpu9tmAyccnXXo2VPZq4VfTHdxSjlDXR+mFENE CmBPlY/DtZMTVbCl+fbVXWBu6Tuq7eV4LbP3yBMuu7f1C55FRYbTOGcFDVKY6MDZQjoU ajeVz+LYC3dkZwUc092k01id3EH59a6YEVJY47CzZ/hDg+dFqEzIjLMItc78lM6p07on CRDEnQY0NjVeUGPRnbEWr5eej2NMk2ysfVkh+5D69e2SgURBipEaUcg9oDLZRbimcuqu ZhHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776387683; x=1776992483; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d/u9RhBo3JBBNTyMzBllN+ZTtf/E9vfpiyWfUGP0fBo=; b=JGXzpQ/wv1p5LayO9SwycXW2AKu75oYqow6cJk1z2JJ1qME1yU87AVuyUGimJ3xeiE mPVjMW88uz6Ku2MC8/enJyQvKH2gG4aKdJptUZ0nUeS6wKgY/QSVquafgiSh9KX8FEqm 3cb6lIGt4wJxb7s0CIwUmZ6F7+LMjtsyhMxB8FF6hly+KOYFLpnybJ4/8+az9kSukVpD v2UCt+15eAIib953qZnkg38gs3+3TpfrNFdW6im9V8TksROHPb6oTfcjVaKvYM0vDb96 oHNgGQxrva7at9REMTEIzPlR9/Nzr8/M9lLh4XcQE1Ex/kEB+KA+cL7IEb2D663HdGvl y4iw== X-Forwarded-Encrypted: i=1; AFNElJ8HSBJEv0n3pHv1kdgQLXjnBkePQaN2hFP8EIBiT0NqzoZf9jCiN3HXyHZMhUsN/Gk0C6kf4CEHlZ+NNcY=@vger.kernel.org X-Gm-Message-State: AOJu0Ywx6HBdjAyAfgL+cIuvbmGiAGdbj0+FYZNxQjnIoG+AoBO2pIq8 JGtvoldKLPpGpyJ5msxu+THGI4qPyDaJEUvnWxbtpQsb3BGwcqiLxkFSR0ecCWANCKoyXSwKylb qfaK0rK8WhzoBTneswAYre9OD2eEoMjVAAEXBIPovRa30n7A/BSYKDNSY4NIpSpQ/6Ng= X-Gm-Gg: AeBDiesYsEHFJyZsNB18ZPeNIIvsWeUS3rPHm3my0hOudfFYi+10bLyyfYDrnILKdxR 9i4+h24VKptNTDqB/pG0FWyk/ljQCaArO54VUYw8MLSQj8qg9vW8dsS76NTDUNqXSwROFgamY/y pKJS95rQoKOn1FhgbC23N5b2Cj8js4qZ4TBynSDpFl1ueh4j4//2ssaI/3o3qVJ78qaIHnFBaWL TeLL1x/MNXPWNcWcausWqDxex7rajV9YNhk+5vRpXHNsjwV6RM1iKwMoMHVt4NjBJWyvshVl2ED Bijpgcz5X+7STx8zJPYaEXiR9Yl6VGuroTjeeDUwBLCKIQ69Lzhh9fzMAPgiBr/P3lxZonuMf2Z QsNT2FpPQxW/9P/DZAldPf6FdS+whnSG0pLaECkzmP/zw3LDw4Qv7+J6feamvZ40gIqhUA6lAIa jTLw5NgQo+4dWAmH/e60HdHA== X-Received: by 2002:a05:6a20:9185:b0:398:9a90:65ae with SMTP id adf61e73a8af0-3a08d89ae6amr652311637.30.1776387682840; Thu, 16 Apr 2026 18:01:22 -0700 (PDT) X-Received: by 2002:a05:6a20:9185:b0:398:9a90:65ae with SMTP id adf61e73a8af0-3a08d89ae6amr652222637.30.1776387682230; Thu, 16 Apr 2026 18:01:22 -0700 (PDT) Received: from [10.133.33.185] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c7976f8f4e8sm49890a12.1.2026.04.16.18.01.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Apr 2026 18:01:21 -0700 (PDT) Message-ID: Date: Fri, 17 Apr 2026 09:01:17 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 06/12] coresight: etm4x: fix leaked trace id To: Leo Yan , Yeoreum Yun 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 References: <20260415165528.3369607-1-yeoreum.yun@arm.com> <20260415165528.3369607-7-yeoreum.yun@arm.com> <20260416165541.GN356832@e132581.arm.com> Content-Language: en-US From: Jie Gan In-Reply-To: <20260416165541.GN356832@e132581.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=PJQ/P/qC c=1 sm=1 tr=0 ts=69e18663 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=7CQSdrXTAAAA:8 a=g7HzkWLkDZsDcvuO9ksA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-GUID: zs3fPi1rqoGIilbV3kWJ205xMxNO8SGx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE3MDAwOCBTYWx0ZWRfXy2WI3IGqEMR8 1RMip7nfsxuuQIeIp0SyNqZRYVTY+q0F7oPi7fdIUaOZqJivGjgY70lcNKje8soIKNN8bom1Ojh vKwY0oxrAd3pK0MwV8r2po3DruPbTjTWR8wvGvMCLiECTe5zb+HuAdd1Nx/2pTTFQz7U79Gqp/b nK3UdnXDKdciNqD1ovf3jwvW9qjfVzOE/kktlu059u0uk3JFiM2YKSCTv3121CYmoZFNSHpy7+G a+m+k+e2/3jk8ebM2xhUM+OtqlGoG30GqyIeXvHRdySq5yAJqLL6tx481wQ/rgtmTBQ02LUTNWK di9qWCH8mMQ3PC1FXIqRBOv2xZQ89d3ZHBYlliJMdfTukfv5vZvzfGAExLDHiwvqN9AacHpQBNl wHAC2MdR7KBqdGyWfyIAddmM9+a2i6MPy3jTs/2xG2sdvbs25HQZTXeGCG2G1FNOLGVKPkSjsY6 NeX5tZQFq/e9Og+dqRQ== X-Proofpoint-ORIG-GUID: zs3fPi1rqoGIilbV3kWJ205xMxNO8SGx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_04,2026-04-16_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604170008 On 4/17/2026 12:55 AM, Leo Yan wrote: > On Wed, Apr 15, 2026 at 05:55:22PM +0100, Yeoreum Yun wrote: >> If etm4_enable_sysfs() fails in cscfg_csdev_enable_active_config(), >> the trace ID may be leaked because it is not released. >> >> To address this, call etm4_release_trace_id() when etm4_enable_sysfs() >> fails in cscfg_csdev_enable_active_config(). >> >> Reviewed-by: Jie Gan >> Signed-off-by: Yeoreum Yun >> --- >> drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c >> index f55338a4989d..b199aebbdb60 100644 >> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c >> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c >> @@ -920,8 +920,10 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa >> cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset); >> if (cfg_hash) { >> ret = cscfg_csdev_enable_active_config(csdev, cfg_hash, preset); >> - if (ret) >> + if (ret) { >> + etm4_release_trace_id(drvdata); >> return ret; >> + } > > LGTM: > > Reviewed-by: Leo Yan > > Just recording a bit thoughts. As Suzuki mentioned, it would be better > to allocate trace IDs within a session. We might consider maintaining > the trace ID map in the sink driver data, since the sink driver is > unique within a session so it is a central place to allocate trace ID. > > We should use paired way for allocation and release. For example: > > coresight_enable_sysfs() > { > ... > coresight_path_assign_trace_id(path); > > failed: > coresight_path_unassign_trace_id(path); > } > > coresight_disable_sysfs() > { > coresight_path_unassign_trace_id(path); > } > > But this requires broader refactoring. E.g., the STM driver currently > allocates system trace IDs statically during probe, we might need to > consolidate for all modules to use dynamic allocation. Agree. That's making sense. Currently, the trace ID of some devices is allocated during probe, and never to be released. It's kind of waste of our trace ID resource if the device never to be enabled. But we still need support static trace ID allocation in parallel for the dummy sources and we should not break this logic in future refactor. Thanks, Jie > > Thanks, > Leo