From nobody Mon Aug 08 03:22:08 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 4M1M284TK7z4Yjf1; Mon, 8 Aug 2022 03:22:08 +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 4M1M283kX1z44gN; Mon, 8 Aug 2022 03:22:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659928928; 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=CgxRG2Q7hbWPZgMB1WiePjgBmdY/X4R+wxnl+gEbCdQ=; b=JAgNh6QO6VlAaQ2Vhb+pdjLUhXm8fj//EKp19cytF/eLH0jB6O1mipZi5MQmTGGGFbYs48 JPOgu7fn/XMzAQw/wesVoKxzxO10K5W7PfoyEkOsUC3b7WCzh/oNqF07H74hX8+Rfcl4FM a0vGiMxisVvC47RsssxRM0/6KDeJP9gRiAzL92Jl8rPGbzCqU0u6ETfZ8cxWjThPXBWqgR YiC5rQuJOKwfLZbwPu6I/iWlHNGwztMaFoXTR98S9oTYN70xdidfqs5NtwSy+sa/MDe4sg E1TjVBuGYvs8bFnW7Ree6GmjunLzO58pkaaEdmCCV7Fh3A32Gh1Cpgo7aRcjUw== 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 4M1M282qBXzcwL; Mon, 8 Aug 2022 03:22:08 +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 2783M89p017751; Mon, 8 Aug 2022 03:22:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2783M8t9017750; Mon, 8 Aug 2022 03:22:08 GMT (envelope-from git) Date: Mon, 8 Aug 2022 03:22:08 GMT Message-Id: <202208080322.2783M8t9017750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Doug Moore Subject: git: b7bd54e4ec5b - stable/13 - x86/iommu: Shrink the critical section in dmar_qi_task() 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b7bd54e4ec5b5f59c1651e3600dbc808ddefa316 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659928928; 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=CgxRG2Q7hbWPZgMB1WiePjgBmdY/X4R+wxnl+gEbCdQ=; b=gKnm/Yu0laVQnki0XrgH9qqPsO4pHJAcc/LkTu9QW76KzUj/N01zb19XSeERsejm1jCnt4 6siFmiid+YNGwN3C4TMH+vBURMY0ErqKt7YzwQmbiiww7cp/7fcNvFAsaS7mJ8vgrGFGcU nog2dDMZN8eB/PKZT6c59ZNtiiLX4RmvPPwp3g2tEScB3CRIHh4lcKdejLU78r78XeLxER +h2F+ZPZcQNObpftxJ19Kgp6lNFpN8KVqmBX+7T3wRsU2HeqHVRpSdg4/WPSpzGmiZ3uXh rw9D9L2SdeQ6+7IWI6WIBQr7TOEXh0xS6w9UX3Y3tysXNSTTZ1zCsU2/O9e+uQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659928928; a=rsa-sha256; cv=none; b=k2tCh3R3HawYpWKB5GGWSM7HUM8J8++mfrVsNj+PQdmN+rp0/nv0Pp5CUpw1XuZwDpkT89 SsbFZLHPWT6Yn3tolbkPxaJHu+G8vT5Ld/JSj0W1alO/Yh43MgQTf4Eu3sj6B/a/J/e0UN A8I488ajmXATHz854j3ZHFsBH+OyElKFcdNqgtaldos7zjxngyuh2aLk+j4vvc4aE/oEGH VFJSxsa+kOUmrfm4+Fz9A0h76rmatJcNDHu+oUuDyKjylXw/r/3c+lJP12Uk7DYlPQtU6Q l2HaQH1z7pQ8Dp8GQfxRL5v5rNOyjMtwh3RoVH2VN1r4JxCBtQU+iUuT61ejqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=b7bd54e4ec5b5f59c1651e3600dbc808ddefa316 commit b7bd54e4ec5b5f59c1651e3600dbc808ddefa316 Author: Alan Cox AuthorDate: 2022-07-18 00:56:39 +0000 Commit: Doug Moore CommitDate: 2022-08-08 03:19:02 +0000 x86/iommu: Shrink the critical section in dmar_qi_task() It is safe to test and clear the Invalidation Wait Descriptor Complete flag before acquiring the DMAR lock in dmar_qi_task(), rather than waiting until the lock is held. Reviewed by: kib MFC after: 2 weeks (cherry picked from commit 4eaaacc75535befdb9894cca4e0d8da376328fa4) --- sys/x86/iommu/intel_qi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/x86/iommu/intel_qi.c b/sys/x86/iommu/intel_qi.c index 1400be3852e9..174cf9ea19a8 100644 --- a/sys/x86/iommu/intel_qi.c +++ b/sys/x86/iommu/intel_qi.c @@ -354,6 +354,16 @@ dmar_qi_task(void *arg, int pending __unused) unit = arg; + /* + * Request an interrupt on the completion of the next invalidation + * wait descriptor with the IF field set. + */ + ics = dmar_read4(unit, DMAR_ICS_REG); + if ((ics & DMAR_ICS_IWC) != 0) { + ics = DMAR_ICS_IWC; + dmar_write4(unit, DMAR_ICS_REG, ics); + } + DMAR_LOCK(unit); for (;;) { entry = TAILQ_FIRST(&unit->tlb_flush_entries); @@ -366,11 +376,6 @@ dmar_qi_task(void *arg, int pending __unused) dmar_domain_free_entry(entry, true); DMAR_LOCK(unit); } - ics = dmar_read4(unit, DMAR_ICS_REG); - if ((ics & DMAR_ICS_IWC) != 0) { - ics = DMAR_ICS_IWC; - dmar_write4(unit, DMAR_ICS_REG, ics); - } if (unit->inv_seq_waiters > 0) wakeup(&unit->inv_seq_waiters); DMAR_UNLOCK(unit);