From nobody Tue Jul 12 17:38:11 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 2D8A31CFBA22; Tue, 12 Jul 2022 17:38:12 +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 4Lj7JN0dNvz3f4y; Tue, 12 Jul 2022 17:38:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657647492; 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=fP1Ro8QBM+2YStLQba1xv5rYzSemTUyjGwu6tb3xyyk=; b=mz8ktAHWjWC8kuXqtbwxQYgAp4WZ0Dv92NitBX85fSBOeyzQRmwaAHT+NzCsa9A7kUJL9/ O5+ERDw5sRYMIT3t2C2GJ3G3v4hb14XkLMkGHGX+jEmmNHqeXt4yMU1YKpyFDsjGLELwks BHwhGX/ecTS1N7rA40dH27aldeNdCAB/1gIdDX16Mb3Cev3s+6YE8cWpOAx0mCJuW2rJU3 VCDblS5wgmniThCTYnBAPhK4i6eY6+XMRdEigYdnkuln8nvzyCRC44M1E/1FcQEvCIR7sb 16HcehUb/XPMxdZ7FDIn7lH+JLf4120cjmORqvWQ9BY/OHuG8OEm++JeOW/w+w== 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 4Lj7JM6p0wzsdv; Tue, 12 Jul 2022 17:38:11 +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 26CHcB7O066292; Tue, 12 Jul 2022 17:38:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26CHcBvu066291; Tue, 12 Jul 2022 17:38:11 GMT (envelope-from git) Date: Tue, 12 Jul 2022 17:38:11 GMT Message-Id: <202207121738.26CHcBvu066291@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: 069ec467c1b3 - stable/13 - iommu_gas: Drop needless bound check in lowermatch 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: 069ec467c1b3c2b774e139f69242f65fd5559343 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657647492; 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=fP1Ro8QBM+2YStLQba1xv5rYzSemTUyjGwu6tb3xyyk=; b=geAEzROqiRZgnbOiKfkean5lzuzxSyI9hkf9FYRK1fttFSNEHnpIXhbIWr+z+/DHDf6DoB lPrmCKuoxrCs9N/KR6CEn3+pZT24izIn/IockOYn8QoIoMWw4Vh3dfqce4pq3dYSccZ1TL hyT1nDiun4U6Iw03J21sBweON/vnoyRwUQ7mSvJikLfgUu1pT67o4bfKrhLN65a/s9Eag4 lPAfsppLlhdKYOHVLXx3hS+BXVk2qqEaKxFL9eu//rRd1ZDveIc3JFs6wo9PxibBeyAAHW k5QJAk4AGqspkrktIfzM38B3aBRlK6XQPJCDeFlbZEYPAgdLwQlXiZN2sATumg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657647492; a=rsa-sha256; cv=none; b=moD1VZwTE12TR/e03maM6rBgWT781EODrErL+WOsVG9HboYMtYsyyJDbmmt6L6yWrriKy1 h/f4BD3CTGsmhaogdStYwrOoMys2Wx3lnEzZ9PK7CuTy9kALECf5YFWD4TY4ZyFcz914uJ j+4xd9s8kC3FRMfyL5keRTmIu4MHsHLMxFmWkRWa9wPYnpmP4+ZZIVdPJkpF03gZWNgPkH hrI2eikcF0toox1Cp5HNpfvzTCgIkOc44ePWk5U03CXqiPo6zcowrnIOgGbWOp6VBxlsTQ 3sjgDRS9cnA1IpSAXtq/TnWIr/LeTwjroabkDWGCbvVQTBGCX4pslPGNmWf8Ww== 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=069ec467c1b3c2b774e139f69242f65fd5559343 commit 069ec467c1b3c2b774e139f69242f65fd5559343 Author: Doug Moore AuthorDate: 2022-06-21 00:34:46 +0000 Commit: Doug Moore 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 */