From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 E752D3CEBA9 for ; Fri, 1 May 2026 15:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777649282; cv=none; b=bZA8dbnM56C3wLxcAN+r90B2jwdb9xj7C9NpZtnYpbnUqlR/Yrd1oOTLA7Ps6C85SYXx+qlroYetNiP7eJbmcFBRpqIY89+FW4fmroC2SyqZSKUeAbi5k9GcX0qkHiC3NGWtfEf9obEOtrL3nyOO91RO+VXHJ6MPwlZ5W6GvCYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777649282; c=relaxed/simple; bh=ztIheWCEenfSMV+AtYcqS3UltJIMz6ZxwFIk+z5VCbA=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To: References:In-Reply-To; b=ZtQLT3OcyCkpIxRkJkFYQKYRh+Vp2ZTo7h7bEPH8LPON+l56oyqEooqIYZbTmougCOALGJOSYEAM18UFfGluHnHLccHG+NNnFCXdqMZgsv8UPBvNjh5/VoWgzLmckRqrgbIMTJwQWCyqO857QZvUl8Nhn3zK38TcGax0TFbRWiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OVthTsFX; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OVthTsFX" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-48a563e4ef7so19565965e9.0 for ; Fri, 01 May 2026 08:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777649279; x=1778254079; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ztIheWCEenfSMV+AtYcqS3UltJIMz6ZxwFIk+z5VCbA=; b=OVthTsFXq0VlH+qTMhiaQMjpb0CcQSOAgd1O1nPXMt7MnKDPiRgBzRVCrDRR7UJf6I KohjaodJW+EHPpl7Y/oHkVtERxtGMMlFhdSBEf8pVAl8ERg6pIkTQzYnL9RoKa97ZtTF VhFOwcDHqXsIYxU/BhfqUMtvrqwyJRJYfV2tebnhQEB9xH/DSNDXYdewmfM5eILXTS05 4NvUWXu+0WvwFJb9wtd2YuIUgUdq7oAyJkZJemq+TzIDhhatLcpaVyNiPHz/Io/635lv 0RY2wHdpzDvYgK2Rg6OFaOyC+koO88/FrVLL0OsQSuAxgHcrXdNMM0Hk/v0NXhrB1Yqj zmkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777649279; x=1778254079; h=in-reply-to:references:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ztIheWCEenfSMV+AtYcqS3UltJIMz6ZxwFIk+z5VCbA=; b=KC7sCpVqlu0vElHZ6K03R1fR848II6tPbxhuBsf3N58zKrziIZugbHEzN5ElbhiAGU G6ia0XJav6gtx6lCbyzrN6uiscjJH37Ymt3gSOrFS8kY0KO41hLDk3ljA46E7phzfMBV JuewxlnP7XAXHfy63vPqf1rTMVkbY9eet85yDFOiRzhC3LpEO74WBTm57ZIHtgKbFTbo piQad5v4uZYM02YdhyL903ORCLlmAu3YN/L5mwiYK0cC6UYFZp/qA/vB5kQnlH3z3sJ8 ft9aq8SDxwSupJOO68E3WR0VvzuWXWDf+F/m0Cxvt3kH2PDVFpF2MhJcUqitAjLl9nk0 8/Cw== X-Forwarded-Encrypted: i=1; AFNElJ+U2FDkThr1n9ay4z4xy/f8I3mNP2ltJN4oRLBmggcixP1n8erKUrpS0/qPenA2Wi2FB2MINlA2hNLRSW0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7hk50BP0S4UpmqCaISFwzG2sF9Infhld1hnFK8BK/RLUwe598 o/9zSvcgY03t4fuipZnuvkqq4rdg1lS5mdhN10Itm7zqk425Tx7YXoIFJFcTLFvV+PQ= X-Gm-Gg: AeBDiesCjtAV88Iqmh6dRc7NtlOmZtLrZH7PlXx8uhR8fM78KFv7DNp2QFcT7wjZCbl q6fp0AIS8Lo/ilEbIWRMj6aq4cX8aDDE/0iRrZY80UYvEJCNMj6as/FbEphmnAFLmIpgKgYOA5+ imJ/fCW95OMVZ68sskVWpeoM86ENcuJycBz21zMvcu+5chHkeR/YdG36kjK/rNBjIJ4OSEJfuM7 rXT2EhtHaImajenb18n6tUbpB0zDpexAYA3+v6YwbgVo0/SNUVoEZhDCpEZeil+a4UF031sVxXo ZP37VC2SoSGiZks4L2RkQdJ1EseGL3o9HV1zaMtiDcN2LjOQNXK9UOlvAjbf9WSQXCKNpQYSKia Y0Cs0FxJcfmtqUTZDE8GiopLdhrWNwmufdUayjLvBeCCVWM5N6SK/rkaa6Zici7iQdWTkEvo8Ec kwgR5FGAOoC3S3WijXvRMrjq4j+QCoBzEAGJNmzmIsDKuf5J3W6kke5X7xaLt81nG/nsUQYXdx3 QEvZ5zZZiVls2TtlwNPx2IDaHs8i5ultiA= X-Received: by 2002:a05:600c:4e88:b0:48a:55d8:7882 with SMTP id 5b1f17b1804b1-48a844438f5mr111793475e9.9.1777649279314; Fri, 01 May 2026 08:27:59 -0700 (PDT) Received: from localhost ([94.4.195.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a822be902sm151439305e9.6.2026.05.01.08.27.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 May 2026 08:27:58 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 01 May 2026 16:27:57 +0100 Message-Id: Subject: Re: ASoC q6asm race condition when stopping and preparing the stream From: "Alexey Klimov" To: "Richard Acayan" , "Srinivas Kandagatla" , "Liam Girdwood" , "Mark Brown" , "Jaroslav Kysela" , "Takashi Iwai" , "Greg Kroah-Hartman" , "Kees Cook" , "Joris Verhaegen" , "Kuninori Morimoto" , , , X-Mailer: aerc 0.21.0 References: In-Reply-To: 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? > 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