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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9709AC433F5 for ; Fri, 25 Feb 2022 13:24:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E66871EEA; Fri, 25 Feb 2022 14:23:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E66871EEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645795454; bh=J9B/a0jLbaT/B029EhJJONAz4BjyNh45Kx20o4dVs74=; h=Date:Subject:To:References:From:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EnbPalJUP6ZQ94utGP6xaH1WdZ7hreSZDFepAuW/pB2TTx/sdi38NkHv00rne2udf FAGJvUHDOuVtZfI2GBO9H5LxD/jCUJ6J9y1eKafMmP+bWzym95Jg2lyKNBe1xDEvXJ /37TPJaO10OJTtRDlU4B8De3vQLbx3h57Pbwj+KI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A52C4F800B6; Fri, 25 Feb 2022 14:11:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 254B9F80132; Fri, 25 Feb 2022 13:26:54 +0100 (CET) Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2C214F800B6 for ; Fri, 25 Feb 2022 13:26:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2C214F800B6 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="zL5cMZES" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645792012; x=1677328012; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to; bh=p9Ak9NOX9ibO4qAU6vbMRodTIY87h/JOpPOKCV9uebM=; b=zL5cMZES6OrMrGJfjNKIv+UeNll2ktOFjfXSb8XzWJnOOuEIYjtWhJyh /WzV4o5dWq+Hu35+uITeg5uHlmVo6aE9C1aINeh+9k+msvc8BW+hPpKl/ 1Bq9ZZPFlWFyABxMT7Vtbbh43JKvAbAdEYcwz5LfT2+BGhNQMS3n3ZDcO k=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 25 Feb 2022 04:26:44 -0800 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 04:26:43 -0800 Received: from [10.50.33.182] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Fri, 25 Feb 2022 04:26:39 -0800 Message-ID: <35bfd332-891f-1323-8b61-9e4e2fc5cd1c@quicinc.com> Date: Fri, 25 Feb 2022 17:56:36 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH V0 1/1] ALSA: pcm: fix blocking while loop in snd_pcm_update_hw_ptr0() Content-Language: en-US To: Takashi Iwai , Jaroslav Kysela References: <4d8b1cb4b0db88c3e28207a81403fbf1e4a87bff.1645784757.git.quic_rbankapu@quicinc.com> <83e4b67d-91d3-dca9-4b1f-d209f927d517@perex.cz> From: Raghu Ballappa Bankapur In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Mailman-Approved-At: Fri, 25 Feb 2022 14:11:19 +0100 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: ierre-Louis Bossart , alsa-devel@alsa-project.org, Zubin Mithra , Kai Vehmanen , linux-kernel@vger.kernel.org, Ranjani Sridharan , Takashi Iwai , Vinod Koul , Mark Brown , Krishna Jha X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 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