From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 E178C39935D for ; Thu, 19 Mar 2026 05:44:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773899097; cv=none; b=tVNYGuePfw56QdJ6zJJRfGl406GbAW0Ty/FCDrzkISYt+Ef3Cj1jwkLwRLbya0YNpgdmq+AOhxhA9w25ibL1vwcdcP+TuqJxPwLHlC/g6E3msrO4ByDNvGG5fR9mvu8wo/vt4t3KfqsmnM6oy8+bsTsgEA2vn2nj5Tz9qhTw8uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773899097; c=relaxed/simple; bh=NNB5xffDO5KucLPq3mYXRXkkzL7ZnpefOvtoDqD9dZE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=N9ukWmq7f8LXc2I9v5n5Nk3bPanUNhhQMST6ZpPhCbjRayP0GMOky94uvS7DMV0nklBp6IlvsocRdehRFG0QtOBpBgMwf72NuUUZCojm+otcQByV9FZfCkjFNOOnVwXIzeaGP9w7AOt5Bzdg2IRX5E6/e1OYFoAoKi1UQpJ4q3M= 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=iwyKWURb; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=i6JarO/N; arc=none smtp.client-ip=205.220.168.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="iwyKWURb"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="i6JarO/N" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62J5XbBd1574721 for ; Thu, 19 Mar 2026 05:44:55 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= ampQRXpUK/R8dpg2C3wASpItLjwceLYCOODrGNFGjZw=; b=iwyKWURbyLNcQ8Oh RexAbUlCFF774kwQjATg0aXt6/ftyCCwMkxySXaOw//d0AlGft6wMuXsVolWhdTF VngVhthHCAfM8OoNig2SeCcjqzxIQVZkPYRj0MFEBVK/ivL1GHgFIUwPehjGQKnU oe5X/djf3PL/3ln8LfpEuT/I7c72wtckco8NR4zJgt5hVMDdxB+PymsgJyMKnO3W CN7VDkqJSAclcw4WejqMzSYoXuAvIcDos79cSxTmen9gHCsiy8gJL/b1jb9WpRjk gug8jOV8Ec3sM7/2st9VYt2rJE7XSOTcac44hI/xgaqoLNUnQZxDo1r6CtlbVcEN pL/A0g== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cyy75t82t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 05:44:55 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2ae3badc00dso6086445ad.3 for ; Wed, 18 Mar 2026 22:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773899094; x=1774503894; 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=ampQRXpUK/R8dpg2C3wASpItLjwceLYCOODrGNFGjZw=; b=i6JarO/NL2ANNLNaQ4XrfaCGLQl3H67QVz14kl2kFP2KE2Gpb9ordCZzfa5SYjo+Z8 PB8O/5LQqyL1zb5uku1bTD6zSvLFz8MGbLEtANK8I897OoKfBg0Aur4pY3FCHHPi3RNj mlE4/j8m4TAm4Kpra+Q2hzohr2yhoZxIdfmwyPyJEJ8qdLfmlrD50WWTp55jnADvi6Q0 iZw/zRUCVZiB29bGQdwSETX1U7wDEazp3I7cM9eoApBVTSWDRCziFdQmxMlw3HgUPDss ABj/45W5+N53XACYoO+T4eKIbrjS98+sumuHpmKnh0RkdEV6rPsDMnWTOMRYT6T69aCx yNfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773899094; x=1774503894; 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=ampQRXpUK/R8dpg2C3wASpItLjwceLYCOODrGNFGjZw=; b=OG5qj3N5RdkIaZsdcG6uMNwzL3ypF3jUzWT2O/OC46wVKbGk6QE5tiuI+SVlSNAbFB 8sYL+7DdMJDqLfnrDNbnVo4AkBQZg33MMS1q3y0qSliH2ud2mxU1RR4K56/PvoIFt5VH 2zpPzkTTaEV1KE+G0JeU9TpmDDt5S0AOItBpDpEv9IUqN85l3dK1mYwJfAlV2dyrC23l ILK7VIz+Dx5j+INdEw9HqqTuP1LKTWz0mI2wq9qDZYRmu6jDbVvx8g68KaPq4GCa/kVF 7Mk31pmWU5Hd2Ww+1U04umtW315Zukq2xHt83sC5YDryc54V2hOo/s1SYJOvT8hUxp0Z cKQQ== X-Forwarded-Encrypted: i=1; AJvYcCV+L+wG7gKwhMrnpqTfsy+Rns3dGZfUfpy9FEUZnJWvYQrC0aKg3TH0GIggsgFF+NrZOxLyp6OdtTG7slQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz23dThVbQuEWdIb42l7P8NozCUAuFpERVRlCGkotP9OXJVIXj9 tERyGjl3Nu2SKvxoS1PKKLZorkjOwNWSJbEgtQ0HVlM5YCJV6LaFyXer0z94nZ4FdbMeDZeQd8S iSNExV/LEOL6woIyO/JTyx75b/IbdlCNdz9r7B4XA2yR4K7NmheG4IYV/ff01ZikVDzk= X-Gm-Gg: ATEYQzwScaZq1ksXl5+ISbFLt29KZYghI/4TvyaozFjft77Xp8uWW76X6m3MP102eAX 1Ak/QLIKISywTEbgd36e5a8WV2j07UIjUZSU4bbzxhQ/57eQwzP7Vp1nza7RwPHAKsoC7wNy+i4 C8Kj3lXusLvjGRI4siyNXLyM/XDYowWfWDqvrFD9gi++0EjanumY/TKgMX9sS1gWQd8/F0CPZBU fCqQNhQdrjrKDHb4fbsPJVr66qm8TOd2R2TFpiF1dNpTAX4BWjky9/NbCZKmy8HMJnabhugQjdp Obbu/Km6OvxQXGSjqEzUwN8vY2e234v+Wo862O21eM0NrGwN7z/Sogob4KeEVe6s4GNMUGriATI V6Xbtv97bG3kGJZgH82C8Nz+90eD9V7r0DM19Z0KqBi4/5Wk83IkpLWERdpZR7Ltiy4A2UYBOHP U8Kodz2HnSBioDzu9r X-Received: by 2002:a05:6a21:3d84:b0:39b:9aae:fa01 with SMTP id adf61e73a8af0-39b9aaf5283mr4413795637.60.1773899094379; Wed, 18 Mar 2026 22:44:54 -0700 (PDT) X-Received: by 2002:a05:6a21:3d84:b0:39b:9aae:fa01 with SMTP id adf61e73a8af0-39b9aaf5283mr4413769637.60.1773899093879; Wed, 18 Mar 2026 22:44:53 -0700 (PDT) Received: from [10.133.33.168] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c741e543d25sm4068895a12.20.2026.03.18.22.44.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Mar 2026 22:44:53 -0700 (PDT) Message-ID: Date: Thu, 19 Mar 2026 13:44:48 +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 v4 5/7] remoteproc: core: set recovery_disabled when doing rproc_add() To: Dmitry Baryshkov Cc: Bartosz Golaszewski , aiqun.yu@oss.qualcomm.com, tingwei.zhang@oss.qualcomm.com, trilok.soni@oss.qualcomm.com, yijie.yang@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Luca Weiss , Konrad Dybcio References: <20260310-knp-soccp-v4-0-0a91575e0e7e@oss.qualcomm.com> <20260310-knp-soccp-v4-5-0a91575e0e7e@oss.qualcomm.com> <9bdc6b6d-ddf0-47af-b1ed-8d1e75bf30c2@oss.qualcomm.com> Content-Language: en-US From: Jingyi Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDA0MiBTYWx0ZWRfX4gvUGOPg36xq XLw4StWivoBkQCJt3viPXQKFsO8zIAkpeb644Hm6EWgfBj3A3OC41srM7srqLBSIKuHMUxl8kvr CY2Wmim1f387iGKNT/hpAqE4Zzqs4TzP/YlwnTwIQLwzPQfJL6ijmxsRH7Kefn368gO6IfRsz5m Xoe0BWi9DKIt98nN/Q8JY4nGJHAF5TOypjylodmdJHSD/npEprybv8toZ80VDYlJmumEfjLj4lL 9yIHz7aaHyxmxYGxROL8KzP8vxGLovG3YpCCDfuWITgM6G+M5RPFJVRPkpbHphcTStdNKHUH2SA R+sCCM0S0LdNs9qXopgo/Ts5Iiw66WT0UHxxVHGDkiQTh4c63pbL70TjUX7qfVKIe0X1g48+CMQ CunqtHzOYhU8BhZ6VlSvJZSl1pEFA1E+Zd6/8OKGZXIW5VjVOzPXJ+ddB/pPM+7GTZRICdBOMsd IR/XWpRCBE1alzU2jDA== X-Proofpoint-ORIG-GUID: 7XAHobLCcEA4LktYgWsVrXsIZk2nM2Kx X-Authority-Analysis: v=2.4 cv=A7hh/qWG c=1 sm=1 tr=0 ts=69bb8d57 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=rNVI97BeOdma3RHj8UYA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: 7XAHobLCcEA4LktYgWsVrXsIZk2nM2Kx 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-03-19_01,2026-03-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 bulkscore=0 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190042 On 3/19/2026 1:23 PM, Dmitry Baryshkov wrote: > On Thu, Mar 19, 2026 at 12:36:15PM +0800, Jingyi Wang wrote: >> >> >> On 3/13/2026 10:37 AM, Dmitry Baryshkov wrote: >>> On Wed, Mar 11, 2026 at 01:39:50AM -0700, Bartosz Golaszewski wrote: >>>> On Wed, 11 Mar 2026 03:11:42 +0100, Dmitry Baryshkov >>>> said: >>>>> On Tue, Mar 10, 2026 at 06:50:30AM -0700, Bartosz Golaszewski wrote: >>>>>> >>>>>> Ideally things like this would be passed to the rproc core in some kind of a >>>>>> config structure and only set when registration succeeds. This looks to me >>>>>> like papering over the real issue and I think it's still racy as there's no >>>>>> true synchronization. >>>>>> >>>>>> Wouldn't it be better to take rproc->lock for the entire duration of >>>>>> rproc_add()? It's already initialized in rproc_alloc(). >>>>> >>>>> It would still be racy as rproc_trigger_recovery() is called outside of >>>>> the lock. Instead the error cleanup path (and BTW, rproc_del() path too) >>>>> must explicitly call cancel_work_sync() on the crash_handler work (and >>>>> any other work items that can be scheduled). >>>>> >>>> >>>> This looks weird TBH. For example: rproc_crash_handler_work() takes the lock, >>>> but releases it right before calling inspecting rproc->recovery_disabled and >>>> calling rproc_trigger_recovery(). It looks wrong, I think it should keep the >>>> lock and rptoc_trigger_recovery() should enforce it being taken before the >>>> call. >>> >>> Yes. Nevertheless the driver should cancel the work too. >>> >> >> Hi Dmitry & Bartosz, >> >> rproc_crash_handler_work() may call rproc_trigger_recovery() and >> rproc_add() may call rproc_boot(), both the function have already >> hold the lock. And the lock cannot protect resources like glink_subdev >> in the patch. >> >> And there is a possible case for cancel_work, rproc_add tear down call >> cancel work and wait for the work finished, the reboot run successfully, >> and the tear down continued and the resources all released, including sysfs >> and glink_subdev. >> >> Indeed recovery_disabled is kind of hacky. >> The root cause for this issue is that for remoteproc with RPROC_OFFLINE >> state, the rproc_start will be called asynchronously, but for the remoteproc >> with RPROC_DETACHED, the attach function is called directly, the failure >> in this path will cause the rproc_add() fail and the resource release. >> I think the current patch can be dropped, we are thinking about make rproc_attach >> called asynchronously to avoid this race. > > Isn't this patch necessary for SoCCP bringup? If not, why did you > include it into the series? > yes, will squash to soccp patch in next versoin. Thanks, Jingyi