From nobody Wed Oct 12 02:32:34 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 4MnGry4nk5z4f57w; Wed, 12 Oct 2022 02:32:34 +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 4MnGry4HsKz4Fb3; Wed, 12 Oct 2022 02:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665541954; 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=c+9CqKyvR6nDxHrSoZxlgpIS3KZyXFXtWzcZ7von7QQ=; b=NsEU1Y8/VBRZ7PIg1vNwDuLDoDzfjgLQa+Q6ya6nmeUFlAWoNWeeCNDKgaoJjBmpohBQrY X9KxTOQu5pW/KAct1FwrWAZ9jTDdgSzbSGCm4bCUR8npU/pVTgZQfJDxDi5rs2r6Eh8UfX z+cx/iLP6gUnA8GrUpAohgkrJLbh5QvvQJOq2Q24u4rL9PBzaL0HudF1WjUdccAfN/6aOP UPjzTYmYz14oO7QLqAW5mO+v7zqZC30NuRH01zpMuzCgKOOQZ7sfankcW/39rT+dqDngnV YjVFwoFwqqPVORVeVnmfMrXjU7VC0IQCjqjbOd+RK10CO4l2/9Mw7W4EGjV4VA== 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 4MnGry3LGrz19b9; Wed, 12 Oct 2022 02:32:34 +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 29C2WYdV044604; Wed, 12 Oct 2022 02:32:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29C2WYVl044603; Wed, 12 Oct 2022 02:32:34 GMT (envelope-from git) Date: Wed, 12 Oct 2022 02:32:34 GMT Message-Id: <202210120232.29C2WYVl044603@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: 7e139187708a - stable/13 - iommu_gas: don't remove and insert boundary entry 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e139187708a5171d441f1c828d581bda0ab9cdc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665541954; 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=c+9CqKyvR6nDxHrSoZxlgpIS3KZyXFXtWzcZ7von7QQ=; b=P5bW404gp9uhT1sLB8uRiBqWhb2uq99+lKU7HrZ13TkwDNn0kcT55xcMOtQ6OTRDWW+17z o/k/AqyehZGRmHUsiGwy5o7WKpGVAZR8FEuywhV56TGUzDUTr2p0p480DihLjLohZ5A+qy 2Q1mCCp/YxTj2ZTaVJroCLHMWoC69bjA1V79/RSwcyNhMx0Ba0//bf4p7FiA+OSIbVcmzw fyjx8sSm+cKjF+O5VX9oOYJ2L+zmIsoVmMLgYLFLjQ+gANlI8072uFn7r0WttLkL2TW1Bs whdkZeLy7R3h0noo8G5No/Dl1z/vFdWnQMk6xcQTq/FvDu64sR1GOYTqNhTHbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665541954; a=rsa-sha256; cv=none; b=QndAZenvMDmlZT1TgZD2v87JKsXWepIH0Yse7MoFP3i9BdbDK0U0bOxGl9JZmnFNs+Fwac 6L5WSKY75NsXtIhqmtif+Ml4RKAah6rBBeOu2WrmQ3vtTsZLaJ4CMmCRNMSMHkq/P6JhOZ 9IsktQU8r0qJ3nXd9Nt5Lt6nHjbecxemF8LdMXkkHKV0pgadqDgVH5tbRZwRXSuYZnDqHl DNZXh+IQZbt8MgBmMbkUE/MsqMWzbeq5z5HkhRa/AEYFJOV60b+GO2CMUCrCmFR73kgnkQ ydYo75GNk11fJFnIbnNOpgv8CCTjKvRVyxWQZO9EWFHpeGVsR80DeyEU72snXg== 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=7e139187708a5171d441f1c828d581bda0ab9cdc commit 7e139187708a5171d441f1c828d581bda0ab9cdc Author: Doug Moore AuthorDate: 2022-09-16 20:32:11 +0000 Commit: Doug Moore CommitDate: 2022-10-12 02:31:18 +0000 iommu_gas: don't remove and insert boundary entry Avoid removing an item in iommu_gas_free_region only to reinsert it, by avoiding removing an entry that is either first_place or last_place. Reviewed by: kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D36597 (cherry picked from commit 87cd087a4ae7b272986ce3bcf27ffe4930f15e55) --- sys/dev/iommu/iommu_gas.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index ca5a614060fe..68e22f16c69f 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -580,7 +580,6 @@ void iommu_gas_free_region(struct iommu_map_entry *entry) { struct iommu_domain *domain; - struct iommu_map_entry *next, *prev; domain = entry->domain; KASSERT((entry->flags & (IOMMU_MAP_ENTRY_PLACE | IOMMU_MAP_ENTRY_RMRR | @@ -588,15 +587,10 @@ iommu_gas_free_region(struct iommu_map_entry *entry) ("non-RMRR entry %p %p", domain, entry)); IOMMU_DOMAIN_LOCK(domain); - prev = RB_PREV(iommu_gas_entries_tree, &domain->rb_root, entry); - next = RB_NEXT(iommu_gas_entries_tree, &domain->rb_root, entry); - iommu_gas_rb_remove(domain, entry); + if (entry != domain->first_place && + entry != domain->last_place) + iommu_gas_rb_remove(domain, entry); entry->flags &= ~IOMMU_MAP_ENTRY_RMRR; - - if (prev == NULL) - iommu_gas_rb_insert(domain, domain->first_place); - if (next == NULL) - iommu_gas_rb_insert(domain, domain->last_place); IOMMU_DOMAIN_UNLOCK(domain); } @@ -608,7 +602,7 @@ iommu_gas_remove_clip_left(struct iommu_domain *domain, iommu_gaddr_t start, IOMMU_DOMAIN_ASSERT_LOCKED(domain); MPASS(start <= end); - MPASS(end <= domain->last_place->end); + MPASS(end <= domain->end); /* * Find an entry which contains the supplied guest's address