From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ACB5371877 for ; Fri, 1 May 2026 23:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777679597; cv=none; b=J38p9+ctUjsFVLVkfO78rCfm84wG6/s+uqSEAYEgX9IQEbTMrMaBaLzW/PCeTJ7Zi4f8rg3gXkoIce6GfJCSsp2rl9h8mAIDXf36StOf5jDY2VJK8RPij8ex+f1a33gR+ccAY4X96GoWK4IzfwtDuLuuE9/SsEoEHbwbC+KQ1BE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777679597; c=relaxed/simple; bh=sTLTPWbkkR+J79wA5XET+FhSZQxeeBxgYYs31m8y0as=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uHJIMfe/wiNfQaDU9SzALGYP9TInWiLJdd2dFVy+ah2OCQcOXXIjlUuHmrDwVDhyhF86UP7alr7MfOY04Ca430w5AIg9G3YDuZLrCxB4H3uhYs6eFBm9u/fARGywa6c0tn1+FB06GkqQ2PhcT52VN7rKa+rFpjfIganBtmkEtJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=racDQXss; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="racDQXss" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-50d75bfb259so15955511cf.1 for ; Fri, 01 May 2026 16:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777679595; x=1778284395; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=auq8XZ/n50n6kobbrJwVjj4F1ZYF7RNuGE7nh7nDocM=; b=racDQXssdAUjh1mCnK3JhFd2oA65ibXLnTVq8SB3N2nPXCCcZDc6QultUq+SpZheNv LumrafoaaZS7oOimJgqoNpepfjG0tC7WlyCb4rxg8jE2lT0qQAmP/7Gj3TJOwE4RBtU6 CwlN1Wrf8kgNjRL70W83RR8Xm4mEuKvSWy34mxcnd3K4maHG6871LL+nL5f2Rt2QBQk4 XbSPciH4fTsbvaiWFu/Yt2X4Kmv/vd5q09xOoDtbqcKMkfd2OVrOaVkHNwDzdlAaYkkh 0xCx0O1rPYwnfpvX/S2ZHodRETG2ZeJ+XLgGmOWH9bK1Ox9a5NpmfkEm5uNxnaadekIy 3jnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777679595; x=1778284395; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=auq8XZ/n50n6kobbrJwVjj4F1ZYF7RNuGE7nh7nDocM=; b=o5fKbZAWTvZuIpljyqoJx8k/EuvvKewo7XoEWFFKEtofWfHeThu/yNKDlgpLVGzLwV HnVD/4szQsQ43fS0ABC/7h2iK959nf0Mj7DiajclsLRZDKQ444gorOLtIb3MATi2v3uq YkcbROwgP9zGYg+At6KVeIg+SyQz3IIpwx2lzw6Nk90c1WGFeB6p4x0xeDN3VA2o9dEw lM1kDZsqSEu2VoZgN47XqnwG4rT0eyF3l4mHUCX/VZpjPu5pWs8qu+FnRD5xEfYOnwE+ If2fB+JcNgYyHsv941ujQuwcD3OxRh3He5ImZio13mxVSGiAKZpxvygCstytzn9eEi9U NXjw== X-Forwarded-Encrypted: i=1; AFNElJ/8i0inYAjQ1Gan+6oPrPEj26z9z/DOlXCX8MBsEndYvO4Iap/nZ7mi9JcKuBxcFv7XigyYL2kMUMU/6K8=@vger.kernel.org X-Gm-Message-State: AOJu0YzuUbhKrzsALAtytSuTmUiGTRczUcPThzGcAARDBn4/dneIuaWZ 8oTpBiXXItpxXxMnZCtEPsTxCV1cyam9QL5xO7J3cgyfx+eFTSBFkXeM X-Gm-Gg: AeBDieud4wirb5UBDDISVUd2jkw2w/dgCXEq9YZGBM8fqY9gJLTDD5qw1cksd5ovtPY n9yHiRhYh+Y2p6BcuHyYRH3xscjlkN5cKj3nrZO+C0qzjL5tnSqzyuwaDzZ8YEMP8JRejv53g6N wsXrzYoTEtqh3EOXbz085GTt6Z0FBSIvNt8QpFGK5PJjVH92ZprMGMDJlUCXevS0z+5LSB1UtmE lFQZenF6UX5umi93YWxnvWS/m3RNdoyEi8HHqTtjDEIxXXASlR2w0HTW19S1t7wzKEcX/iZcDLL qkvVwPcS+1aUVPpEZ2Rq22Aq4HOzXFWPgOsV6Xb6BF1IxFgphAe/NCYPoINS7O4XJV/6Kb1WBKx m2Qlv/jrhHYJIWFNg8SrmI9AR6byHNT/cH0nbcgd854DGCOluqvJY3QPXsI7FRmLH3+coSR26yQ lf1aHJ7M2qsWQZhYuqrG3S3riCU3g7VPnwqELv X-Received: by 2002:a05:622a:17c7:b0:50f:b821:9c3f with SMTP id d75a77b69052e-5104c16c480mr21543551cf.60.1777679595414; Fri, 01 May 2026 16:53:15 -0700 (PDT) Received: from localhost ([184.144.58.243]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51040b8174csm32094481cf.25.2026.05.01.16.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2026 16:53:14 -0700 (PDT) Date: Fri, 1 May 2026 19:53:57 -0400 From: Richard Acayan To: Alexey Klimov Cc: 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 Subject: Re: ASoC q6asm race condition when stopping and preparing the stream Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, May 01, 2026 at 04:27:57PM +0100, 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? I don't really have an easy way to reproduce. On a device with a Qualcomm SoC and q6asm, running postmarketOS with Phosh and without the workaround, waiting a few hours usually reproduces it.