From nobody Thu Oct 03 07:29:51 2024 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 4XK3Gl2kQMz5XsFm; Thu, 03 Oct 2024 07:29:51 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XK3Gl1wdkz4svx; Thu, 3 Oct 2024 07:29:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727940591; 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=sljeUFESCdprWuXwwKOlraEa7Zqwy1gA6QJ/vXN099c=; b=wL2iOOAByI+OqpeC7Ggexo2VM0XDZx2dWY48G6ZJYTO1S2ek3GhGurDlJENsJAOkMsJBRK 1Z3hg6PK8lRjECvsMPZxBsddBkTM3Jt51txozXLazckRyZUYZmOlmTF/cb0hKQOEXJLvgT O1E4zyx4r+mS6hrpW7zF/H7YTRsB9wlhbkIqBOwEjbN6VBtlw/jjpAxaRkt8sSF+ylXRLt /NevgN4qCeGbGLRPzOuaU8NLKqzhj6EOccn54ZR8T/LJU23TNEENYqftIGopRy2dEiZ/VA 5fhQD/YUWLkkv780o80zfYyWN8uEUk3QZ3cIFRJNDnW4rKsUiXgf6l5Fj7+RLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727940591; 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=sljeUFESCdprWuXwwKOlraEa7Zqwy1gA6QJ/vXN099c=; b=wQEZUZNIZR1ZfHyFkHnCuonlKowSqqwe1+fYRZIk20X0PwrvQxwetJTpUQmc74EfiQT/0h xCIrxlzaZtUgqDYK8INhLibd2mVhwkbsUIC7GQxQmuCI7pNpDVe1LTmQp0dIkn/ckILXNl GyxvX1DSEn49O2Lp995LlFtItKnmfGOX43X38cuvxfbrsDXRruQsPvmIfjD++Ys+2cJG17 csuwIigmpwnFbEQoHVFpmx6tLWO1BD05moREHlATE131P+3zgEDrhNYvyg+2ApgEGHpdoG GHwFJHxO+QNV4L7Tq1q1EPc8lkxAe47jl+rvkey5m9GAOtIamW/bC7/+IpiSXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727940591; a=rsa-sha256; cv=none; b=m4LWZMUrz69Am4q3OEfFslASovOCup7v4xELjebuA0NLWkxiVoMj9VBwgEdHPh+MRAPc5e Yg3HQruCAnJY1ZRw0rIy2mTb4TBS79tukuTBGDC0LnzUdEcNtRDLBCTJVpF6B63CDMThKi d7PNNpt1cYTavlVXD5NXT9Gtk5u1GCRJ7YcPzdJmsdUvvpyTXkiZhZL21mVXlVl4Hilnnf 52l68bC4cgJ57c/ELNSg0j/tYyoZ/KXALVANr/jTALsSMJsQOovoyfgVP/6NbEXSDe4ZEf NuD2fH9ZebdUO84JIC0oZ6hgUjRRHxU6LqMtuyElE9ESK+D0A9XHGG4o/IR1FQ== 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 4XK3Gl1WHbzh0f; Thu, 3 Oct 2024 07:29:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4937TpaS035011; Thu, 3 Oct 2024 07:29:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4937TprF035008; Thu, 3 Oct 2024 07:29:51 GMT (envelope-from git) Date: Thu, 3 Oct 2024 07:29:51 GMT Message-Id: <202410030729.4937TprF035008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: eb8326421e6b - main - iommu_qi_seq_processed: use atomic to read hw-written seq number 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb8326421e6b35b0dee1a8db669914a97bce5cdf Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eb8326421e6b35b0dee1a8db669914a97bce5cdf commit eb8326421e6b35b0dee1a8db669914a97bce5cdf Author: Konstantin Belousov AuthorDate: 2024-10-03 03:51:20 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-03 06:19:09 +0000 iommu_qi_seq_processed: use atomic to read hw-written seq number otherwise iommu_qi_wait_for_seq() can be legitimately optimized out. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/iommu_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c index 8ff15cc86cb8..db8f94eb584f 100644 --- a/sys/x86/iommu/iommu_utils.c +++ b/sys/x86/iommu/iommu_utils.c @@ -350,8 +350,8 @@ iommu_qi_seq_processed(struct iommu_unit *unit, x86c = IOMMU2X86C(unit); gen = x86c->inv_waitd_gen; - return (pseq->gen < gen || - (pseq->gen == gen && pseq->seq <= x86c->inv_waitd_seq_hw)); + return (pseq->gen < gen || (pseq->gen == gen && pseq->seq <= + atomic_load_64(&x86c->inv_waitd_seq_hw))); } void