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 0904E142E83 for ; Sun, 19 Apr 2026 10:06:50 +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=1776593213; cv=none; b=jcxtYVjrUJpLpE45qDhV2pqhuqXHU9ZcApvevSl4f8ak0qumsFlZcz9xkf6JZlQsDMvJJXLayNLDdOD42CT2jrp1mHHeJdFgEfehSnX5mcg0PKbOUuSyWLeQhLtbMlBXBAMcw1gKKx4pZ/IyxxBsiYWn21Ozg+zynADvs0wMwRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776593213; c=relaxed/simple; bh=EEADTAAAATVi/7bhEQCpebr9+3kZHFyRY+5bNmk3Akw=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=D25I+TGT6v5M/5qfEOboK5VsFePevbGibPIBPataO9h8OuLFb353/cS7Aa//hfyotJa9Z1zKZYCZZWwVekVi/8MATDhQPAqLyT8PMATAvDtUnW2MvqWaRTxOHYC6hbsi9UDyfiK0/K2nYqwt0mnkFqEqHWIf5Njs/SRb/fF1b6g= 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=puSwcU6p; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=J5lw6nuu; 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="puSwcU6p"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="J5lw6nuu" 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 63ILxpld1353659 for ; Sun, 19 Apr 2026 10:06:50 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= XI5BNpMIZ8Y0V/s2/V6NIC81LF/72Sofa7E3Xufqt5U=; b=puSwcU6p8iHAqE6n 8aa7KUtBbfYH30jSmF1QmXGZkuZ1WYrwNBPOa6Q5ERDF07aPMgfDXN9sH1TRKD5R WbkhF/MmAAXWfKqRK2D2FtwC9rZB1YdBbN+YBswcrCd9jngSQRiJVaUGIj8E8ENo GVjritebgRtkjUrd4vNNCrM8VkfOsfgDPG0czGpyQQG1Le3765Z76e3JSdJVZJTM FfHitXht1Bh2cb/sth8EqcNfmEDpyy5DL/mPtwqUY2mezDkeiITG3sxH2NP+kyKu v5eT+ExIqAwaKP3k61uowgp63xgcamOpOrEMKAtUFGxtmdAKjqyrLMk9vq3PAhRA Loamrw== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dkyneakua-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 19 Apr 2026 10:06:50 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-35fb6cd0879so1806616a91.2 for ; Sun, 19 Apr 2026 03:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776593210; x=1777198010; 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=XI5BNpMIZ8Y0V/s2/V6NIC81LF/72Sofa7E3Xufqt5U=; b=J5lw6nuu60gCBIcspz7Etkl1vLI1eqlzzFl8nrwUtsAUOf31jZ7GM43bgSnwNJVUVP SQ7Q4ImLUSlmAtUitDRTAWf90unGDV2Dosg3muQd0JBIx5lUMyajFoKFaHjpYfkw5XVi 4isXhenmzv3muQ+bH+UmXjUX+0d6QGVXcdws+2biLLYLHRHdiYMPQMZrrWxOjZdlu+23 ewN2OqkTRavnmipxUgSEVmbAJUv/CIuC2jRlPiW2QhKdFBAOt5HQRDknGBuO/W+OoBKt oKJz8Qmsj3lAorl5K/GHlPwQwi49WP1ViDRVBgPhlFxnnVoPP70lY4OB3rhhlZNrJlVs LH9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776593210; x=1777198010; 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=XI5BNpMIZ8Y0V/s2/V6NIC81LF/72Sofa7E3Xufqt5U=; b=e9DHpK+2+sOhYGjffwKT9wkqYRwX9yVYZAg8LFXaMzTyxETt2oNbGJV0Z4nUKC3f3R wOHvYA93qzTpeienDPezUUvoSRZiepyJ/wgSnL6Ybt059IQhvvhEacKAdD5bxoluz1pv Wd0bOMAE8LiNdzIySL8Mu4u1rYMUKbkMFT5V+rnwrNx//gwEQmf+kunFlXLOPsrmB3s9 mBpAOb6ZrcbzPy9t4jNV+jsdmxCdZqWpCAj+VnRy6LYLcT71f5BMv+4GU5MIImWYQO77 815Plhn1Uz2XuyORucPb0KnFopIEO8/DQTA3SpreziErdvgM9Xs3RzB1XBeelJ3WGjSP ZJUg== X-Forwarded-Encrypted: i=1; AFNElJ8VH7ulumKYtJLKzaSdi+ELJeG3Pm3JNH/YFuGPpHrNdYm+XPdOivnobzDiDX2Yk5IEw3o964d+kIsfjD4=@vger.kernel.org X-Gm-Message-State: AOJu0YyTkPr7l4xo5Yr0kSwCCD0Dk4v7vmGLyJtX5apgyGJ9DJxRMZTN l/BwtaQ8s8h1kxkp9zuqdH6rAX6Vwi9e2WrIC2fgbdJHTIb0a1Q45WX/h772P3OpnLxZjkS8MQ7 APqSTZUIrjOHP9GDC+LFbOYIMcZ7wuqThQDkwETnjHdX12sag9ecbavLJ7AEk0HcArnY= X-Gm-Gg: AeBDietgUWSgUpWN6WGNFlocwjv+qKsu0cZIzWfoEmYDHfSW3KzhucxUADiKg+EQZ+X 0Gl7WYyfoq0tUS01ItXqg/aXs5RLOUzBoqi1fWPBMruQNfwN5k6v2Eg3GzhbJXfYnp8rAqD8k65 TQLuxKKKW81BSp4eoURW8dHzyEb7SQW8D2zlm7k50p6y7ArX/6s4P1GenCxEC6IamClE7cJlSUv SXr8ADJJJc2Fh9ZnhAtBY10kYd0Oi3/gckgYQORJCh9HuNhle9Mye7AgkcKs83eoj9WR31AQH66 HuljYb5v2DpHnATrdL131qwVKQiHPX0c6r8WHuvBMQ9EZsyMBhN8ibc4tXau77TpcitIhe5orHR yRpoHYEvyUiFsmPuhEIon8vj6Eu85ov5o6z+bE/6nZruNn0jT6FScabWlV4RiD7CGOVkHcVkQSz A9VlgF2+L2VJSKqtBamDFmPj6CeA== X-Received: by 2002:a17:90b:380c:b0:35f:b5df:448 with SMTP id 98e67ed59e1d1-3614049ed12mr9946215a91.24.1776593209576; Sun, 19 Apr 2026 03:06:49 -0700 (PDT) X-Received: by 2002:a17:90b:380c:b0:35f:b5df:448 with SMTP id 98e67ed59e1d1-3614049ed12mr9946186a91.24.1776593209087; Sun, 19 Apr 2026 03:06:49 -0700 (PDT) Received: from [10.133.33.90] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-361410a7cb5sm7357149a91.9.2026.04.19.03.06.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Apr 2026 03:06:48 -0700 (PDT) Message-ID: Date: Sun, 19 Apr 2026 18:06: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 v4 3/4] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe To: Dmitry Baryshkov References: <20260409062617.1182-1-jianping.li@oss.qualcomm.com> <20260409062617.1182-4-jianping.li@oss.qualcomm.com> <7rfiwbbunlbzmhdjvsfqccltdx7cveahbgg2rk6kkom2jesta4@nnbas4vn63we> Content-Language: en-US From: Jianping Li Cc: srini@kernel.org, amahesh@qti.qualcomm.com, arnd@arndb.de, gregkh@linuxfoundation.org, abelvesa@kernel.org, jorge.ramirez-ortiz@linaro.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ekansh Gupta , quic_chennak@quicinc.com In-Reply-To: <7rfiwbbunlbzmhdjvsfqccltdx7cveahbgg2rk6kkom2jesta4@nnbas4vn63we> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=HbokiCE8 c=1 sm=1 tr=0 ts=69e4a93a cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=LlW_7vAnNt5ooDS3Xh8A:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-GUID: IFwwk5VhS_FthdJrRISjz_NpBTewFiIi X-Proofpoint-ORIG-GUID: IFwwk5VhS_FthdJrRISjz_NpBTewFiIi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE5MDEwNSBTYWx0ZWRfXyQYm3isYXnph 3u0Fn/q0MEmnqMsSoZI9XrkkAj32R9xh07tNPYzjOwJc2PoMTVJjAhLGVc4aYGZHXX3aEyjmUjx jjyD7gE4XOJi52wJNot7QZBfP8POYe/Pccw97KhwhzTGvqaxobmvebuO6ZUvdupNglnjvmP0Zs4 GckCDKYHgQl8iygCDuvHczXkEC2XG66pXj3DJQXcIV1JaMaDwMvoiygZgURlkIoNiQiwkAI8e9h IqEgnYkfykK/nyMGAHOWHzJmWqds0AH4zq0oB2c2LSteeCC3oD6EAQo0ebV8RNkEQek3ZIYHZAj 9bU18eb8z9d/u3iM7TX12RkFzx/+RAh/6gNlg4w7MJ++PPOvKTDamKDwHLnp2+ApIAEOuEc4dyW KPvjUuoWynMq4FhQrnYQ2IJ6cp4B1txuz0nYZz6jkBJxfbNjZBrJYWVS/vLNtEj8u9NdOxkcWan 6jk9yl2Utvr8fTII/XQ== 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-19_03,2026-04-17_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604190105 On 4/18/2026 2:31 AM, Dmitry Baryshkov wrote: > On Thu, Apr 09, 2026 at 02:26:16PM +0800, Jianping Li wrote: >> Allocating and freeing Audio PD memory from userspace is unsafe because >> the kernel cannot reliably determine when the DSP has finished using the >> memory. Userspace may free buffers while they are still in use by the DSP, >> and remote free requests cannot be safely trusted. >> >> Allocate the entire Audio PD reserved-memory region upfront during rpmsg >> probe and tie its lifetime to the rpmsg channel. This avoids userspace- >> controlled alloc/free and ensures memory is reclaimed only when the DSP >> shuts down. >> >> Signed-off-by: Jianping Li >> --- >> drivers/misc/fastrpc.c | 104 +++++++++++++++++++++-------------------- >> 1 file changed, 53 insertions(+), 51 deletions(-) >> >> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c >> index 148085c3b61a..a67ae991c0b0 100644 >> --- a/drivers/misc/fastrpc.c >> +++ b/drivers/misc/fastrpc.c >> @@ -276,6 +276,8 @@ struct fastrpc_channel_ctx { >> struct kref refcount; >> /* Flag if dsp attributes are cached */ >> bool valid_attributes; >> + /* Flag if audio PD init mem was allocated */ >> + bool audio_init_mem; >> u32 dsp_attributes[FASTRPC_MAX_DSP_ATTRIBUTES]; >> struct fastrpc_device *secure_fdevice; >> struct fastrpc_device *fdevice; >> @@ -1295,15 +1297,16 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, >> struct fastrpc_init_create_static init; >> struct fastrpc_invoke_args *args; >> struct fastrpc_phy_page pages[1]; >> + struct fastrpc_channel_ctx *cctx = fl->cctx; > What was the base for this series? It doesn't apply to linux-next. The > code here is different. This series is based on the patch submitted last month. I will redo the next version of the patch based on the latest linux-next submission. Thanks, Jianping. > >> char *name; >> int err; >> - bool scm_done = false; >> struct { >> int client_id; >> u32 namelen; >> u32 pageslen; > This struct is way bigger. In the fastrpc_init_create_static_process function, the inbuf structure has only three members; it only becomes bigger in the fastrpc_init_create_process function. > >> } inbuf; >> u32 sc; >> + unsigned long flags; >> >> args = kzalloc_objs(*args, FASTRPC_CREATE_STATIC_PROCESS_NARGS); >> if (!args)