Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp221570pxm; Fri, 25 Feb 2022 06:55:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwURvYrY2UWpNMki0uuvDdl9oxTA6TTkb8TdtUZvLMO2SnbZ+kczZpExK/n64flijZaV15Z X-Received: by 2002:a17:902:8491:b0:14e:dad4:5ce5 with SMTP id c17-20020a170902849100b0014edad45ce5mr7837970plo.76.1645800921348; Fri, 25 Feb 2022 06:55:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645800921; cv=none; d=google.com; s=arc-20160816; b=da4xVHE22oxufLLNm78jD4JsmZjXss7zwrc+IbSES6/fD6Oren7zkUsrNpLFGEOMyA /kRNtfIUQ1wavhsWhWORm48gmyUMv6d0mC7mMMpRVWnZljql4A9W/FCwSVcMPpxmkarJ V3ff43f/sed0IlBz/q+oKq3apXX9Dpw5rUP+qeKnqY9QLUf6skD7BisKKnX/yS/dH98p jVBEEBSxBgN4iNmFyXXeSSdgSEUK6sHfev6v3XseKCuP9oYdvkknyGD6YqWqWvjkfUgJ W6kK8U2yq7LUqzhP/VSudCFhB5pjQdtFY4g2MUy42FcyQHihLMDLiB15/ADK6GMH37VG SItA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=mudAdqXMqc4msOewE4p+yyZWAmcOkujoS1WyKCFB/IE=; b=SbmcWPkNrdeCaa0bQz9jCGZsQsxZupr5Ny/v6bI+mDPI5g8WoXOiemIVOPv+F5t12O w3q7xvDR2Zfl8FCTunVuQXjAcPZBFuZ8ilNO6ytaHuCNDOIgtQ7y1uv8kM2g5VOs6p+g PmEKn+cpGu1a2Wec8tYT2DatUNXNcgKes/CSX9U72jpmo7G5aI3HS6sr3i9SkkUvHb3j wQAMDbP83/dq1faPl9/dSQ6op63Y3Xso19k+kTXzYNRleuhnRoMLbeFIppZP6IKoizRQ 6g7/gob8lS361KHaT4UlfJEs7TDV3sx9vBUeLWeu2SBIf8+8sYLIo6nH97ViaT5qJdaA HZfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=FFt9T0Wq; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a170902e88200b0014db1fdfe52si2234832plg.361.2022.02.25.06.55.04; Fri, 25 Feb 2022 06:55:21 -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=@quicinc.com header.s=qcdkim header.b=FFt9T0Wq; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239698AbiBYKkg (ORCPT + 99 others); Fri, 25 Feb 2022 05:40:36 -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) 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 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