Page MenuHomeFreeBSD

iommu_gas: reduce lower bound checking in lowermatch
ClosedPublic

Authored by dougm on Jun 19 2022, 5:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 27, 7:08 AM
Unknown Object (File)
Tue, Mar 26, 11:42 PM
Unknown Object (File)
Jan 14 2024, 9:49 AM
Unknown Object (File)
Dec 20 2023, 2:32 PM
Unknown Object (File)
Dec 20 2023, 6:55 AM
Unknown Object (File)
Oct 29 2023, 12:30 PM
Unknown Object (File)
Aug 5 2023, 11:44 AM
Unknown Object (File)
Aug 5 2023, 11:43 AM
Subscribers

Details

Summary

The loop iteration in iommu_gas_lowermatch checks the bound a->common->lowaddr twice per loop iteration. Rewrite to test only once per iteration.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.Jun 19 2022, 5:32 AM
dougm created this revision.
sys/dev/iommu/iommu_gas.c
432–433

I don't think that there is any advantage to having this early return. In other words, the next if statement might as well begin with entry != NULL &&.

436

I'm not sure that there is a point to this test.

dougm marked 2 inline comments as done.

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.

This revision is now accepted and ready to land.Jun 20 2022, 11:39 PM