From nobody Thu Mar 24 15:42:25 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9CC9B1A4164A; Thu, 24 Mar 2022 15:42:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KPTxY41Qgz4f02; Thu, 24 Mar 2022 15:42:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648136545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0YxxFenHJ3RJVNKOamtxaExVsSA1rqhsrww9Ba2Fr14=; b=Fh5aPTXC5aH6rBkG09Ti5dCl/XvkOJyP+NYCg1GeoMg27bqAb/sPN5MDjlkShH+acEyD/U nIXj3DO8izkyiNY2mQvabVyf0HGgJtvqHToTZzNWEsAWDnFFfGtsaZiFf2r97RDYp9qN/m XqRyXsBXnpD1uiKz5NF+xQe9FSd7B3NHh5Hu7d2wGfIIwOjcZESlqni/cNq703agAPRMoZ R7nlhmjgJxn0j2Bsl9+sjgNRbMLnPvb6R69edNDC8fU32unWj44Tl6zL7xaToNHzpyY3pQ V+e+dHTUmEg9ClvV0rGW6z4OLhiiTRm5051qTJlgq7V8hHxqt/d0iCK/5X2Cbw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69A9E1A9D6; Thu, 24 Mar 2022 15:42:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22OFgPxf036230; Thu, 24 Mar 2022 15:42:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22OFgPi9036229; Thu, 24 Mar 2022 15:42:25 GMT (envelope-from git) Date: Thu, 24 Mar 2022 15:42:25 GMT Message-Id: <202203241542.22OFgPi9036229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9f83c6fa52fb - releng/13.1 - hdac: Handle interrupts racing with device suspend List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648136545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0YxxFenHJ3RJVNKOamtxaExVsSA1rqhsrww9Ba2Fr14=; b=xKJawZWbQgFnNLhg4RRZ6AuuV4F1cII7WBytKHSi1PvuJLDs1p4CrzULzK8phOW5llW/+1 3uH9/sF6LRHQ/aS7vWBAqg/wGCTqCoO4HqDVcdA/j+aq2n+vr9iRO6rrMZarSuawjShLQm bAAHOszfPTg5nu622s+Ll+PF9q1LZgM6YMGvmYHD8hiEtKnsxKIwI6sv1rUZsUOxQTCDrk OtF5oxLA0AoQU/tXRm7/sMFsE+g7B2WdGcumqzR++zbwUuKVKnu7UWwIQDnscbr60Ro9km 1KxD6CzscTcyvt2RBED9YlZ4BHGA7+cBjSeODEcwmPdO2Qnz89om03TodXalTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648136545; a=rsa-sha256; cv=none; b=aex/p7UMBGNwsECULyfT2VksnVYIIsgyjNI7654kVHkDrTspCHsMHskFC0puFz7EXbyGuq gHaH5hro/s3ruKc+jed+RaqSqSQI3ej/v1YBMPZLpgBNKYCwsQTzH+vNW6C6p2sUPUjl79 vj304yjkpDZCfjHrAcnaC7Exy/BjaL/irN/DiY1arswd075Rm58oTDjQLf7PsNypCdRG0y PMKo/rc7TeyiQpyPr9rj31xFne7eVAd6krCADauuEo/n2/ep8y/JuelzInIyRHj6Klr81C /ozmwrxc834xdtwm0kpde8bNqI1tzVkPKETD2yFs0YCNCZUHiYd35lE3eVtnNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2 commit 9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2 Author: Mark Johnston AuthorDate: 2022-03-16 16:09:17 +0000 Commit: Mark Johnston CommitDate: 2022-03-24 15:42:11 +0000 hdac: Handle interrupts racing with device suspend - Avoid looping forever if a concurrent reset causes a read of the interrupt status register to return all ones. - Lock the softc before reading the interrupt status, so as to avoid a similar infinite loop in hdac_one_intr(). This fixes suspend-to-S3 on some laptops. Approved by: re (gjb) PR: 261207 Reviewed by: mav, imp Tested by: uqs Sponsored by: The FreeBSD Foundation (cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b) (cherry picked from commit 18a3bada308d89928f170f4098c85cd3f11db864) --- sys/dev/sound/pci/hda/hdac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index c7f5e9dd5b5c..4988a1a28fa2 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -384,13 +384,13 @@ hdac_intr_handler(void *context) * re-examine GIS then we can leave it set and never get an interrupt * again. */ + hdac_lock(sc); intsts = HDAC_READ_4(&sc->mem, HDAC_INTSTS); - while ((intsts & HDAC_INTSTS_GIS) != 0) { - hdac_lock(sc); + while (intsts != 0xffffffff && (intsts & HDAC_INTSTS_GIS) != 0) { hdac_one_intr(sc, intsts); - hdac_unlock(sc); intsts = HDAC_READ_4(&sc->mem, HDAC_INTSTS); } + hdac_unlock(sc); } static void