From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DE56C433F5 for ; Fri, 25 Feb 2022 11:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240013AbiBYLYW (ORCPT ); Fri, 25 Feb 2022 06:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235085AbiBYLYU (ORCPT ); Fri, 25 Feb 2022 06:24:20 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85CC01B0BC0 for ; Fri, 25 Feb 2022 03:23:43 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8E24F1F380; Fri, 25 Feb 2022 11:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1645788222; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=I1cUAs5p8YagTc3OqTQ5ToQ2uL2zX4mTWJqUy1RYpiQ=; b=1VDkWvmhd1vjegxFPyX4ZXFS4Iucrp8NxNRwXRESdtEb+H5w/8tMd4ag8b3K4MChdT3YBw EdfziVpxjjyaQGqqtQE0AiBklnC8eJcyQOaveWa7P22yh0qAiE9nTHZ1G7wG49+O0zwFQb X+6+8qdubHI53uukfAgnPD205yxz3x0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1645788222; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=I1cUAs5p8YagTc3OqTQ5ToQ2uL2zX4mTWJqUy1RYpiQ=; b=1WdlpGXT3y/D/5RcLIfHAy6h4oYgxPVF9hPhChETqvt4Kczbc8bEylR6lfliUQBHgXMu7G QkmhgOFJ0TYAQnAA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 90E9EA3B84; Fri, 25 Feb 2022 11:23:41 +0000 (UTC) Date: Fri, 25 Feb 2022 12:23:41 +0100 Message-ID: From: Takashi Iwai To: Jaroslav Kysela Cc: Raghu Bankapur , Vinod Koul , Takashi Iwai , ierre-Louis Bossart , Mark Brown , Kai Vehmanen , Ranjani Sridharan , Takashi Sakamoto , alsa-devel@alsa-project.org, Zubin Mithra , linux-kernel@vger.kernel.org, Krishna Jha Subject: Re: [PATCH V0 1/1] ALSA: pcm: fix blocking while loop in snd_pcm_update_hw_ptr0() In-Reply-To: <83e4b67d-91d3-dca9-4b1f-d209f927d517@perex.cz> References: <4d8b1cb4b0db88c3e28207a81403fbf1e4a87bff.1645784757.git.quic_rbankapu@quicinc.com> <83e4b67d-91d3-dca9-4b1f-d209f927d517@perex.cz> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Feb 2022 11:52:05 +0100, Jaroslav Kysela wrote: > > On 25. 02. 22 11:39, Raghu Bankapur wrote: > > When period interrupts are disabled, while loop in snd_pcm_update_hw_ptr0() > > results in the machine locking up if runtime->hw_ptr_buffer_jiffies is 0. > > Validate runtime->hw_ptr_buffer_jiffies value before while loop to avoid > > delta check. > > I would set hw_ptr_buffer_jiffies to 1 in this case in snd_pcm_post_start(). I thought of it at the first glance, but after reading the code again, I doubt whether it makes sense at all to allow this condition. Since the buffer size is too small and the rate is too high, we can't calculate the buffer crossing condition accurately under such condition. But, having either this zero check or minimal hw_ptr_buffer_jiffies=1 would be good in anyway, even if we add more check for the hw_params for no-period-wakeup case. thanks, Takashi