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 B9AAC3BE644 for ; Mon, 11 May 2026 09:42:27 +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=1778492549; cv=none; b=SyDiyLvWonnV+5n/+t/Gl/ZXloiXixafC+TKEk3D0ZY5yH076XueC7phuDuMSuZqKsHk3slxNLdIGScq91hXtbjAj6wGpIp7KBzs+ZzMi5aZqkvDHy3yH9elld+3RgYtuY0bUajzPjSy76mTyY5FaOZbv+juck9nnkpA6I1E2+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778492549; c=relaxed/simple; bh=V1dcBAMYtFGLmHO7qtADvUxt9Jq0szt9XOEXlJB+eLA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mmIFfAc0cesJqmXlen0YW1q3Mg5h0fUdvZlWsBxghUxWJ2tS6Ta6apJW94/1GggWebyKAMrAYq/QUjmW0VsFmptk7uGYX3zhGi0tK/hVUPWJLspenUI0jhoXudlJJbGCQVXE4yqBcHw7mVt7mDV2MJq4GF8Xz0cL8DMUzLNkvKM= 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=EdmgKMwF; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Jm+J8gUE; 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="EdmgKMwF"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Jm+J8gUE" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64B98aXd017281 for ; Mon, 11 May 2026 09:42:26 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= PB0b00HDdMyvLcXnO50+iokdfpNKZLgAgDT0mhyx+3E=; b=EdmgKMwFn9OWhJsJ 5qdsZeJCW0ORnI0ra7GxFisJIkaIq1KagkzRWZ5kd9QL9vRIn5FA8NaS6KWvyRL7 mFO13HMVbm5cBrQOpgiFmUlfwmH21Rv916ETyF9aQCErQicKnhKgdzDAX6c41426 pm/uHGGR40JLW1aeZDNLY8SBJ9hIhBmp5xGXaElafpaHqkjsANEevJLGixTotCJJ 29otELySEstNPPejITm3nhNjFiy5IvTzrJZS7JH918xzY7kZmVQq7G8lq+F0tVrV yFcHRvwpGc816NdQFS8kNiOe8Y9trJt60SXOjoDMvAfxn4ERkVY51e2jqQl9pSn5 M5CwUg== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e37xfs4bs-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 11 May 2026 09:42:26 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c709551ec08so5050402a12.3 for ; Mon, 11 May 2026 02:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778492545; x=1779097345; 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=PB0b00HDdMyvLcXnO50+iokdfpNKZLgAgDT0mhyx+3E=; b=Jm+J8gUE1I/OjzWafW6N71lhWC6FssqSBscbYhz+TfUD+BMOWgg1JCqgXTyjCBAnbU 1YJ2cxOAKxSouehT+f75i3k2Mp3HA//JCgD45Q82ukuF+SGWMwOGuA+1sBpqsMpRkVxK Rv4kMeg80YFlr1owDc0EVFNWo2a9j4bZHWnR9R0dgnvWceGowS1m3lpYotDCN2xVVHx5 J4KEzHx+ecku1YPFyztGnKqnr5Hn4oYBIdZIvY3Dd5QKQBNQQ67uCtaZlHoR6MJY09TW n4nZc/YL5TBGnrCH2Q3Ptwnx3anWumf8p9sfB+3C8l+P/yeoHdeuQV6FVS/PbgyqEKjh Ol8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778492545; x=1779097345; 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=PB0b00HDdMyvLcXnO50+iokdfpNKZLgAgDT0mhyx+3E=; b=SZ8KSlhKkrvpXItoL3M0rNCAqMz1CxMK7DNl2zf/wyFHPQj6jvWK1dDqM6LGSJTW64 LWVJ5ZsQ49MZUs+XB4D3PoLm06Geov1jHezquuVmMAv/63Xe5v4J2RCRcsDggLUHFfEx JdNNJv9at/YFkSCo84RkClMtsWw4vxT/7iXOdNQBDj3pxG+hfIykC1H6XEthlyMTVirn QDoa3dR83eqBM0qdcdUgp4Hz6QECJvParQGVTafC7d8kZepzDU6ipEKdHkCcqtARtLqG 0v2DkCiF9VVeyaypvUwR4A4djuAUY50pUxOpULAXsHGEfXsW/6uLc9Vbz2B30wkeH9uI hfCw== X-Forwarded-Encrypted: i=1; AFNElJ89AfrtrmRdjxPnTMHg7bJ2+rViW2w73DacXYUKeXOW3cCT2uUX1XyRDiMNpO7thVcwvpJ8R6TQDpJIUyQ=@vger.kernel.org X-Gm-Message-State: AOJu0YytbVN8Ou0zUa5e2uyOFPGENeooHUuO4V9LJpThJSeHFS3iUVMN YD84T6+uK9+gH1roboS4hhhJHghwbJUkZXwd52XrBwIqth/U2y/caT+DJPZ+XmhN77Czt7PwgKv Ss6reqhr7n83G9kLBZkxolBslR70stzxWScK2vRiTpB9kXOAdzB264d7sCo4hdttaXnM9PvXatf iTsw== X-Gm-Gg: Acq92OGik9RYXPElDSF8PmQfFfvUzzfuhGQsNYsJFrp7xNywVYrbXgul0MMqCR4+frr Ur0XNmGlaoEePvWws0Q8uZZ5PGPHyiA15hAh6DyKo/EQjhGYpXYP5M3VNIjU7c8gnTQYa/gQpmc juOJMZb5IeO6Jk/91FiHBXIm2GediphdUe0CfKtxCDXPw9dHVFM3AnY/e678ZnFVPtUGtAVILfM 8Ck5JeT/KZQTpCQJlQbRsZnYu7ltd7TEkkAVosundXMA0CUbEjwNVruEoYVGxA0ubcsEys6ywmG nmTFXhEw6oL9vkbnpE+EjSjjdAzNY+DdNFrK8xP6WmxJqbpCKXwqSzdBkzbWZ4GUarVQcVRVrIS GL9twLLqYVITdFkCISDDmrujfr7JT86A2CnoSvI2LdSvRgIWoNwUMG05OGZl5/bz5t3HlxNQeTM +RrJxkGyVu6A== X-Received: by 2002:a05:6a20:9185:b0:394:5513:ce5 with SMTP id adf61e73a8af0-3aa5ac37704mr26458892637.51.1778492545462; Mon, 11 May 2026 02:42:25 -0700 (PDT) X-Received: by 2002:a05:6a20:9185:b0:394:5513:ce5 with SMTP id adf61e73a8af0-3aa5ac37704mr26458846637.51.1778492545013; Mon, 11 May 2026 02:42:25 -0700 (PDT) Received: from [10.133.33.31] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c826767be55sm8447282a12.1.2026.05.11.02.42.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2026 02:42:24 -0700 (PDT) Message-ID: Date: Mon, 11 May 2026 17:42:20 +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] coresight: fix source not disabled on idr_alloc_u32 failure To: Leo Yan Cc: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Tingwei Zhang , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jie Gan References: <20260511-fix-coresight-sysfs-enable-issue-v1-1-1b3829748171@oss.qualcomm.com> <20260511092446.GJ3778514@e132581.arm.com> <20260511094009.GK3778514@e132581.arm.com> Content-Language: en-US From: Jie Gan In-Reply-To: <20260511094009.GK3778514@e132581.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=TqXWQjXh c=1 sm=1 tr=0 ts=6a01a482 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=COk6AnOGAAAA:8 a=P8UTN6DROHfuWNEhrZcA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 8M4r-eTav147KulfbXyZxCg6bT_xklQ6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTExMDEwNCBTYWx0ZWRfXwh6UuHQCjF8n UjWIG5UIm0dVPt1PpnuWPTTLDw9ds56Ycy85gcCp6b4DeCnDGWuqVN+PzeoelEgId1XiI7/3BPk XoVqgYEFHbAZ8g+01B0Y9CfxB2Kv2hZGDFkBMHKEBPSf6UJ2irZflynusqOgmJWnr7nS5Tztrnn UFv73V2PaP22uL5lBT/jvvLz44BkOjNMDZJ6Os5H5IFBIAEtga6FW8yzbCjFnII+YXSSZHBOBp0 AtP8InIGy1os5veLRhfSCXG6rQ8JBrsFb/KaQQl72/SDGk0Eop9O4t24pxBXGA13TBEdO/kcF1M lsRdjRB9l6wh7mDZk8rgHWOu9ibdOonjJfGbyTzF5X7r7YUlwj0qXNeK8FsymZCZaRROuEZ+30D ydtAsXv0FgaJpOrseVbFju4RBZmzy7Fq3/G1AIvc5dPWJT7mlu0DgyyGrmVRcCYs6xgH+tzIOr+ TlSmA1fkQh7bERlh4BA== X-Proofpoint-ORIG-GUID: 8M4r-eTav147KulfbXyZxCg6bT_xklQ6 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-05-11_03,2026-05-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605110104 On 5/11/2026 5:40 PM, Leo Yan wrote: > On Mon, May 11, 2026 at 05:28:37PM +0800, Jie Gan wrote: >> Hi Leo, >> >> On 5/11/2026 5:24 PM, Leo Yan wrote: >>> On Mon, May 11, 2026 at 05:04:44PM +0800, Jie Gan wrote: >>>> 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: 1f5149c7751c ("coresight: Move all sysfs code to sysfs file") >>>> Signed-off-by: Jie Gan >>> >>> Actually I have noticed this. Since my PM series will remove IDR things, >>> and I don't think anyone really hit idr alloc error, this is why I >>> didn't send fix for this. >>> >>> Anyway, this is a reasonable fix. I will send out my PM series later >>> in today, I will pick this patch into my series and rebase on it, hope >>> this is easier for all of us. >> >> Well noted. Please feel free to pick it into your series. > > Thanks! Just note, I updated the Fixes tag as: > > Fixes: 5c0016d7b343 ("coresight: core: Use IDR for non-cpu bound sources' paths.") Thanks for the correction. Jie > > Which is the original patch for the issue. > > Thanks, > Leo