Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp147890pxm; Fri, 25 Feb 2022 05:35:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLHi0OOyinJrwCm3io/j4bo1Q7KE3TAZZ0/UbvX0MmJfQI5aoy3+deSzuIwBDI2Y4sPQ/O X-Received: by 2002:a17:902:e542:b0:150:e0a:c21e with SMTP id n2-20020a170902e54200b001500e0ac21emr7660115plf.59.1645796115988; Fri, 25 Feb 2022 05:35:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645796115; cv=none; d=google.com; s=arc-20160816; b=X58kKONKGfYLGeo6To/kwP8KiPRRgIlN/Oz5z3D5q3Vk4STom8VyQyUegP/NDTq4yy aG8ECixUKHKO/C+DnxNeMJ0qDDJiLgUvd2G2NVhnIEM27D2E1SZqiqSjdBHO+YFTAZFb p+BhCjVePCaef/GMSS8XmqaPT5AnNt834LLOKnAVqvhQXF0ku96icBvXI96UZeRuY+dw BrUcH8W96/cQyWygEyjLWVcnyyviMxLzpMDlEZo1iYHArfXbbxp7TybKLsrwxHLk7fvY Gzt1Qe308LnHRT7u6Oy8wL6/87ajx4eV2004DpsLizICNdLbCfTxmlaQrY1G3gURAkU+ eEFg== 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=I1cUAs5p8YagTc3OqTQ5ToQ2uL2zX4mTWJqUy1RYpiQ=; b=Jx2nlCmrXO2Rd8kbUQWOMnKjixsGHb40QgNKsgE5ad+kQKXCBUlkIg+CV2S/qNArZO ievPNOkpP8DiMuQCPf2RSG4PUKmnvTbKvR6OCgrPzRMm6J6pjO3KAg77TTDKXrqzm5hK 5Zz01RSfsP853KK3Vy69QQYBY9wBDDwVyG3ggCz8i1/glJBe2KYyWvpQAki6j/Y7xiVx McYCHYASYbTsi/PxT/Hbma9Yu43+EWMYL127U9FDC4IWaTYZy5xNAcxm6H8SM+/UOYt6 OhOZ1p6kkp0dvX5Ybwp52TVNaBEtI4njrX4mYCH23v+ooulbUf16uwRt5Wucdben6Q8p SKpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1VDkWvmh; dkim=neutral (no key) header.i=@suse.de; 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 r10-20020a056a00216a00b004e1baee50dasi1885350pff.36.2022.02.25.05.35.00; Fri, 25 Feb 2022 05:35: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=1VDkWvmh; dkim=neutral (no key) header.i=@suse.de; 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 S240009AbiBYLYV (ORCPT + 99 others); Fri, 25 Feb 2022 06:24:21 -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 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 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