From nobody Thu Mar 17 19:40:15 2022 X-Original-To: dev-commits-src-all@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 88A0A1A26AC0; Thu, 17 Mar 2022 19:40:16 +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 4KKHYD1JxTz3GtY; Thu, 17 Mar 2022 19:40:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647546016; 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=C0mWUYnkMnXAe7sNLBcxEL6tS/6UVxjGq+gvWMdcEJU=; b=Rs3EXwsGfX/BK0wyet8JXnAaaZNTmQdM2fYZD4mpcWQK3F+5TAoVN4JCwRX+Hur9ioWTyg /M77YxzpN4FNFDddXLiuarz7nt971YpQjYwbbKpQCG/pxX2wcryg+AkPdkphbbUd57TAJk k33cWYfDDlqlVTpe/T4dHQ31TA2RStchmNG7VA9+FOhtP+MBTRgoMVv4SvCK+DZNDj9nOe 2KFUqZJTofVXE5/brGPcSAPneTDSN4L8d/+qk1QR1DmtP69KcQvm2gr2JMZYoO49dLH7+s qpFrrH2boLh/vhBdLtx4j+ROA3goOvCvgM9uq/fjhM7EgKKyrwZH7TKZ1f2r9w== 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 BF67310F0B; Thu, 17 Mar 2022 19:40:15 +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 22HJeFdL067840; Thu, 17 Mar 2022 19:40:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22HJeF7F067838; Thu, 17 Mar 2022 19:40:15 GMT (envelope-from git) Date: Thu, 17 Mar 2022 19:40:15 GMT Message-Id: <202203171940.22HJeF7F067838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 077564cfdb72 - main - hdac: Handle interrupts racing with device suspend List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 077564cfdb7285ff7d256424715e563cbac36f8b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647546016; 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=C0mWUYnkMnXAe7sNLBcxEL6tS/6UVxjGq+gvWMdcEJU=; b=bwkqxqkSxUrHwLhu3bEaJgCPBVp+cPA9PyBplYki7WXWtjZitWo4N+SYaO5U+jjb7E/OLY vXnehQpN8D3+xJSCZTqI56ZHx1FiyaRkv8OBzeWnUWWKR7xuGs9zMCiLtbQ6tecN5WGJ0j /XKJnlnzGYIux93E8aYKOYb4Yjw8BoqvEWO+QWoQO6Vd03ggbd+Q7v99uYg4vPIpZ5Jalf ExpFQUSLd8QBIyvWe+G2q3IHM6Dh84mJ+xc+s/JhHyMNy3Ei51vOSShhP2EFiT/7qymll9 +Mv/jDPaULsvqwLoJusJ+KA4TB4KwiBn8hPHqSXkF8qghH/Hsy++TSUWcE24vA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647546016; a=rsa-sha256; cv=none; b=RF2S5HC6vcSxFw8/+Ym57f6W+kWUiPFkIJI5mHGgUJaIFMwZW2ee7FwTx2aelvBKRUWh7j ACWBZodUgniYtJt09riEBya85v4YK8v40jGAUun90J0v1ap6fmzRqFRywS/KjS3jNN+8Uy RSakanIVJVkACUaH+Xqp01p+uD2Hi0+3rpfXQeAJvvXNEA9VVwMf2qkpd3YVDNE3r17XNE 2Odj8MGtPgrJuahWo1D1fEb+BmYXTOAzziCjgHIGpWUKdrKv7/stnER4kgwnq3rZV2e5L3 GBj8xKVwyvllk/ig1o5z9daRymDK4UjdHv4LaSMNGummRNZEfi6w0p8iT0KaJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=077564cfdb7285ff7d256424715e563cbac36f8b commit 077564cfdb7285ff7d256424715e563cbac36f8b Author: Mark Johnston AuthorDate: 2022-03-16 16:09:17 +0000 Commit: Mark Johnston CommitDate: 2022-03-17 19:39:00 +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. PR: 261207 Reviewed by: mav, imp Tested by: uqs MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34117 --- 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 dc5a03e9807c..8415d63daa69 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