From mboxrd@z Thu Jan 1 00:00:00 1970 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 747A3403155 for ; Fri, 15 May 2026 17:38:05 +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=1778866686; cv=none; b=a30nI0TfTrzlTJSYaRO2JjLMhDoeFpUykw3gAb0PRks9AwpHYkVTsV94fZhYBGw4ZvIa1Ac8VxSG49IMqpCMVGjs6AzwYVwskSmUan+u9GEIwskIpvDkNjudBVk8aPdW+hq76FG0SjmFbyuU5U+R8kpuEO4SWFOxAAyEP5qJq5M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778866686; c=relaxed/simple; bh=W8+Ig53lVpXsjPq/DGx3IqIz3WpimTkvM1JWwQQWFUY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=nVAEDMY7Rmxh7NxZRQot/VtleEGnqVavRB2F9O7KmGScTYFWC4Hu5wrcfhSLY8Ys9KyFlVODAdyU/oeVZyTIZT4gEjT3PCxmWR2IWoZN3iI+RYy1S4wOdD5UAJOBXteNY3uaX5TZRcpad4o8vIrWI2twJkNl90yX7iEBRvqKKvw= 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=W67+M+7y; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jQbkJLMW; 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="W67+M+7y"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jQbkJLMW" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64FBWXYs3795697 for ; Fri, 15 May 2026 17:38:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= u1p71XwV9G4stoeAHVhM1++Uu6Qtd34Vo3RUYJGOTL4=; b=W67+M+7ygw9oZQmf NU9l4bIgR95RlgqgI2TUwEfO0ZnM+hRIxe1G9Bahp+lbKa/sJnuwRhiHZWcYm/bK GukzqldGA3NBPKtUlDWlEIiBWEv3BmpYXo8536BodWPqVXj7xJhMMJxLzQ6sU0j3 Meo/MW1jo9yrg9PdJTac7CiHUFPTv6BMiDs6Caiz7pbq1/pfR++FFBvv8dUpCVW3 IxIlVcJy+xNNaByBTHR8W5bnL8jV0qzkuPg35Zco+tf3Zf2k3sVR8kNlZBcsDq3c i6z1HrLS1iZDx1a9fPUuFFx1HzJ8HgvxeQmZzCE5TVtNBtd1jAKo/QCtpkgA+SaX MNVu5w== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e5m1sv74q-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 15 May 2026 17:38:04 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50e2592ea3bso1104931cf.2 for ; Fri, 15 May 2026 10:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778866684; x=1779471484; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=u1p71XwV9G4stoeAHVhM1++Uu6Qtd34Vo3RUYJGOTL4=; b=jQbkJLMWGTXe2oSF7qrko3jL/5q3wDsE+1aIwxuegmDLMduLJJefh4MP0DdOP8Bf60 HGjjJ6hCFUpnGCWD0yaUapXfBUfEQlvnbPkikd3EoE0F2/9i90dA6TgneFDGiyTEbxKl 79D9/KGP2Ezhbo9Faj0osEoOqleI4D07Rt4wwcvcybC8qF7cIjCGbQvg1lkKJPnW39X6 2zCY0Bf528v46tnaoNStwOUyTHB4k3hOKVMkn0v+Uz4cHoyGOvqYK3WOY9fWLrPVgMW0 IePp/SoN+0dvzRRj+8nCzHglViHKppFBUcyETiZMkUCjmtU9RnlUIoZl8DA+fvh6RUum s6lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778866684; x=1779471484; h=content-transfer-encoding:in-reply-to: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=u1p71XwV9G4stoeAHVhM1++Uu6Qtd34Vo3RUYJGOTL4=; b=NvB4BkqXgaioQ5v8rYLThhR8WgmVrqj8bBYFuQ4yHeH9Hjy+oYx9SwNcuyG1WgQmwB 0YBBBurQ7waR0jUZ5DzmRmaG4zIAeKu4atLfkAktRUsS5DwDl3pwWXQzVQ8ZSw+jh1N6 pUUXFshc9Iv5vKBdzbf19QyhsO9wzvy+Ir4SHdRsWM4UXKz2v3jj4MtCNMp6hsy0LE/a /vlbZCixwKHpHLPLU0FlhN420VNvfRZDR/lRPCAIYvEf4x5SgzIs1WJRh71ka1XZ9ThT lsxv3sFjCBaDDz6KtgVcuG6AUtChuytQw9rcYqCC97PMHvs/pvXuY7GBpUY7MNzsgWky B+TA== X-Forwarded-Encrypted: i=1; AFNElJ/sIy2UCg4NcWYyUuQs6GZbbG97OlktpJqfSFaJHSO5isDnvBzh/3LO8llZjuzUAbFp5BgwMl7bt3KU4Jo=@vger.kernel.org X-Gm-Message-State: AOJu0YzGi4GuVkJjdIFgWB7eRcTqx99L9/yCP0ev+72a2v6VRWwqelWF pqMqhuLWHquMr6K1K+az2JUC3S/VUlJld13Vlr7eOfV5kFUnkpfHnTO0f1QBkJ4pdLxTg14QI5Z 4CJNh0GNR7zRjTAgdfwi0tnnfaZv/uheM7E10yiIyWGjTe+stPAfH1NntRM76Ce9Sirs= X-Gm-Gg: Acq92OGV09ttb8dj2dHyOa7Rs/2s/vc9acGgBZBYlTnaH1AQIWE0SrbVHEbV0lRbZ1p RM2XTTNovwa5UIIdWL/V3KamWxxhtgNYUSDxX+oOQrNRUbSlIcyfjoRfoudCaDIDspuu8ux+lBq i6n4Gd5TE22WFm7zeQvx41IK6q8Krf42H6wQA/8CzecKJhP7NpsEko5oeo8jAXwwXXIsCKTFFQ2 iGfQuRaoxXztvrkMoDR3uE6vYf2ETKAcdPYlN3mk2NmgmtTyR5R8JZeYQybnw+Fuq0/5ES+fmVQ Wx/I20omVYO1ckwplPpOFtK7dXxk2AsJbFyv+mS7LRwHfbbUCnJd9e1saEtSgMFJ9JXoB+oRxfM fJB74XD6jNqM0fs4yOPNdTsrgVzCiP+h8E0MEhzkP+eKRqqza X-Received: by 2002:a05:622a:59cc:b0:50d:7406:8f05 with SMTP id d75a77b69052e-5165a0010a3mr65671851cf.9.1778866683622; Fri, 15 May 2026 10:38:03 -0700 (PDT) X-Received: by 2002:a05:622a:59cc:b0:50d:7406:8f05 with SMTP id d75a77b69052e-5165a0010a3mr65671171cf.9.1778866683113; Fri, 15 May 2026 10:38:03 -0700 (PDT) Received: from [192.168.68.112] ([5.133.47.210]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45d9e767d0bsm14967386f8f.3.2026.05.15.10.38.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 May 2026 10:38:02 -0700 (PDT) Message-ID: Date: Fri, 15 May 2026 17:38:01 +0000 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: ASoC q6asm race condition when stopping and preparing the stream To: Alexey Klimov , Richard Acayan , Srinivas Kandagatla , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Greg Kroah-Hartman , Kees Cook , Joris Verhaegen , Kuninori Morimoto , linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: Content-Language: en-US From: Srinivas Kandagatla In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTE1MDE4MCBTYWx0ZWRfX5BzUuKMD2uTr DrmDUEV6NPMA6WKvUj3s38Fa1GdoerO4gBPapkPow9P7yGo6wq9e2H8ErqclvPwLxkE56YcCJ0H JJOJjKkiJaGQSOOeSC3NHUFV4gPqIzKIndmjRLKw7ezwsR3DXIg6pZC4e20dyUZDWf3O64qpXOs qmI4ITdD3PoJvhGmyOPKGqlI1R8R5tfH6x+GSvjj6Guolbj9xq9Y9PkmUC9oZ1aUkU2tVC/8G3c ecVBBmaBdWaN7pcWt+ECLwyZNEbvVNITcqPnjru2OtIRmFBT1dClfhUr9ka5upKNcYUjyv6Rac1 EzytfCF5qjn7663Ok5qjsUG2ArXQ52Gqcd4Y7m6sf0xDN8IIntFbUR2K/YcEe8f1DECOqZYIZ0L sBZYEzLKR1OBBBJ+kTYy2m0qCQIz8WsAUaPgVuQNlTTQIwCkA+vNSaZ4cvex3e/IzO7bOvCwHFz ImwfL3Y7VMlDprcAdQw== X-Authority-Analysis: v=2.4 cv=cZXiaHDM c=1 sm=1 tr=0 ts=6a0759fc cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=LyhoXnAi2jyefnR3urYA:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-GUID: uT71naQmgCFxNQj7PabgmFGm4APLmP2E X-Proofpoint-ORIG-GUID: uT71naQmgCFxNQj7PabgmFGm4APLmP2E 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-05-15_04,2026-05-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605150180 On 5/1/26 3:27 PM, Alexey Klimov wrote: > On Fri May 1, 2026 at 3:41 PM BST, Richard Acayan wrote: >> Hi, >> >> There seems to be a race condition in q6asm when stopping the stream >> (with uncompressed PCM). When receiving SNDRV_PCM_TRIGGER_STOP, the >> driver sets the state to Q6ASM_STREAM_STOPPED and sends CMD_EOS to the >> ADSP. If userspace decides to prepare the stream again in >> q6asm_dai_prepare before receiving ASM_CLIENT_EVENT_CMD_EOS_DONE, the >> memory-mapped region appears to still be in use and fails to map again. >> >> I believe this race was observed since commit 81c53b52de21 ("ASoC: qcom: >> qdsp6: q6asm-dai: set 10 ms period and buffer alignment."), but would >> need to verify. On sdm670, we are coping downstream by keeping the state >> as Q6ASM_STREAM_RUNNING until receiving CMD_EOS_DONE. > > Do you have a reproducer or specific steps to test/reproduce the issue? > Manage to reproduce this on my UNO -Q device, will update you once I have a fix. --srini > >> Can the ADSP emit DATA_WRITE_DONE or DATA_READ_DONE before CMD_EOS_DONE? >> We might need an extra stopping state between CMD_EOS and CMD_EOS_DONE >> so the driver doesn't request more data transfers. > > Thanks, > Alexey