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 C8189C433EF for ; Fri, 25 Feb 2022 10:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239707AbiBYKki (ORCPT ); Fri, 25 Feb 2022 05:40:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238106AbiBYKkf (ORCPT ); Fri, 25 Feb 2022 05:40:35 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E1768F95 for ; Fri, 25 Feb 2022 02:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645785604; x=1677321604; h=from:to:cc:subject:date:message-id:mime-version; bh=mudAdqXMqc4msOewE4p+yyZWAmcOkujoS1WyKCFB/IE=; b=FFt9T0WqV5lV0JWgsvtJ5hCpdEe5PSWe8/tEotcquxQW/KPePRr2bvB0 qPjSHDobENEcom6S6D+/E08H5kHBdIsyA1n4MKcmRe4lV7iZ9OTD+EytG 08lVcRtSxizWRemLnpW+RY/s0JD7eHLnUyOCKTskEQR0vlRLtrkP6mrQg s=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 25 Feb 2022 02:40:04 -0800 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 02:40:03 -0800 Received: from hu-rbankapu-blr.qualcomm.com (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 02:39:59 -0800 From: Raghu Bankapur To: Vinod Koul , Jaroslav Kysela , "Takashi Iwai" , ierre-Louis Bossart , Mark Brown , "Kai Vehmanen" , Ranjani Sridharan , Takashi Sakamoto , Raghu Bankapur , , Zubin Mithra , CC: Krishna Jha Subject: [PATCH V0 0/1] ALSA: pcm: fix blocking while loop in Date: Fri, 25 Feb 2022 16:09:31 +0530 Message-ID: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. when runtime->hw_ptr_buffer_jiffies is 0 then update of while condition hdelta > xrun_threshold will be always true because hdelta will not change. This will lead to infinite loop causing lock-up This issue found during stability test, below log explains CPU lock-up on CPU1 [ 922.249028] sched: RT throttling activated for rt_rq ffffffc0f9970778 (cpu 1) [ 922.249028] potential CPU hogs: [ 922.249028] **FastCapture (11426) [ 922.249105] ------------[ cut here ]--------- To fix this lock-up issue, added new condition to check if runtime-> hw_ptr_buffer_jiffies is ZERO or negative. Raghu Bankapur (1): ALSA: pcm: fix blocking while loop in snd_pcm_update_hw_ptr0() sound/core/pcm_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1