Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2989217pxm; Mon, 28 Feb 2022 09:50:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSuRAGVyGRw936JkXq+2ca/BrK8XizoKN0WhnY1zafxaEt3E1NSilXRXuIlWwKWpRvqZ80 X-Received: by 2002:a17:90a:dc81:b0:1bd:2d28:4bf4 with SMTP id j1-20020a17090adc8100b001bd2d284bf4mr10046135pjv.206.1646070615405; Mon, 28 Feb 2022 09:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646070615; cv=none; d=google.com; s=arc-20160816; b=Volh5ZVf4sFPxctAaGsmvxM9M3LlSNS8UPGuyCQdJX+xCQZQknSx6BZeedE7efUPeq KT8pisJkJRX9ReS6LBSkN03fcLaJQgz9P3ZiLJGyDjXTWUkPlle6K8ICbZAIXivFlOSS HnE0tUJk2oKm/ik2r7e3GveXTu81rt/C/Wr5JQUfXpXwLWVMxtApbOiYBH0M4+MXHTNs HyUQnQ2FHgNc1EWcCQxMNKVQhbkG5c6HyggKbVZcnEEW1hcPFqlYubGuZYXs26++KT6x BhbzffyShd9+M7QXf9SJIsCo8FgQ+99rn5uZPVWQXxW+v8mVs6eWNE3/zGvuY7znGa7K 9DCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=m+rtOFWhDi8V6wphUcuxOzEfwBnHdV4f4I/SuPu6xcI=; b=iBcPxSVPUAmzMGDaYDP0lYsFF/1b5+ixpep+uIFF5xy2Q6eWPYwV4NVDktFr9GrbBC hJpGtBeYmWeHCCrDLkew6Kkz8evcAlQ9+EIT/UAKQyAlbv1YhWmkncyu+c7JzRLS3zDO AFQYfk7UmYgBOa3udTnJTlPLzkDwqS47h+ZEqzb2nRCCurpf/wjFzAEjpkFbR/N1ndFA t571u59wCIPgHb3QjqyXyFz8ZCP5URfKEUCtsvSAV9Bdw2FRktlg7AHeBIeVJamd0HRD QWCzE8bK3LB0Exd5Hyy+mGZ6tnqopTwFyZwzAZnPN2t+a2x/9Vr3b33A+vfMDJAUpMX6 VkMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LX+K4s2b; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=gtpL5nrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c137-20020a63358f000000b0037589f4a3b8si10404261pga.207.2022.02.28.09.49.59; Mon, 28 Feb 2022 09:50:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LX+K4s2b; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=gtpL5nrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237446AbiB1P7M (ORCPT + 99 others); Mon, 28 Feb 2022 10:59:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232034AbiB1P7L (ORCPT ); Mon, 28 Feb 2022 10:59:11 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2903E5D8 for ; Mon, 28 Feb 2022 07:58:32 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 383261F899; Mon, 28 Feb 2022 15:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646063911; 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=m+rtOFWhDi8V6wphUcuxOzEfwBnHdV4f4I/SuPu6xcI=; b=LX+K4s2bnN0TZrGYKjuGyP5UUwpJhUOEe0xD3owpa3T86p9lry6No/WfwFIKWDSDsIi8hb wa0Xi03HcQ8qodmjLGvTS5uEObC8cAQZGAWwtI5nxA2EoPnKi8bS+mn8QLEC1Re/TuQtG7 s4GBbptvLgnD+UwmNjLblLdWE+gPmIE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646063911; 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=m+rtOFWhDi8V6wphUcuxOzEfwBnHdV4f4I/SuPu6xcI=; b=gtpL5nrIf2snMGxQkf7AnZZsGNzoF8HADw4yJHGFFMKFcjUkcCvpPbh0WRn99NV7kTywAS VvyTOsmWdavXZ1Cg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id E6D29A3B84; Mon, 28 Feb 2022 15:58:30 +0000 (UTC) Date: Mon, 28 Feb 2022 16:58:30 +0100 Message-ID: From: Takashi Iwai To: Raghu Ballappa Bankapur Cc: Jaroslav Kysela , Vinod Koul , Takashi Iwai , "ierre-Louis Bossart" , Mark Brown , Kai Vehmanen , "Ranjani Sridharan" , Takashi Sakamoto , , Zubin Mithra , , Krishna Jha Subject: Re: [PATCH V0 1/1] ALSA: pcm: fix blocking while loop in snd_pcm_update_hw_ptr0() In-Reply-To: <35bfd332-891f-1323-8b61-9e4e2fc5cd1c@quicinc.com> References: <4d8b1cb4b0db88c3e28207a81403fbf1e4a87bff.1645784757.git.quic_rbankapu@quicinc.com> <83e4b67d-91d3-dca9-4b1f-d209f927d517@perex.cz> <35bfd332-891f-1323-8b61-9e4e2fc5cd1c@quicinc.com> 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Feb 2022 13:26:36 +0100, Raghu Ballappa Bankapur wrote: > > Hi Takashi, > > Thanks for your feedback. > > I see your below statement > > 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. > > Please review if those changes are Ok If you mean about your posted patch for "those changes", as Jaroslav suggested in the thread, we may take a different approach: just set the minimal hw_ptr_buffer_jiffies to 1. Could you try this and submit the fix if that works for you? thanks, Takashi > > Regards > Raghu > > On 2/25/2022 4:53 PM, Takashi Iwai wrote: > > 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 > >