Date: Tue, 12 Jul 2022 17:38:11 GMT From: Doug Moore <dougm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 069ec467c1b3 - stable/13 - iommu_gas: Drop needless bound check in lowermatch Message-ID: <202207121738.26CHcBvu066291@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=069ec467c1b3c2b774e139f69242f65fd5559343 commit 069ec467c1b3c2b774e139f69242f65fd5559343 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2022-06-21 00:34:46 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2022-07-12 17:37:48 +0000 iommu_gas: Drop needless bound check in lowermatch The loop iteration in iommu_gas_lowermatch checks the bound a->common->lowaddr twice per loop iteration. Rewrite to test only once per iteration. Do not worry about passing to iommu_gas_match_one a range wholly beyond lowaddr. Since that function checks the upper end of the range against lowaddr, it'll get rejected there. Reviewed by: alc MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D35522 (cherry picked from commit 70b5d8fa0f9457833027e4a1c57b4e68a9351cac) --- sys/dev/iommu/iommu_gas.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 8007aa575e00..f94ab3756c7b 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -397,16 +397,11 @@ iommu_gas_lowermatch(struct iommu_gas_match_args *a, struct iommu_map_entry *ent */ entry = first; while (entry != NULL) { - if ((first = RB_LEFT(entry, rb_entry)) != NULL) { - if (first->last >= a->common->lowaddr) { - /* All remaining ranges >= lowaddr */ - break; - } - if (iommu_gas_match_one(a, first->last, entry->start, - a->common->lowaddr)) { - iommu_gas_match_insert(a); - return (0); - } + if ((first = RB_LEFT(entry, rb_entry)) != NULL && + iommu_gas_match_one(a, first->last, entry->start, + a->common->lowaddr)) { + iommu_gas_match_insert(a); + return (0); } if (entry->end >= a->common->lowaddr) { /* All remaining ranges >= lowaddr */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207121738.26CHcBvu066291>