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 87E7F3A0B02 for ; Thu, 5 Feb 2026 09:02:42 +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=1770282162; cv=none; b=hm4bo1DhnvTZei20zKyVL0PQZzgwoWDUqNXRDTb4hT6ZdfmG9TJbvwWxrgoTUjkegEQ4SZ68Keo9Ie4g27x5qWtkwoO6S69l9IjjZBa83Qv8/V72R8O4ZorhJvhg344FsRjWA9789Ncjl3VcbZqHpWvFaLTNOfRAhn/gTBCcQzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770282162; c=relaxed/simple; bh=+dhBtouLWSvY3jALl9A606nvQKrGJ8Wx29beMgUMgtY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=mRoE5gzIYGUv2f2yZ2rkGrgu3hFLB1Hc6Py9frnxH71dn3u0hO4ksY7r9odAWkx/BR0AZVW7thZTp46sMHWiibuR6VXnRMJZajFNhMtmGLbEWvcoCv+P5ZQmY8Rds80cB4i6PXA780yZnTjBzP8miBNh27lw/JLJ7PrEqeiS5hQ= 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=Z9G2JH3v; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ok/wE8tK; 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="Z9G2JH3v"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ok/wE8tK" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6153dkGj3030973 for ; Thu, 5 Feb 2026 09:02:42 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= VOdyGAn6x8GSzehJDyJ9HjphbmLW3tpOReuTJmduJx4=; b=Z9G2JH3v2b6P7yor /9sx4yGotW6kJ/btGBUXUE26kLTIqSDnms/J9+yWAqG2hPDjuxw6wPI76Y0BYYkV Tc8XF7M2O2Vpm0015J0cpbUfJhOzUYLDr4+iLnmBLX5IoShm50hznS+n+LJDMmNH xpQZ4a2ZELbqN8jbg4V2P0lWCE77xgJHjgo3xVcbpZnOgEirNL0+64trKlXHnHIc rDmC1XdQwMOuT7WVFIlp7gxTDMJbD84VShB2Y8Yh/FHGoYtBM4u5nxKwjmYZHb5v aef2KEQSElp2eSvzC3uMkOIclB1tWPdIVHf+AuX86LVByzzzR4Kn68xWrau8K9rh PacvXA== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c4a7tjhfq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 05 Feb 2026 09:02:41 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-82184c384aeso1300544b3a.1 for ; Thu, 05 Feb 2026 01:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770282161; x=1770886961; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:cc:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=VOdyGAn6x8GSzehJDyJ9HjphbmLW3tpOReuTJmduJx4=; b=Ok/wE8tKodt5cgOqT7PGvR9TM/VEu288vbw2Yegb8bn+xQT4lia5KGUtj3RB/tZ9tX l17RgJ5cfBONYZ1xoFw264T+2DgwR5d+ixfTbfZ3UY1gKQCnj2Yot+iRPiygCV9EVFRC Li/O1Wk8Zi9eI5g4qxtx0orzhcL/oxCQ+h1NPoJc70lj31unXy+erSVlx03DFKtTWHQl Th0FROZbb2Ot/IXyq3ayLAA+kD4NmQQcuuZodNxOQw6NRaHfCbu7zW5cEYF5z46WLqcX 39OBIMmKBTs2iAeqjXAnoF5kJOpV++V7A+TNU6jUOOBW6omIzxG02dbv+NqPz9lueMdw prAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770282161; x=1770886961; h=content-transfer-encoding:in-reply-to:cc:from:content-language :references: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=VOdyGAn6x8GSzehJDyJ9HjphbmLW3tpOReuTJmduJx4=; b=a7E0OoccYI2WZc2pcFpBhEGpiDHbbGiVI6Gnntzi8y4uQJczhhWGGS+/TXcZBC2Id/ uuuanRUTnLusqRqN4pi/CW+a+jtXX2MeSV81i0HOAFKYJyqRWcWYfHXhsCyeOXeeEIhe XRKNOPoHo0101jh8J++j0M1QZvi1wSUv3ICVNMD1//Kr1E/qr+t1VBwcI8xriVHNjrk8 N+/pNoFbJGZ/iRqGwzLyMJds10MQbGWJ7HuHSi5WsBM2VdD0TdbtKcNHQAzVqRDcnsBo HncESt7TaDXx8MV/kknRxTjaYrBDSOVVC+zN0Lc9l5gKA+0WaiLqouy7Rvr+RlmoI+97 czEw== X-Forwarded-Encrypted: i=1; AJvYcCXvarazFpKrsgaRIW0gyhk7BuIFWM5cYqQ1Cjux0qSMDdNGpf0foy2pWp4JU5xm+JtZtxrbo1VMHYEm7T0=@vger.kernel.org X-Gm-Message-State: AOJu0YwUh1qXwzBXJukcRHq/9DVuWWQVmYYlLsEGLUWzzNNfDspxmoKK gv1owOG/qZMUD/NyVnvwLX99yHzEEJNXvWaqk/7zd8kYpOshEGCJEXkGHlDs03fHBoKMAn81mEF oIC2rxbnI2x+MXfrh21t84pWPbzSZ6Ho7rvd0eCgB5AtgbsBkGslAQz6VeCuFs3K4Nfg= X-Gm-Gg: AZuq6aIw9kaJBujU59g1g0VRlvIcfNwpVGRQ0vQWTs/wI5xPun46yb/jA4ecSBqUlcS GL8HmjdFzWjPMPv4pSyQ20/yMmnZf4GqjlGPM9TWbo4Aw4vaI9v3RUSCJE1K25xLPwR1TwfzBRt 7NORHcCZBVkoX6GHbSqRHVHwqbwCDdgZJqrbVQGc9PoAhreEhdbJZgGzmNQODDoS4/Cukb8M2G+ oLdD1B5fMcrcosL1njYWIFNwZTvGDMY/0UBJYT8+UfsJbamYGi1tN1fdSLRWN7Z1O+nXV3ic8mG 858I85etV0iHqqDaqp64NLfFvPsakEGV0MjIobXifmJIoGiz9U+ftzzQBmRlDvjWgxC6BUexun3 XjrHPI+SNA6kW+uKzG/OEiWFRsDx1zazx3wYRdl3i9yrBtRkyPxsYqYIGezUsJkHOIiGpGTMkS/ 52MKcO X-Received: by 2002:a05:6a00:3cd6:b0:7f7:5d81:172b with SMTP id d2e1a72fcca58-8241c4c4babmr6387704b3a.42.1770282161144; Thu, 05 Feb 2026 01:02:41 -0800 (PST) X-Received: by 2002:a05:6a00:3cd6:b0:7f7:5d81:172b with SMTP id d2e1a72fcca58-8241c4c4babmr6387676b3a.42.1770282160705; Thu, 05 Feb 2026 01:02:40 -0800 (PST) Received: from [10.133.33.108] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8241d1694c8sm5176743b3a.8.2026.02.05.01.02.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Feb 2026 01:02:40 -0800 (PST) Message-ID: Date: Thu, 5 Feb 2026 17:02:35 +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 v2 4/4] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe To: Dmitry Baryshkov References: <20260115082851.570-1-jianping.li@oss.qualcomm.com> <20260115082851.570-5-jianping.li@oss.qualcomm.com> <3ba77da6-4a43-4e2b-b4d6-3d58c403ca0e@oss.qualcomm.com> Content-Language: en-US From: Jianping Cc: srini@kernel.org, amahesh@qti.qualcomm.com, arnd@arndb.de, Greg KH , linux-arm-msm@vger.kernel.org, thierry.escande@linaro.org, abelvesa@kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com, Ekansh Gupta In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: bybDvd5v-tZO5hHHQNSnIviBK124ZtIM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDA2NSBTYWx0ZWRfX/RsoLrwAuYW7 39o6vRMf+kbBENhjQDmFUEuQ5CRv+yE6N2T//jRUCLKuSwmBNTubhgrVDca78Mltrz7lytbiAGY gDsuQkBKjRp1II9IJY8e/wYxRpAJ9J9Sol++ZpLLm98/q7/V2qROmUSnX57vJYt9tBMGQKT7gVm QAgaq1j4tIYR2mAcOD/Jh5BNuM2qFLyfmVAXDMzMHoancekxFd5ZGB0Mp+yukbfqFiShKKcypLr EtRRLMLSW2oElGDwJwX4cHEXxG4uffvNs3xUpSQGOaXlWHxsp4tAQ9trDJvlyld/neViFI4KiUc HM4nyQoqLYD+hPPv+dEyWiTJrXkdeItvcogk/WYFLpou2Nc+oYbxCPL5jgp76JLFZrIhnDotI5X t3StMuctoJeZkviSukCzv+TD4POVPFesnSaJwH5GYpzYyIVvyUFozd0cf42QM4oeQ1FUMJNjP+c b3F+0uD/5sLp8dhYuOg== X-Proofpoint-GUID: bybDvd5v-tZO5hHHQNSnIviBK124ZtIM X-Authority-Analysis: v=2.4 cv=QaVrf8bv c=1 sm=1 tr=0 ts=69845cb1 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=hk6yhF1Z7CYCzsAHo9MA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_01,2026-02-05_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050065 On 2/4/2026 5:19 AM, Dmitry Baryshkov wrote: > On Mon, Feb 02, 2026 at 03:06:59PM +0800, Jianping wrote: >> >> >> On 1/16/2026 4:49 AM, Dmitry Baryshkov wrote: >>> On Thu, Jan 15, 2026 at 04:28:51PM +0800, Jianping Li wrote: >>>> The entire reserved-memory region is now assigned to DSP VMIDs during >>>> channel setup and stored in cctx->remote_heap. Memory is reclaimed in >>>> rpmsg_remove by revoking DSP permissions and freeing the buffer, tying >>>> heap lifecycle to the rpmsg channel. >>> >>>> @@ -1370,8 +1346,15 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, >>>> args[1].length = inbuf.namelen; >>>> args[1].fd = -1; >>>> - pages[0].addr = fl->cctx->remote_heap->dma_addr; >>>> - pages[0].size = fl->cctx->remote_heap->size; >>>> + if (!fl->cctx->audio_init_mem) { >>>> + pages[0].addr = fl->cctx->remote_heap->dma_addr; >>>> + pages[0].size = fl->cctx->remote_heap->size; >>> >>> Do we need a flag? Can't we assume that remote_heap is always to be >>> allocated to the PD? >> We do need the audio_init_mem flag. >> Once the PD starts and daemon takes the memory for the first time, PD will >> start using the memory, >> meanwhile, the daemon can be killed and restarted. In this case, the memory >> is still with the PD and the next >> daemon connection should not take any memory for the next request. This flag >> is maintained to ensure that. >> The memory needs to be resent only if Audio PD on DSP restarts(due to >> PD-restart or Subsystem-restart) > > This needs to be explained in the changelog. I will add it. > >> >>> >>>> + fl->cctx->audio_init_mem = true; > > What if there are two racing IOCTLs, trying to init AudioPD process? There may be a chance that two threads enter ioctl at the same time, and seeing that audio_init_mem is false causes it to send twice, so a cctx->lock needs to be added here to ensure that two threads do not enter simultaneously. > >>>> + inbuf.pageslen = 1; >>>> + } else { >>>> + pages[0].addr = 0; >>>> + pages[0].size = 0; >>>> + } >>>> args[2].ptr = (u64)(uintptr_t) pages; >>>> args[2].length = sizeof(*pages); >