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 F2E33381C4 for ; Tue, 7 Apr 2026 02:40:34 +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=1775529636; cv=none; b=Xk7K9/1Jso632fvXrNGC4852BPsBgMYhr0TbnMLIpSYEzknu7S3un+tHl7MYzigQtV6JDHWz4do42gs5onxwXN6ECqrwYXRw4+s5BkOp0xkOgRv8Dptq6bKLXAax6dRTTROk8H85tpGfMgksUJdNjaIzLBtIZJvV8WuhnRmQzbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775529636; c=relaxed/simple; bh=6nLuycy9ugL1PICvbpZ1+CdVUuin2IvkNY5gP/mgO6o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MzI8kb5WCRtb6bs5VJfWCjfvot9CneXBnXLYlxSgy+/nXhalH1RriK3eV5pkACc5B4QA0RxJiARMHtCMluRGpNC0CxkVYYikklO2aQ5rtFaXhkVmn8KqCJR4sRprzpnUX7BNhwDSYFjjLG5Rx4mt4Uogbk2nXv4ToKyfITBvQzE= 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=FraAhuGX; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jYzLRmso; 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="FraAhuGX"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jYzLRmso" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 636LQM8Z493331 for ; Tue, 7 Apr 2026 02:40:34 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= 0sxWiIfGcKWwZ0QvbsOJvsjsTrks99xzrJstDrIFAZE=; b=FraAhuGX0h8bJK8U yUTiV3UkjuVeGdijZgCFCpNHqsrgUdIZ9DZXUCw0sIVutMmaqi9sVwF1HamNbAnd pUiT2tpimvrn8RfNrWoM/BopFnioo2eMbsdGmELbUjtlf1cgy/KwSNmhf1lBNmWi imuCCz6mWPZyRBzJMoTTkT6JxB85oObSDgzGQELITTwEys9rbuyo72U3IuEg25Zh mD9yii3HTEcdDBKjzi78cE4hkbe5JoTPHv57QYiXMqj9MVhV/RBLsfhBhKm+TPKj vSVaSOnvfSYYPpBnXl2axfb5GeVwP+Hr/dx4Mmi7p9NsBz77u8KSye6u3r+L407g BR6+Cw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcmr8rpbh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 02:40:34 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b23c909256so65439875ad.0 for ; Mon, 06 Apr 2026 19:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775529634; x=1776134434; 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=0sxWiIfGcKWwZ0QvbsOJvsjsTrks99xzrJstDrIFAZE=; b=jYzLRmso2yS5khJXVM4yyPXsidoVAX1z1sZ18wbskxjffkIfO28zIo9fRpEdiWOT1p p1et3CSOITQcDhXZpWGsrrAbJDLM6BAE02dZZG+9pqVySax1uSF+N/QaRvAtRQqwzLVY L1gr9w7E3Nkobc/5e7ri3z+w9tIQJFVBOkWCZWCglGtNR0c5gItYgLuSEzJ6QDXIuuE4 Bc3Ev59B3UHi1ZfLhmdeQz9Q5HvCZqM/mP/cAFoEFhTVT1F4XscA0i1lcVdzgFxAi0r/ KPRV3T7ewj5fLwVxUMu86jaqtemnaUgPild/I2KiNmNR4ffWwp89afVQ42GieUlFiRCm k2eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775529634; x=1776134434; 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=0sxWiIfGcKWwZ0QvbsOJvsjsTrks99xzrJstDrIFAZE=; b=Zzrr9L9dj3S+V8Wcfpwb36Nf2+uCvXzAiGp4I22a2fdArR24I0NIovCtkGNizAMSTZ wlspinjc6w16yVXFw8aPRAsNsmEjmszwwVewySS9nwVVG3kpM4Agbnpe+b8AZBa8nCEy in2UVY1Z4Gmm9b8j6qYi81EBGQrVFllhduRv5BU/xEaRh3Jkktu6bgvkfxprtidcV5Uv qbWfrbmXA9f69QI1UnD0znjT477oOucnByYqgbX51l4xWVKL5DPiA4r8BF+sKDiG7ncl tmQOeGYn599/s8bb51kPYIytGpqUDNZGBTdvsw+UIScrOJAHrpDJgrxTe3l9UKUalWii 52YA== X-Forwarded-Encrypted: i=1; AJvYcCWeu1mCr1BCbC3sasSO2iblt3lYOG+gxZMzHrL8sVr07/MelZmbam/doicWqyHToiQWeffAOuvQZ9wP@vger.kernel.org X-Gm-Message-State: AOJu0Yyaa95yVctnKjuvz0+9RtMTCCCx8BJFF13LpSDpNlxMsqFncOWk yVMkyyz/f/QuxTNbKF7ngRIFxUESF1H3ZkoFZUFe8C2C1+67/yq6q3s1xM/YvfBioYkQj4k66WK ohv12CtC5fFgLmyLeJC6lxqtuWbdcRXSkVZIZUiJ5ZQwgsMti8YSG4xzf5vW69lWc X-Gm-Gg: AeBDieuzfNRp2lYJz8zxn0hq6ozjexGAX/qVj2xGHJLK5d4AUmmFkVkg7hcCO8XdGd6 g+8c1SRiNgZf+yxlUShdZsdmE3i+8Gv8xnCwnBBlf90SlypFGUJZOiFvIgPRuOpTGLSsP6LwH1k bVzkwG2mQH4PS1Fp5uyqnra39mHRpaNJJ8hR1YK3o/s+MR4RtMkB9SPArFpTF/SdYuXQjgus8Eg ZqN5TypADevXD9Kt//gORQquIpUO6/D4N43wSguvd/jt/r3la5gtuYX461jQ2VBeU5K1IWg8Vqz dvStTFVzfAsB6MxCBzIiDKhGPc+x5FM1t/SuiWQ4cnY62lRptxT80Zhnn2udhLZ0QPG7GBQxEN1 3/LQ5Nw1MBrcLRSGQyIHFYbrfOg6h9KLmZ07+/DLPEp1JdjNlsTt7lXYg23aTGcpqsHFpF0ajIr O9faAIPWukdcc8orK/ X-Received: by 2002:a05:6a20:9389:b0:39b:e9e1:699f with SMTP id adf61e73a8af0-39f2eda70ebmr15601193637.12.1775529633675; Mon, 06 Apr 2026 19:40:33 -0700 (PDT) X-Received: by 2002:a05:6a20:9389:b0:39b:e9e1:699f with SMTP id adf61e73a8af0-39f2eda70ebmr15601152637.12.1775529633148; Mon, 06 Apr 2026 19:40:33 -0700 (PDT) Received: from [10.133.33.209] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c76c65935cbsm13954195a12.26.2026.04.06.19.40.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Apr 2026 19:40:32 -0700 (PDT) Message-ID: <9b1bd10e-5ddf-4f35-be6a-cde4f157fd40@oss.qualcomm.com> Date: Tue, 7 Apr 2026 10:40:26 +0800 Precedence: bulk X-Mailing-List: devicetree@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: Bjorn Andersson Cc: Dmitry Baryshkov , 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, 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-GUID: 6ayCHNw39vnWvugDT87-XZdKu19op0Xk X-Proofpoint-ORIG-GUID: 6ayCHNw39vnWvugDT87-XZdKu19op0Xk X-Authority-Analysis: v=2.4 cv=c9abhx9l c=1 sm=1 tr=0 ts=69d46ea2 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=jyXJO2DQ50KPEQLR6RgA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDAyNCBTYWx0ZWRfX4hoBg9dL3GOl x4VstNXXpiQROIWrj31YsKpP39EmpCICGy8ogs1odaIaWw4aialcZSlEr9XkdpM1w0ObzGsjfDv kyN86k3uwBZ52JMRlGwUpDsUBrgqi4OmF60QFOeJqP4UddwmlIaYwK1JWGkmv+NIv04pfjSrUi3 +Omm3JJqh+TuXwm116D8iD6OqNMFpDzKnW2oNkaGXPq4hIgD64mIfDaNQDJkXEBOxGyFXSPAJZR 6eVIu1YVTUz2jqyquVe7FntDAN8cvWUcXcy7dSC691hI5YjikWZonhPF1oTfgJRVps21cPEvkRy h5sHO2vBOdsaYGZ8hR+9jtHT9ma6CrbLdaqfP+Z9FSCmwuyFduufU1CnoBYqmesSYBEmUOzIn2k pydL4Mo2ElShyjNlQdcm3oT0brpZv3dBuL2la7Pxoku0NPLX93pdb9b8FjDbgCxyy2y8wkqP2kG hiiNeTsE5F8tI+3yTow== 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-07_01,2026-04-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070024 On 4/6/2026 11:04 PM, Bjorn Andersson wrote: > On Thu, Mar 19, 2026 at 01:44:48PM +0800, Jingyi Wang wrote: >> >> >> 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. > > I'm sorry, but that doesn't make sense to me. > > The SoCCP patch adds support for attaching SoCCP. This change tries to > address a generic problem shared across all remoteproc drivers (that > does attach?). > > I think you should interpret Dmitry's comment as "why is this part of > this series, please fix this problem in a separate series". > > Regards, > Bjorn Sorry I might misunderstand this comment, this patch only address problem for remoteproc that does attach, I will send a separate series to make rproc_attach called asynchronously Thanks, Jingyi