From nobody Mon Jun 15 09:37:08 2026 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 46B30377011 for ; Thu, 9 Apr 2026 08:46:39 +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=1775724400; cv=none; b=YnpeG261hjYo6ZhUD4F+wy9DaS4yyQnbKjasMBiglHtKOpNd2aI+mPuoKprSYhgbyXUlnvcKH5Ek7iBvrnEFbPfWVBquuEvadKRcDgo+xdpecjlzxzJNgxFZ286sFwGC7UJ3JoNi4veFS9D+S834gVbEzNyGUIeggtiJ2n7XT7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775724400; c=relaxed/simple; bh=LILZ401zz4H4PYaJRtQNOEsPKwxxLyAST3STgzRbi68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pIkH6B/qkwE06wYD5xvYdvfnsQ7/xq7aJS3qa+4ouoytDCelgIWujqhiqL9Dw0T2p7suSCQNJ6e3dHRlu17S3o2z3sV5Qzg2gmrEtAJ3p7hQJfA1f1597n2wloR7mWJDSZtQwS1jbZl7NPwR3IoZzWWwBmUPSxDXZ+HcKmzj6Qs= 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=N8CnON4u; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=fMc1u06c; 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="N8CnON4u"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="fMc1u06c" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6397NQHb2845134 for ; Thu, 9 Apr 2026 08:46:38 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= 6Irp+xgmj9Ik34RHCahjt5RaucthCedcYg4gNt6nNrw=; b=N8CnON4uIERbWLMl w9fK/vSu1ncvMdTgo9FcHm51bTsDYrLBJKpRnN3gPG8jY6B2q3p5pPFmRJ9U5gP4 zICdkso2gBKmIAVnyn1UpV6/tilCesggfTAxHMN8aGSh2+Rq9+T6rzjswe77C4OM 9oImUIJ+hhCg2VzoSHZ+jfBM6jZhOBJ7Tp854GLypZBhgdL05AE+Yx+L9akkyqsd E0fBlaw7dcT1I9Nf3RqUNEwLHzIgPZe28vdrE/YBblV64N+C4RQTCcjpucozmc7W eP9y9n/uU/3Pa7XdtFgewNB98Lgb/b55239DcE4uRrCZ3cGRZZvaZaP5oqVdQ6c7 V5m/BA== Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ddt7hk7kj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 09 Apr 2026 08:46:38 +0000 (GMT) Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-12711ec96fbso2794492c88.0 for ; Thu, 09 Apr 2026 01:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775724397; x=1776329197; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6Irp+xgmj9Ik34RHCahjt5RaucthCedcYg4gNt6nNrw=; b=fMc1u06c47erWy7664ZqzsoePxG4gCaW0baXmBkICiHI9nW33LX59tTT4Xk+3Uv99N j/59zDSem7JxZ/29jnKSHMuGVGGxh6DiJhUZlSIXDbsT9LwfpXs6vlITTHmTuDXBir1+ ARX6/z02csIw2PKpOgC0EzpOYpk9kZOQ1OmOec035w8PNCiWyExGlyTYEbx/mTgcLzX9 Vb3Ylt5oSsNoubeFm/eII195Bq29JuaRRBk9uicn017gHzWkPOfWWPisXo5O1S7iLYUw 7SAJOI8iUZJeemFyQWrbn2FHV15NEFRmGxa4PN7E96lCB0N+v0gE/E5KNlyFWF6NggoK lPww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775724397; x=1776329197; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6Irp+xgmj9Ik34RHCahjt5RaucthCedcYg4gNt6nNrw=; b=o0qEPzswA9dCwqMRyLe6znE98HQ9N2VUOOgKzGq9uVgoLhyUnfrNMR/6y06XSKMKxk l8rqRTMB51XCKObPWxyh0JouPczPvh15V5SU1cPAU0j/s1Bmz40oYTjX+utWv7cV8Nms igAfJQT1xINZdpWncrYwXZDLELgrmngFtE9kgcn0j0dLiwGAAtNoDTnGYHo/FrbLDvlb ETamPihNcB9ynQdL/l9OGNxLHhKMjDsq/JFftpjQNJaW7CR3MrVRp0gApj9RMek/OGOd uppxo8fdhGvF/TRGduppVCo8xINygBUEM1HgSOD40237u8dZP+Gt7d2LPkxUKPtRJBze nS8Q== X-Forwarded-Encrypted: i=1; AJvYcCUDwR8PGKSWD/eFYzg13KWBiB70vJPIVzerURrvr/JrB2D9+aWeNqbhnac+SiOCytjSdegjWq/qDelTllw=@vger.kernel.org X-Gm-Message-State: AOJu0YzBxI+Lnc9x/gwG3MUNIPdg7VTBOVkEM/3UGyEx94xqwz9G/hGe NRvaaWau6ac5m6RC+v85HwqG5S/pq8U+s3EL+sXshvadt21sU7rl9TSx98qbEK9qqACvsnQZvCz mlufXTtiyFD7pPaTOHFVI+5TCE+TDLOhs5rnIrOvKdfUimN+7JMH5igqNFEtFK7Gw7V+S73gYZr U= X-Gm-Gg: AeBDievPb6wOj5HKm6xfScdhTorcHn8XkFOVQTVCRGGDimLXnyeiobZcuEh4Vc8GZ0b Z1/1vcRdY4xhwJfQUt5yxqTN89V4jEm2t4/wz7QDT0YZwOYIEttfopOr9AfSK0bn8R/bL9pp5pq ehENXzR9ks56rjakq5aVD+woYYJkjVbBHkIJ6UxvMmOlcPFx5aSCHoBgXwTfXecrW841P6Zty8W w7zZKuEJU3prm3aJlf+2OFR5dBwDMyGvEM01D/2iGT34wb6t9G/K7YX5tg30EWT+Vt3zoaF1STc lo3SpdW0bW/tuZiWzgLkHpEddkuM4/SP8qBFQQS3ngAMgrtmY8Wgv4nCp3NSXQ81QEEMplJBE/a ILCfaPIDNH//Lrbi3HBDtphbWcfwpOY7k1L6KeH9LZJKr4r/gWLW8DfoBlN1xwdXHZPcal0fq X-Received: by 2002:a05:7022:4381:b0:11d:e40f:ee69 with SMTP id a92af1059eb24-12c28c179dbmr1491442c88.36.1775724397046; Thu, 09 Apr 2026 01:46:37 -0700 (PDT) X-Received: by 2002:a05:7022:4381:b0:11d:e40f:ee69 with SMTP id a92af1059eb24-12c28c179dbmr1491413c88.36.1775724396463; Thu, 09 Apr 2026 01:46:36 -0700 (PDT) Received: from hu-jingyw-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12bede54ba8sm28451931c88.10.2026.04.09.01.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2026 01:46:35 -0700 (PDT) From: Jingyi Wang Date: Thu, 09 Apr 2026 01:46:21 -0700 Subject: [PATCH 1/2] remoteproc: core: Attach rproc asynchronously in rproc_add() path 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: quoted-printable Message-Id: <20260409-rproc-attach-issue-v1-1-088a1c348e7a@oss.qualcomm.com> References: <20260409-rproc-attach-issue-v1-0-088a1c348e7a@oss.qualcomm.com> In-Reply-To: <20260409-rproc-attach-issue-v1-0-088a1c348e7a@oss.qualcomm.com> To: Bjorn Andersson , Mathieu Poirier Cc: aiqun.yu@oss.qualcomm.com, tingwei.zhang@oss.qualcomm.com, trilok.soni@oss.qualcomm.com, yijie.yang@oss.qualcomm.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Jingyi Wang X-Mailer: b4 0.15-dev-3d134 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775724394; l=2493; i=jingyi.wang@oss.qualcomm.com; s=20250911; h=from:subject:message-id; bh=LILZ401zz4H4PYaJRtQNOEsPKwxxLyAST3STgzRbi68=; b=qPNHNb8mVXkDQ+pA4e1qin4F/5ybw8Ks5xZVj0AN7q3zBfhv66RDYgyVzURhJMeRihMAnAemM KjmNghF9PTOD3B8IIGNwsc5SpHkIyUpjAZlldVTBwCzEAPrHS60ZsGD X-Developer-Key: i=jingyi.wang@oss.qualcomm.com; a=ed25519; pk=PSoHZ6KbUss3IW8FPRVMHMK0Jkkr/jV347mBYJO3iLo= X-Authority-Analysis: v=2.4 cv=O5IJeh9W c=1 sm=1 tr=0 ts=69d7676e cx=c_pps a=kVLUcbK0zfr7ocalXnG1qA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=k_JL0JQvz4wm1xcudgQA:9 a=QEXdDO2ut3YA:10 a=vr4QvYf-bLy2KjpDp97w:22 X-Proofpoint-ORIG-GUID: srvWj2OtRJzrGK0_UXQhN_uDE5Pg-2fR X-Proofpoint-GUID: srvWj2OtRJzrGK0_UXQhN_uDE5Pg-2fR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA5MDA3NiBTYWx0ZWRfXw/qXrvPXG47+ XreAsXm9XvZP6JhOV8ut/RWPksGYmOQ0SCu4TosfMSu5RBEFiE2OCU9oNHHlhu8yLlg0sKWjPco nmI6yK4CU+8Pqz+U8aqoae5eWwo1PUq6dLSZehEv1twzpxYmyr6gln1cYRNhzUB159FjA+21ER+ f0bqDR/mXuPlV3jF1HwdldbIxWhNlmuZeSj3fdLvomRkWeHJRLtEUTrazzpTvoJk81IvPP3K2KF SdBQVddb2ZP0pMDAkHh26uXDlh6gNT+7RzlUBKl+3cxIWIColXlbi1SI0IHEYTdqxC4WBXMMLXj qgdY2x0OWvwWlhc4NxNh7eMY72F9QmxfTeCP95pV1JshbpPKdrKGfAvkmx7Azcv4lcdTzwtNRYF 02BaMn9rTXUWpfbqLivSUfLFdBHcXf3FdvlkGpvVDhEIhVZz3DcZg3jdgPKHWSfHf6MXjbQFdX0 LK04S9waWdNUDxX5jOA== 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-09_02,2026-04-08_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 spamscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604090076 For rproc with state RPROC_DETACHED and auto_boot enabled, the attach callback will be called in the rproc_add()->rproc_trigger_auto_boot()-> rproc_boot() path, the failure in this path will cause the rproc_add() fail and the resource release, which will cause issue like rproc recovery or falling back to firmware load fail. Add attach_work for rproc and call it asynchronously in rproc_add() path like what rproc_start() do. Signed-off-by: Jingyi Wang --- drivers/remoteproc/remoteproc_core.c | 20 ++++++++++++-------- include/linux/remoteproc.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remo= teproc_core.c index b087ed21858a..f02db1113fae 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1673,18 +1673,21 @@ static void rproc_auto_boot_callback(const struct f= irmware *fw, void *context) release_firmware(fw); } =20 +static void rproc_attach_work(struct work_struct *work) +{ + struct rproc *rproc =3D container_of(work, struct rproc, attach_work); + + rproc_boot(rproc); +} + static int rproc_trigger_auto_boot(struct rproc *rproc) { int ret; =20 - /* - * Since the remote processor is in a detached state, it has already - * been booted by another entity. As such there is no point in waiting - * for a firmware image to be loaded, we can simply initiate the process - * of attaching to it immediately. - */ - if (rproc->state =3D=3D RPROC_DETACHED) - return rproc_boot(rproc); + if (rproc->state =3D=3D RPROC_DETACHED) { + schedule_work(&rproc->attach_work); + return 0; + } =20 /* * We're initiating an asynchronous firmware loading, so we can @@ -2512,6 +2515,7 @@ struct rproc *rproc_alloc(struct device *dev, const c= har *name, INIT_LIST_HEAD(&rproc->dump_segments); =20 INIT_WORK(&rproc->crash_handler, rproc_crash_handler_work); + INIT_WORK(&rproc->attach_work, rproc_attach_work); =20 rproc->state =3D RPROC_OFFLINE; =20 diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index b4795698d8c2..9b3f748e9eca 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -568,6 +568,7 @@ struct rproc { struct list_head subdevs; struct idr notifyids; int index; + struct work_struct attach_work; struct work_struct crash_handler; unsigned int crash_cnt; bool recovery_disabled; --=20 2.34.1 From nobody Mon Jun 15 09:37:08 2026 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 EFED03783B1 for ; Thu, 9 Apr 2026 08:46:39 +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=1775724401; cv=none; b=f1KO1nLOHjd4pmIBiOl56sfqOq8uWDEcjkBdruSirmlNFVmX5xYoGDhtQd+sdJV4hK/C3H9YGo3jPAyGc3Jxd9Deq8O0FMZEJPo1ICckzTlltRo+Woy24b9q6h0NzfsBRL72dwiCuJOOgivCvxPN/cmGg/7a0YMSfwjkKrabaPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775724401; c=relaxed/simple; bh=L0ObvfduWGAGP21veczdi1azriQW28n0o9uJhPgYbBI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CjwPP1GosHakFzOOa41qQNocYB02TM2SvZwdTObCwnoaL1SY+skWVOG9pMjxuQGa/G+DDG/NFlbedL3habFyHyIF5VTMzC5A1RkId7V5yle0BG2AnMh56Hp0tsMAWBEb247UBWNAHzNMvOx2u8YM1SD8SZL+aMU8nU5n2uF1djQ= 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=NQe54dZq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SjKnZYa7; 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="NQe54dZq"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SjKnZYa7" 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 6394t2c84107677 for ; Thu, 9 Apr 2026 08:46:39 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= 6CrVle28WB7UnN3fLJ+Ty/OkvEJHEIJlIT67rX6hqJA=; b=NQe54dZqD4tXrKWt IfH99gSgI1GYFG4OJXyu4tM9Y0D3CQ+hQYtzyk47L8lKJbdAldEFtme1p1/+gXuB 2WOyN7wAOiTYe3mRuFochd6CfJ81tfCR/K4aWqT80nS1k0m16TWE79+zfjUhMfXD LB1tH9L7+2QmWawGqwtjh0feIe+DNd4C6a7eTFHnWiBBsalXbSlYye9Y0+VUsXVz Jg6r0ewcgVRDgYK9W0KAqugPa9HgDquxee4dE+AG8gAdUeSN0viTqOaOgCiC1FUK njCPnP7CaFkBuC92OV5IV05zhOuPXCnpagw9orse6BNYU6miplonpMRIxo+9P8Al j3zUPw== Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ddxhaj1hr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 09 Apr 2026 08:46:38 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-12bf921cf49so8662791c88.1 for ; Thu, 09 Apr 2026 01:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775724398; x=1776329198; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6CrVle28WB7UnN3fLJ+Ty/OkvEJHEIJlIT67rX6hqJA=; b=SjKnZYa7DXoib/ne2P0NLPNfolrQOLQDtZu7CI3t7c95m0ekprVt7G/2BBGCWajFwf resGsJo+iBJny4q/BaPMTxpx0kyYeW4f3keRrJ9uXB16wWV6VHyzGcL08STRW2AWXjDb HrI8ehEx87dcz9hu9V9S5O48QUqzngiMtvxnVvc+v+gVNaErtS1HYCm6JIdHibtD2cXP /Rv6dvkXenh5FaO2tZ/jlO1NR45nOHit7gYRaVjre7qWZ8SpOUPIF9qAt9y3O19TLzcX z5OpipsXgZTRKSxA9gdlOzqJoGx7jzSRgUMCTntI7N9CEbrKRxH69MR/yTfE1mPewSPM pJNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775724398; x=1776329198; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6CrVle28WB7UnN3fLJ+Ty/OkvEJHEIJlIT67rX6hqJA=; b=c8/bW7mtx0JbP43IUy9DmTBm++rJI+3gsM/IaufbYNZjpW7ndMy7XUzq3s6AhaUggl oV88nBIYxEf1+aaYfSDbcmLpoCkBVdu0uLLZVKwkz9tEJgUQmtyc03pfUedvD3hoHLVh mf7xMk1T+agfjcR0FzFekw48Yi2ZQh+WmX8ZzJN8bczkLYAKLSuCsCCO9QPUTtJgJ2zd UpPZh0374UgR6BdTWbAWlTKxW/xf5K+xPLRh7lLiGctnlVIIFPXjnGOQHDuTGKtPsJXQ gf5pBwOMgPDmGsz/uQg8FFrNvvHAqcG3hITi8PVTy+tiSsE/AKVCXfOi8iqPCSEI3wTG 1x3Q== X-Forwarded-Encrypted: i=1; AJvYcCVWWFsG/f78Tr77cCdSKwnnwxkCHpK4Rv1zea6wmaFqPlW9tTydDdwnCIUrtt63KwRuPJVhs7TRYZ4XgMM=@vger.kernel.org X-Gm-Message-State: AOJu0YzMTmINUs3ZQa164aST/DNUnhIuKfPiq77oHLUqhkk5l88lSSea f4JlejU+rM1wB3OjZLmU+yTcAf0djysxiPU1V+CQt8gWAzz6RjKL+Er7UF5GAEckx0gJKRvzJGY dKvz3B7wBpWvY4fm3XWBNfKn3dpCKIEHxZCeY8QzRCpnc3o7mNCh8b0L2oCDnGXYoyys= X-Gm-Gg: AeBDies34UtcmlLQrsZE981YoIdJHVLP55EZw1EQvOvS/lgMnkIKsvfksJZrbkm1Mmr kXqa/LzfrPJSqMdiQrmGbVNGh6EqNv3Ef1xjIiJn7QwWJIQWf3tcgfvSlyG7nMBObcQsATxE0CM xinVeN5s0UzCLai/J+BB4p1V5wLGzDN5YpCAw2qhXRH75I0nvSSlcXPcpZ9Z6AF3pQnLUXhb7dw afZbVTV8Xk1XpemSjFVY4ijDqebtYDFEbAW61jG5j9M/cBrIRzAqazAznGVeXljxqK4ftfP01L3 TNqUs0bb92f+3eGObEvS2+mW9pTMjbDd10m3NISPoNSmQDtj9z6h62eFY2pxeUdipr0PoyibX5K QdtfF0yET9RmvEdVJ/Pix/NSqWLOnRyu6pZ5KjgNT9G7ZqX/UL0c+kwGSsx7kqgo00LCqBFBu X-Received: by 2002:a05:7022:b9f:b0:128:d5bd:3572 with SMTP id a92af1059eb24-12c28c0f6f3mr1406825c88.31.1775724397915; Thu, 09 Apr 2026 01:46:37 -0700 (PDT) X-Received: by 2002:a05:7022:b9f:b0:128:d5bd:3572 with SMTP id a92af1059eb24-12c28c0f6f3mr1406807c88.31.1775724397294; Thu, 09 Apr 2026 01:46:37 -0700 (PDT) Received: from hu-jingyw-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12bede54ba8sm28451931c88.10.2026.04.09.01.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2026 01:46:36 -0700 (PDT) From: Jingyi Wang Date: Thu, 09 Apr 2026 01:46:22 -0700 Subject: [PATCH 2/2] remoteproc: qcom: Check glink->edge in glink_subdev_stop() 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: quoted-printable Message-Id: <20260409-rproc-attach-issue-v1-2-088a1c348e7a@oss.qualcomm.com> References: <20260409-rproc-attach-issue-v1-0-088a1c348e7a@oss.qualcomm.com> In-Reply-To: <20260409-rproc-attach-issue-v1-0-088a1c348e7a@oss.qualcomm.com> To: Bjorn Andersson , Mathieu Poirier Cc: aiqun.yu@oss.qualcomm.com, tingwei.zhang@oss.qualcomm.com, trilok.soni@oss.qualcomm.com, yijie.yang@oss.qualcomm.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Jingyi Wang X-Mailer: b4 0.15-dev-3d134 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775724394; l=1712; i=jingyi.wang@oss.qualcomm.com; s=20250911; h=from:subject:message-id; bh=L0ObvfduWGAGP21veczdi1azriQW28n0o9uJhPgYbBI=; b=xe0URL/XMhcfnx9ZDqY0llEzE2lxiq1Xz3M6I/6NxV/iPXd6RWjb0BmK1m1XL6V2FSQh1nZm6 H0zrf3mmxCODjPvRtTgTbq5tDmx9MQ09y0Lkm7e7VtnHgb8tOlEpXea X-Developer-Key: i=jingyi.wang@oss.qualcomm.com; a=ed25519; pk=PSoHZ6KbUss3IW8FPRVMHMK0Jkkr/jV347mBYJO3iLo= X-Proofpoint-ORIG-GUID: RwqBMbSzyRmOhgWMeN5qf3NIMXF8Z2XO X-Proofpoint-GUID: RwqBMbSzyRmOhgWMeN5qf3NIMXF8Z2XO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA5MDA3NiBTYWx0ZWRfXyn/WJxgiFSBb 9czpTatG3hO9R1gSHc4Y/VkmjddYwZ8NXF5jFIqLCDJxK9A/NJUabqfDjqV94xxOxQGdkZL2Ybi gS4hrdcLrqlyxb+bm031SRQy1as59l0USG99yyL5XDQ48OzZBnUIeGoTFsEnt1mgW8UXbkh+Kpv BgqalPPT/Fkg8cSUISbPgZFqsmhB+s0cvBkym2Nh+eMfeSVsRPVc7OVPpmyq29aPmdjUGdCLDM/ z9b6LS6OWTZIoFh1C8AfSIWmnGycCCQJwPo0ajFYl1C8qpsTehnkVtcVbSI1QQwZc+JvK4UuVCR /mzh5EyWTft+2f8bC9sI48tjoViAZQg89AAkxjVFqoFoDawUUMXyPbBgeOC0PpX4t+tcUx/3yK7 nrmkrWX48RvPRQnRsDXD/A7znDZntnLmiopjTlWR820D2/9C0tMwc7RknDX369OVJwgVg74hsuT 07l4cBLxr8iEPXoEL2w== X-Authority-Analysis: v=2.4 cv=BefoFLt2 c=1 sm=1 tr=0 ts=69d7676e cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==: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=Bsuwbdf3w_HfsqIaBggA:9 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 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-09_02,2026-04-08_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604090076 For rproc that doing attach, glink_subdev_start() is called only when attach successfully. If rproc_report_crash() is called in the attach function, rproc_boot_recovery()->rproc_stop()->glink_subdev_stop() could be called and cause NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 000000= 0000000300 Mem abort info: ... pc : qcom_glink_smem_unregister+0x14/0x48 [qcom_glink_smem] lr : glink_subdev_stop+0x1c/0x30 [qcom_common] ... Call trace: qcom_glink_smem_unregister+0x14/0x48 [qcom_glink_smem] (P) glink_subdev_stop+0x1c/0x30 [qcom_common] rproc_stop+0x58/0x17c rproc_trigger_recovery+0xb0/0x150 rproc_crash_handler_work+0xa4/0xc4 process_scheduled_works+0x18c/0x2d8 worker_thread+0x144/0x280 kthread+0x124/0x138 ret_from_fork+0x10/0x20 Code: a9be7bfd 910003fd a90153f3 aa0003f3 (b9430000) ---[ end trace 0000000000000000 ]--- Add NULL pointer check in the glink_subdev_stop() to make sure qcom_glink_smem_unregister() will not be called if glink_subdev_start() is not called. Signed-off-by: Jingyi Wang --- drivers/remoteproc/qcom_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_com= mon.c index fd2b6824ad26..79d9d45e0b81 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -220,6 +220,9 @@ static void glink_subdev_stop(struct rproc_subdev *subd= ev, bool crashed) { struct qcom_rproc_glink *glink =3D to_glink_subdev(subdev); =20 + if (!glink->edge) + return; + qcom_glink_smem_unregister(glink->edge); glink->edge =3D NULL; } --=20 2.34.1